mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
initial checkin
This commit is contained in:
42
flac/src/Makefile.am
Normal file
42
flac/src/Makefile.am
Normal file
@@ -0,0 +1,42 @@
|
||||
# FLAC - Free Lossless Audio Codec
|
||||
# Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
#
|
||||
# This file is part the FLAC project. FLAC is comprised of several
|
||||
# components distributed under difference licenses. The codec libraries
|
||||
# are distributed under Xiph.Org's BSD-like license (see the file
|
||||
# COPYING.Xiph in this distribution). All other programs, libraries, and
|
||||
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
|
||||
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
|
||||
# FLAC distribution contains at the top the terms under which it may be
|
||||
# distributed.
|
||||
#
|
||||
# Since this particular file is relevant to all components of FLAC,
|
||||
# it may be distributed under the Xiph.Org license, which is the least
|
||||
# restrictive of those mentioned above. See the file COPYING.Xiph in this
|
||||
# distribution.
|
||||
|
||||
if FLaC__HAS_XMMS
|
||||
XMMS_DIRS = plugin_common plugin_xmms
|
||||
endif
|
||||
|
||||
if FLaC__WITH_CPPLIBS
|
||||
CPPLIBS_DIRS = libFLAC++ test_libFLAC++
|
||||
endif
|
||||
|
||||
SUBDIRS = \
|
||||
libFLAC \
|
||||
share \
|
||||
flac \
|
||||
metaflac \
|
||||
monkeys_audio_utilities \
|
||||
$(XMMS_DIRS) \
|
||||
plugin_winamp2 \
|
||||
test_grabbag \
|
||||
test_libs_common \
|
||||
test_libFLAC \
|
||||
test_seeking \
|
||||
test_streams \
|
||||
$(CPPLIBS_DIRS)
|
||||
|
||||
EXTRA_DIST = \
|
||||
Makefile.lite
|
||||
67
flac/src/Makefile.lite
Normal file
67
flac/src/Makefile.lite
Normal file
@@ -0,0 +1,67 @@
|
||||
# FLAC - Free Lossless Audio Codec
|
||||
# Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
#
|
||||
# This file is part the FLAC project. FLAC is comprised of several
|
||||
# components distributed under difference licenses. The codec libraries
|
||||
# are distributed under Xiph.Org's BSD-like license (see the file
|
||||
# COPYING.Xiph in this distribution). All other programs, libraries, and
|
||||
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
|
||||
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
|
||||
# FLAC distribution contains at the top the terms under which it may be
|
||||
# distributed.
|
||||
#
|
||||
# Since this particular file is relevant to all components of FLAC,
|
||||
# it may be distributed under the Xiph.Org license, which is the least
|
||||
# restrictive of those mentioned above. See the file COPYING.Xiph in this
|
||||
# distribution.
|
||||
|
||||
ifeq ($(OS),Darwin)
|
||||
EXTRA_TARGETS =
|
||||
else
|
||||
EXTRA_TARGETS = plugin_xmms
|
||||
endif
|
||||
|
||||
.PHONY: all flac libFLAC libFLAC++ metaflac plugin_common plugin_xmms share test_grabbag test_libs_common test_libFLAC test_libFLAC++ test_seeking test_streams
|
||||
all: flac libFLAC libFLAC++ metaflac plugin_common $(EXTRA_TARGETS) share test_grabbag test_libs_common test_libFLAC test_libFLAC++ test_seeking test_streams
|
||||
|
||||
DEFAULT_CONFIG = release
|
||||
|
||||
CONFIG = $(DEFAULT_CONFIG)
|
||||
|
||||
debug : CONFIG = debug
|
||||
valgrind: CONFIG = valgrind
|
||||
release : CONFIG = release
|
||||
|
||||
debug : all
|
||||
valgrind: all
|
||||
release : all
|
||||
|
||||
flac libFLAC libFLAC++ metaflac plugin_common plugin_xmms share test_grabbag test_libs_common test_libFLAC test_libFLAC++ test_seeking test_streams:
|
||||
(cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG))
|
||||
|
||||
clean:
|
||||
-(cd flac ; $(MAKE) -f Makefile.lite clean)
|
||||
-(cd libFLAC ; $(MAKE) -f Makefile.lite clean)
|
||||
-(cd libFLAC++ ; $(MAKE) -f Makefile.lite clean)
|
||||
-(cd metaflac ; $(MAKE) -f Makefile.lite clean)
|
||||
-(cd plugin_common ; $(MAKE) -f Makefile.lite clean)
|
||||
-(cd plugin_xmms ; $(MAKE) -f Makefile.lite clean)
|
||||
-(cd share ; $(MAKE) -f Makefile.lite clean)
|
||||
-(cd test_grabbag ; $(MAKE) -f Makefile.lite clean)
|
||||
-(cd test_libs_common ; $(MAKE) -f Makefile.lite clean)
|
||||
-(cd test_libFLAC ; $(MAKE) -f Makefile.lite clean)
|
||||
-(cd test_libFLAC++ ; $(MAKE) -f Makefile.lite clean)
|
||||
-(cd test_seeking ; $(MAKE) -f Makefile.lite clean)
|
||||
-(cd test_streams ; $(MAKE) -f Makefile.lite clean)
|
||||
|
||||
flac: libFLAC share
|
||||
libFLAC++: libFLAC
|
||||
metaflac: libFLAC share
|
||||
plugin_common: libFLAC
|
||||
plugin_xmms: libFLAC plugin_common
|
||||
share: libFLAC
|
||||
test_grabbag: share
|
||||
test_libFLAC++: libFLAC libFLAC++ test_libs_common
|
||||
test_libFLAC: libFLAC test_libs_common
|
||||
test_seeking: libFLAC
|
||||
test_streams: libFLAC
|
||||
58
flac/src/flac/Makefile.am
Normal file
58
flac/src/flac/Makefile.am
Normal file
@@ -0,0 +1,58 @@
|
||||
# flac - Command-line FLAC encoder/decoder
|
||||
# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
bin_PROGRAMS = flac
|
||||
|
||||
AM_CFLAGS = @OGG_CFLAGS@
|
||||
|
||||
EXTRA_DIST = \
|
||||
Makefile.lite \
|
||||
Makefile.lite.iffscan \
|
||||
flac.dsp \
|
||||
flac.vcproj \
|
||||
iffscan.c \
|
||||
iffscan.dsp \
|
||||
iffscan.vcproj
|
||||
|
||||
flac_SOURCES = \
|
||||
analyze.c \
|
||||
decode.c \
|
||||
encode.c \
|
||||
foreign_metadata.c \
|
||||
main.c \
|
||||
local_string_utils.c \
|
||||
utils.c \
|
||||
vorbiscomment.c \
|
||||
analyze.h \
|
||||
decode.h \
|
||||
encode.h \
|
||||
foreign_metadata.h \
|
||||
local_string_utils.h \
|
||||
utils.h \
|
||||
vorbiscomment.h
|
||||
|
||||
flac_LDADD = \
|
||||
$(top_builddir)/src/share/grabbag/libgrabbag.la \
|
||||
$(top_builddir)/src/share/getopt/libgetopt.a \
|
||||
$(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
|
||||
$(top_builddir)/src/share/replaygain_synthesis/libreplaygain_synthesis.la \
|
||||
$(top_builddir)/src/share/utf8/libutf8.la \
|
||||
$(top_builddir)/src/libFLAC/libFLAC.la \
|
||||
@OGG_LIBS@ \
|
||||
@LIBICONV@ \
|
||||
@MINGW_WINSOCK_LIBS@ \
|
||||
-lm
|
||||
47
flac/src/flac/Makefile.lite
Normal file
47
flac/src/flac/Makefile.lite
Normal file
@@ -0,0 +1,47 @@
|
||||
# flac - Command-line FLAC encoder/decoder
|
||||
# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#
|
||||
# GNU makefile
|
||||
#
|
||||
|
||||
topdir = ../..
|
||||
libdir = $(topdir)/obj/$(BUILD)/lib
|
||||
|
||||
PROGRAM_NAME = flac
|
||||
|
||||
INCLUDES = -I./include -I$(topdir)/include -I$(OGG_INCLUDE_DIR)
|
||||
|
||||
ifeq ($(OS),Darwin)
|
||||
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libFLAC.a $(libdir)/libreplaygain_analysis.a $(libdir)/libreplaygain_synthesis.a $(libdir)/libgetopt.a $(libdir)/libutf8.a $(OGG_LIB_DIR)/libogg.a -liconv -lm
|
||||
else
|
||||
LIBS = -lgrabbag -lFLAC -lreplaygain_analysis -lreplaygain_synthesis -lgetopt -lutf8 -L$(OGG_LIB_DIR) -logg -lm
|
||||
endif
|
||||
|
||||
SRCS_C = \
|
||||
analyze.c \
|
||||
decode.c \
|
||||
encode.c \
|
||||
foreign_metadata.c \
|
||||
local_string_utils.c \
|
||||
main.c \
|
||||
utils.c \
|
||||
vorbiscomment.c
|
||||
|
||||
include $(topdir)/build/exe.mk
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
41
flac/src/flac/Makefile.lite.iffscan
Normal file
41
flac/src/flac/Makefile.lite.iffscan
Normal file
@@ -0,0 +1,41 @@
|
||||
# flac - Command-line FLAC encoder/decoder
|
||||
# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#
|
||||
# GNU makefile
|
||||
#
|
||||
|
||||
topdir = ../..
|
||||
libdir = $(topdir)/obj/$(BUILD)/lib
|
||||
|
||||
PROGRAM_NAME = iffscan
|
||||
|
||||
INCLUDES = -I./include -I$(topdir)/include -I$(OGG_INCLUDE_DIR)
|
||||
|
||||
ifeq ($(DARWIN_BUILD),yes)
|
||||
EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -liconv -lm
|
||||
else
|
||||
LIBS = -lFLAC -L$(OGG_LIB_DIR) -logg -lm
|
||||
endif
|
||||
|
||||
SRCS_C = \
|
||||
foreign_metadata.c \
|
||||
iffscan.c
|
||||
|
||||
include $(topdir)/build/exe.mk
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
247
flac/src/flac/analyze.c
Normal file
247
flac/src/flac/analyze.c
Normal file
@@ -0,0 +1,247 @@
|
||||
/* flac - Command-line FLAC encoder/decoder
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "FLAC/all.h"
|
||||
#include "analyze.h"
|
||||
|
||||
typedef struct {
|
||||
FLAC__int32 residual;
|
||||
unsigned count;
|
||||
} pair_t;
|
||||
|
||||
typedef struct {
|
||||
pair_t buckets[FLAC__MAX_BLOCK_SIZE];
|
||||
int peak_index;
|
||||
unsigned nbuckets;
|
||||
unsigned nsamples;
|
||||
double sum, sos;
|
||||
double variance;
|
||||
double mean;
|
||||
double stddev;
|
||||
} subframe_stats_t;
|
||||
|
||||
static subframe_stats_t all_;
|
||||
|
||||
static void init_stats(subframe_stats_t *stats);
|
||||
static void update_stats(subframe_stats_t *stats, FLAC__int32 residual, unsigned incr);
|
||||
static void compute_stats(subframe_stats_t *stats);
|
||||
static FLAC__bool dump_stats(const subframe_stats_t *stats, const char *filename);
|
||||
|
||||
void flac__analyze_init(analysis_options aopts)
|
||||
{
|
||||
if(aopts.do_residual_gnuplot) {
|
||||
init_stats(&all_);
|
||||
}
|
||||
}
|
||||
|
||||
void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, FLAC__uint64 frame_offset, unsigned frame_bytes, analysis_options aopts, FILE *fout)
|
||||
{
|
||||
const unsigned channels = frame->header.channels;
|
||||
char outfilename[1024];
|
||||
subframe_stats_t stats;
|
||||
unsigned i, channel, partitions;
|
||||
|
||||
/* do the human-readable part first */
|
||||
#ifdef _MSC_VER
|
||||
fprintf(fout, "frame=%u\toffset=%I64u\tbits=%u\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n", frame_number, frame_offset, frame_bytes*8, frame->header.blocksize, frame->header.sample_rate, channels, FLAC__ChannelAssignmentString[frame->header.channel_assignment]);
|
||||
#else
|
||||
fprintf(fout, "frame=%u\toffset=%llu\tbits=%u\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n", frame_number, (unsigned long long)frame_offset, frame_bytes*8, frame->header.blocksize, frame->header.sample_rate, channels, FLAC__ChannelAssignmentString[frame->header.channel_assignment]);
|
||||
#endif
|
||||
for(channel = 0; channel < channels; channel++) {
|
||||
const FLAC__Subframe *subframe = frame->subframes+channel;
|
||||
const FLAC__bool is_rice2 = subframe->data.fixed.entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2;
|
||||
const unsigned pesc = is_rice2? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
|
||||
fprintf(fout, "\tsubframe=%u\twasted_bits=%u\ttype=%s", channel, subframe->wasted_bits, FLAC__SubframeTypeString[subframe->type]);
|
||||
switch(subframe->type) {
|
||||
case FLAC__SUBFRAME_TYPE_CONSTANT:
|
||||
fprintf(fout, "\tvalue=%d\n", subframe->data.constant.value);
|
||||
break;
|
||||
case FLAC__SUBFRAME_TYPE_FIXED:
|
||||
FLAC__ASSERT(subframe->data.fixed.entropy_coding_method.type <= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2);
|
||||
fprintf(fout, "\torder=%u\tresidual_type=%s\tpartition_order=%u\n", subframe->data.fixed.order, is_rice2? "RICE2":"RICE", subframe->data.fixed.entropy_coding_method.data.partitioned_rice.order);
|
||||
for(i = 0; i < subframe->data.fixed.order; i++)
|
||||
fprintf(fout, "\t\twarmup[%u]=%d\n", i, subframe->data.fixed.warmup[i]);
|
||||
partitions = (1u << subframe->data.fixed.entropy_coding_method.data.partitioned_rice.order);
|
||||
for(i = 0; i < partitions; i++) {
|
||||
unsigned parameter = subframe->data.fixed.entropy_coding_method.data.partitioned_rice.contents->parameters[i];
|
||||
if(parameter == pesc)
|
||||
fprintf(fout, "\t\tparameter[%u]=ESCAPE, raw_bits=%u\n", i, subframe->data.fixed.entropy_coding_method.data.partitioned_rice.contents->raw_bits[i]);
|
||||
else
|
||||
fprintf(fout, "\t\tparameter[%u]=%u\n", i, parameter);
|
||||
}
|
||||
if(aopts.do_residual_text) {
|
||||
for(i = 0; i < frame->header.blocksize-subframe->data.fixed.order; i++)
|
||||
fprintf(fout, "\t\tresidual[%u]=%d\n", i, subframe->data.fixed.residual[i]);
|
||||
}
|
||||
break;
|
||||
case FLAC__SUBFRAME_TYPE_LPC:
|
||||
FLAC__ASSERT(subframe->data.lpc.entropy_coding_method.type <= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2);
|
||||
fprintf(fout, "\torder=%u\tqlp_coeff_precision=%u\tquantization_level=%d\tresidual_type=%s\tpartition_order=%u\n", subframe->data.lpc.order, subframe->data.lpc.qlp_coeff_precision, subframe->data.lpc.quantization_level, is_rice2? "RICE2":"RICE", subframe->data.lpc.entropy_coding_method.data.partitioned_rice.order);
|
||||
for(i = 0; i < subframe->data.lpc.order; i++)
|
||||
fprintf(fout, "\t\tqlp_coeff[%u]=%d\n", i, subframe->data.lpc.qlp_coeff[i]);
|
||||
for(i = 0; i < subframe->data.lpc.order; i++)
|
||||
fprintf(fout, "\t\twarmup[%u]=%d\n", i, subframe->data.lpc.warmup[i]);
|
||||
partitions = (1u << subframe->data.lpc.entropy_coding_method.data.partitioned_rice.order);
|
||||
for(i = 0; i < partitions; i++) {
|
||||
unsigned parameter = subframe->data.lpc.entropy_coding_method.data.partitioned_rice.contents->parameters[i];
|
||||
if(parameter == pesc)
|
||||
fprintf(fout, "\t\tparameter[%u]=ESCAPE, raw_bits=%u\n", i, subframe->data.lpc.entropy_coding_method.data.partitioned_rice.contents->raw_bits[i]);
|
||||
else
|
||||
fprintf(fout, "\t\tparameter[%u]=%u\n", i, parameter);
|
||||
}
|
||||
if(aopts.do_residual_text) {
|
||||
for(i = 0; i < frame->header.blocksize-subframe->data.lpc.order; i++)
|
||||
fprintf(fout, "\t\tresidual[%u]=%d\n", i, subframe->data.lpc.residual[i]);
|
||||
}
|
||||
break;
|
||||
case FLAC__SUBFRAME_TYPE_VERBATIM:
|
||||
fprintf(fout, "\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* now do the residual distributions if requested */
|
||||
if(aopts.do_residual_gnuplot) {
|
||||
for(channel = 0; channel < channels; channel++) {
|
||||
const FLAC__Subframe *subframe = frame->subframes+channel;
|
||||
unsigned residual_samples;
|
||||
|
||||
init_stats(&stats);
|
||||
|
||||
switch(subframe->type) {
|
||||
case FLAC__SUBFRAME_TYPE_FIXED:
|
||||
residual_samples = frame->header.blocksize - subframe->data.fixed.order;
|
||||
for(i = 0; i < residual_samples; i++)
|
||||
update_stats(&stats, subframe->data.fixed.residual[i], 1);
|
||||
break;
|
||||
case FLAC__SUBFRAME_TYPE_LPC:
|
||||
residual_samples = frame->header.blocksize - subframe->data.lpc.order;
|
||||
for(i = 0; i < residual_samples; i++)
|
||||
update_stats(&stats, subframe->data.lpc.residual[i], 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* update all_ */
|
||||
for(i = 0; i < stats.nbuckets; i++) {
|
||||
update_stats(&all_, stats.buckets[i].residual, stats.buckets[i].count);
|
||||
}
|
||||
|
||||
/* write the subframe */
|
||||
sprintf(outfilename, "f%06u.s%u.gp", frame_number, channel);
|
||||
compute_stats(&stats);
|
||||
|
||||
(void)dump_stats(&stats, outfilename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void flac__analyze_finish(analysis_options aopts)
|
||||
{
|
||||
if(aopts.do_residual_gnuplot) {
|
||||
compute_stats(&all_);
|
||||
(void)dump_stats(&all_, "all");
|
||||
}
|
||||
}
|
||||
|
||||
void init_stats(subframe_stats_t *stats)
|
||||
{
|
||||
stats->peak_index = -1;
|
||||
stats->nbuckets = 0;
|
||||
stats->nsamples = 0;
|
||||
stats->sum = 0.0;
|
||||
stats->sos = 0.0;
|
||||
}
|
||||
|
||||
void update_stats(subframe_stats_t *stats, FLAC__int32 residual, unsigned incr)
|
||||
{
|
||||
unsigned i;
|
||||
const double r = (double)residual, a = r*incr;
|
||||
|
||||
stats->nsamples += incr;
|
||||
stats->sum += a;
|
||||
stats->sos += (a*r);
|
||||
|
||||
for(i = 0; i < stats->nbuckets; i++) {
|
||||
if(stats->buckets[i].residual == residual) {
|
||||
stats->buckets[i].count += incr;
|
||||
goto find_peak;
|
||||
}
|
||||
}
|
||||
/* not found, make a new bucket */
|
||||
i = stats->nbuckets;
|
||||
stats->buckets[i].residual = residual;
|
||||
stats->buckets[i].count = incr;
|
||||
stats->nbuckets++;
|
||||
find_peak:
|
||||
if(stats->peak_index < 0 || stats->buckets[i].count > stats->buckets[stats->peak_index].count)
|
||||
stats->peak_index = i;
|
||||
}
|
||||
|
||||
void compute_stats(subframe_stats_t *stats)
|
||||
{
|
||||
stats->mean = stats->sum / (double)stats->nsamples;
|
||||
stats->variance = (stats->sos - (stats->sum * stats->sum / stats->nsamples)) / stats->nsamples;
|
||||
stats->stddev = sqrt(stats->variance);
|
||||
}
|
||||
|
||||
FLAC__bool dump_stats(const subframe_stats_t *stats, const char *filename)
|
||||
{
|
||||
FILE *outfile;
|
||||
unsigned i;
|
||||
const double m = stats->mean;
|
||||
const double s1 = stats->stddev, s2 = s1*2, s3 = s1*3, s4 = s1*4, s5 = s1*5, s6 = s1*6;
|
||||
const double p = stats->buckets[stats->peak_index].count;
|
||||
|
||||
outfile = fopen(filename, "w");
|
||||
|
||||
if(0 == outfile) {
|
||||
fprintf(stderr, "ERROR opening %s: %s\n", filename, strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
fprintf(outfile, "plot '-' title 'PDF', '-' title 'mean' with impulses, '-' title '1-stddev' with histeps, '-' title '2-stddev' with histeps, '-' title '3-stddev' with histeps, '-' title '4-stddev' with histeps, '-' title '5-stddev' with histeps, '-' title '6-stddev' with histeps\n");
|
||||
|
||||
for(i = 0; i < stats->nbuckets; i++) {
|
||||
fprintf(outfile, "%d %u\n", stats->buckets[i].residual, stats->buckets[i].count);
|
||||
}
|
||||
fprintf(outfile, "e\n");
|
||||
|
||||
fprintf(outfile, "%f %f\ne\n", stats->mean, p);
|
||||
fprintf(outfile, "%f %f\n%f %f\ne\n", m-s1, p*0.8, m+s1, p*0.8);
|
||||
fprintf(outfile, "%f %f\n%f %f\ne\n", m-s2, p*0.7, m+s2, p*0.7);
|
||||
fprintf(outfile, "%f %f\n%f %f\ne\n", m-s3, p*0.6, m+s3, p*0.6);
|
||||
fprintf(outfile, "%f %f\n%f %f\ne\n", m-s4, p*0.5, m+s4, p*0.5);
|
||||
fprintf(outfile, "%f %f\n%f %f\ne\n", m-s5, p*0.4, m+s5, p*0.4);
|
||||
fprintf(outfile, "%f %f\n%f %f\ne\n", m-s6, p*0.3, m+s6, p*0.3);
|
||||
|
||||
fprintf(outfile, "pause -1 'waiting...'\n");
|
||||
|
||||
fclose(outfile);
|
||||
return true;
|
||||
}
|
||||
31
flac/src/flac/analyze.h
Normal file
31
flac/src/flac/analyze.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/* flac - Command-line FLAC encoder/decoder
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef flac__analyze_h
|
||||
#define flac__analyze_h
|
||||
|
||||
typedef struct {
|
||||
FLAC__bool do_residual_text;
|
||||
FLAC__bool do_residual_gnuplot;
|
||||
} analysis_options;
|
||||
|
||||
void flac__analyze_init(analysis_options aopts);
|
||||
void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, FLAC__uint64 frame_offset, unsigned frame_bytes, analysis_options aopts, FILE *fout);
|
||||
void flac__analyze_finish(analysis_options aopts);
|
||||
|
||||
#endif
|
||||
1434
flac/src/flac/decode.c
Normal file
1434
flac/src/flac/decode.c
Normal file
File diff suppressed because it is too large
Load Diff
70
flac/src/flac/decode.h
Normal file
70
flac/src/flac/decode.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/* flac - Command-line FLAC encoder/decoder
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef flac__decode_h
|
||||
#define flac__decode_h
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "analyze.h"
|
||||
#include "foreign_metadata.h"
|
||||
#include "utils.h"
|
||||
#include "share/replaygain_synthesis.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
FLAC__bool apply;
|
||||
FLAC__bool use_album_gain; /* false => use track gain */
|
||||
enum { RGSS_LIMIT__NONE, RGSS_LIMIT__PEAK, RGSS_LIMIT__HARD} limiter;
|
||||
NoiseShaping noise_shaping;
|
||||
double preamp;
|
||||
} replaygain_synthesis_spec_t;
|
||||
|
||||
typedef struct {
|
||||
FLAC__bool treat_warnings_as_errors;
|
||||
FLAC__bool continue_through_decode_errors;
|
||||
replaygain_synthesis_spec_t replaygain_synthesis_spec;
|
||||
#if FLAC__HAS_OGG
|
||||
FLAC__bool is_ogg;
|
||||
FLAC__bool use_first_serial_number;
|
||||
long serial_number;
|
||||
#endif
|
||||
utils__SkipUntilSpecification skip_specification;
|
||||
utils__SkipUntilSpecification until_specification;
|
||||
FLAC__bool has_cue_specification;
|
||||
utils__CueSpecification cue_specification;
|
||||
FLAC__bool channel_map_none; /* --channel-map=none specified, eventually will expand to take actual channel map */
|
||||
|
||||
FileFormat format;
|
||||
union {
|
||||
struct {
|
||||
FLAC__bool is_big_endian;
|
||||
FLAC__bool is_unsigned_samples;
|
||||
} raw;
|
||||
struct {
|
||||
foreign_metadata_t *foreign_metadata; /* NULL unless --keep-foreign-metadata requested */
|
||||
} iff;
|
||||
} format_options;
|
||||
} decode_options_t;
|
||||
|
||||
/* outfile == 0 => test only */
|
||||
int flac__decode_file(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, decode_options_t options);
|
||||
|
||||
#endif
|
||||
2868
flac/src/flac/encode.c
Normal file
2868
flac/src/flac/encode.c
Normal file
File diff suppressed because it is too large
Load Diff
114
flac/src/flac/encode.h
Normal file
114
flac/src/flac/encode.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/* flac - Command-line FLAC encoder/decoder
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef flac__encode_h
|
||||
#define flac__encode_h
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "FLAC/metadata.h"
|
||||
#include "foreign_metadata.h"
|
||||
#include "utils.h"
|
||||
|
||||
extern const int FLAC_ENCODE__DEFAULT_PADDING;
|
||||
|
||||
typedef enum {
|
||||
CST_BLOCKSIZE,
|
||||
CST_COMPRESSION_LEVEL,
|
||||
CST_DO_MID_SIDE,
|
||||
CST_LOOSE_MID_SIDE,
|
||||
CST_APODIZATION,
|
||||
CST_MAX_LPC_ORDER,
|
||||
CST_QLP_COEFF_PRECISION,
|
||||
CST_DO_QLP_COEFF_PREC_SEARCH,
|
||||
CST_DO_ESCAPE_CODING,
|
||||
CST_DO_EXHAUSTIVE_MODEL_SEARCH,
|
||||
CST_MIN_RESIDUAL_PARTITION_ORDER,
|
||||
CST_MAX_RESIDUAL_PARTITION_ORDER,
|
||||
CST_RICE_PARAMETER_SEARCH_DIST
|
||||
} compression_setting_type_t;
|
||||
|
||||
typedef struct {
|
||||
compression_setting_type_t type;
|
||||
union {
|
||||
FLAC__bool t_bool;
|
||||
unsigned t_unsigned;
|
||||
const char *t_string;
|
||||
} value;
|
||||
} compression_setting_t;
|
||||
|
||||
typedef struct {
|
||||
utils__SkipUntilSpecification skip_specification;
|
||||
utils__SkipUntilSpecification until_specification;
|
||||
FLAC__bool verify;
|
||||
#if FLAC__HAS_OGG
|
||||
FLAC__bool use_ogg;
|
||||
long serial_number;
|
||||
#endif
|
||||
FLAC__bool lax;
|
||||
int padding;
|
||||
size_t num_compression_settings;
|
||||
compression_setting_t compression_settings[64];
|
||||
char *requested_seek_points;
|
||||
int num_requested_seek_points;
|
||||
const char *cuesheet_filename;
|
||||
FLAC__bool treat_warnings_as_errors;
|
||||
FLAC__bool continue_through_decode_errors; /* currently only obeyed when encoding from FLAC or Ogg FLAC */
|
||||
FLAC__bool cued_seekpoints;
|
||||
FLAC__bool channel_map_none; /* --channel-map=none specified, eventually will expand to take actual channel map */
|
||||
|
||||
/* options related to --replay-gain and --sector-align */
|
||||
FLAC__bool is_first_file;
|
||||
FLAC__bool is_last_file;
|
||||
FLAC__int32 **align_reservoir;
|
||||
unsigned *align_reservoir_samples;
|
||||
FLAC__bool replay_gain;
|
||||
FLAC__bool ignore_chunk_sizes;
|
||||
FLAC__bool sector_align;
|
||||
|
||||
FLAC__StreamMetadata *vorbis_comment;
|
||||
FLAC__StreamMetadata *pictures[64];
|
||||
unsigned num_pictures;
|
||||
|
||||
FileFormat format;
|
||||
union {
|
||||
struct {
|
||||
FLAC__bool is_big_endian;
|
||||
FLAC__bool is_unsigned_samples;
|
||||
unsigned channels;
|
||||
unsigned bps;
|
||||
unsigned sample_rate;
|
||||
} raw;
|
||||
struct {
|
||||
foreign_metadata_t *foreign_metadata; /* NULL unless --keep-foreign-metadata requested */
|
||||
} iff;
|
||||
} format_options;
|
||||
|
||||
struct {
|
||||
FLAC__bool disable_constant_subframes;
|
||||
FLAC__bool disable_fixed_subframes;
|
||||
FLAC__bool disable_verbatim_subframes;
|
||||
FLAC__bool do_md5;
|
||||
} debug;
|
||||
} encode_options_t;
|
||||
|
||||
int flac__encode_file(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, encode_options_t options);
|
||||
|
||||
#endif
|
||||
156
flac/src/flac/flac.dsp
Normal file
156
flac/src/flac/flac.dsp
Normal file
@@ -0,0 +1,156 @@
|
||||
# Microsoft Developer Studio Project File - Name="flac" - Package Owner=<4>
|
||||
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
|
||||
|
||||
CFG=flac - Win32 Debug
|
||||
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE NMAKE /f "flac.mak".
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE NMAKE /f "flac.mak" CFG="flac - Win32 Debug"
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE "flac - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
|
||||
!MESSAGE "flac - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
|
||||
!MESSAGE
|
||||
|
||||
|
||||
|
||||
# Begin Project
|
||||
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
|
||||
# PROP Scc_ProjName ""
|
||||
|
||||
# PROP Scc_LocalPath ""
|
||||
|
||||
CPP=cl.exe
|
||||
|
||||
RSC=rc.exe
|
||||
|
||||
|
||||
|
||||
!IF "$(CFG)" == "flac - Win32 Release"
|
||||
|
||||
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
|
||||
# PROP BASE Output_Dir "Release"
|
||||
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
|
||||
# PROP BASE Target_Dir ""
|
||||
|
||||
# PROP Use_MFC 0
|
||||
|
||||
# PROP Use_Debug_Libraries 0
|
||||
|
||||
# PROP Output_Dir "..\..\obj\release\bin"
|
||||
|
||||
# PROP Intermediate_Dir "Release"
|
||||
|
||||
# PROP Ignore_Export_Lib 0
|
||||
|
||||
# PROP Target_Dir ""
|
||||
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
||||
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\include" /D "NDEBUG" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
|
||||
BSC32=bscmake.exe
|
||||
|
||||
# ADD BASE BSC32 /nologo
|
||||
|
||||
# ADD BSC32 /nologo
|
||||
|
||||
LINK32=link.exe
|
||||
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\libFLAC_static.lib ..\..\obj\release\lib\replaygain_analysis_static.lib ..\..\obj\release\lib\replaygain_synthesis_static.lib ..\..\obj\release\lib\getopt_static.lib ..\..\obj\release\lib\utf8_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "flac - Win32 Debug"
|
||||
|
||||
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
|
||||
# PROP BASE Target_Dir ""
|
||||
|
||||
# PROP Use_MFC 0
|
||||
|
||||
# PROP Use_Debug_Libraries 1
|
||||
|
||||
# PROP Output_Dir "..\..\obj\debug\bin"
|
||||
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
|
||||
# PROP Ignore_Export_Lib 0
|
||||
|
||||
# PROP Target_Dir ""
|
||||
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
|
||||
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\..\include" /D "_DEBUG" /D "DEBUG" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
|
||||
BSC32=bscmake.exe
|
||||
|
||||
# ADD BASE BSC32 /nologo
|
||||
|
||||
# ADD BSC32 /nologo
|
||||
|
||||
LINK32=link.exe
|
||||
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
428
flac/src/flac/flac.vcproj
Normal file
428
flac/src/flac/flac.vcproj
Normal file
@@ -0,0 +1,428 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="flac"
|
||||
ProjectGUID="{4cefbc7d-c215-11db-8314-0800200c9a66}"
|
||||
RootNamespace="flac"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\..\obj\debug\bin"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib"
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="uuid.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\..\obj\release\bin"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories=".;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib"
|
||||
LinkIncremental="1"
|
||||
IgnoreDefaultLibraryNames="uuid.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
LinkTimeCodeGeneration="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib"
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="uuid.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories=".;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib"
|
||||
LinkIncremental="1"
|
||||
IgnoreDefaultLibraryNames="uuid.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
LinkTimeCodeGeneration="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\analyze.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\decode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\encode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\foreign_metadata.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\local_string_utils.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\utils.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vorbiscomment.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\analyze.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\decode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\encode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\foreign_metadata.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\local_string_utils.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\main.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\utils.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vorbiscomment.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
821
flac/src/flac/foreign_metadata.c
Normal file
821
flac/src/flac/foreign_metadata.c
Normal file
@@ -0,0 +1,821 @@
|
||||
/* flac - Command-line FLAC encoder/decoder
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined _MSC_VER || defined __MINGW32__
|
||||
#include <sys/types.h> /* for off_t */
|
||||
#if _MSC_VER <= 1600 /* @@@ [2G limit] */
|
||||
#define fseeko fseek
|
||||
#define ftello ftell
|
||||
#endif
|
||||
#endif
|
||||
#include <stdio.h> /* for FILE etc. */
|
||||
#include <stdlib.h> /* for calloc() etc. */
|
||||
#include <string.h> /* for memcmp() etc. */
|
||||
#include "FLAC/assert.h"
|
||||
#include "FLAC/metadata.h"
|
||||
#include "share/alloc.h"
|
||||
#include "foreign_metadata.h"
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
#define min(x,y) ((x)<(y)?(x):(y))
|
||||
|
||||
|
||||
static const char *FLAC__FOREIGN_METADATA_APPLICATION_ID[3] = { "aiff" , "riff", "w64 " };
|
||||
|
||||
static FLAC__uint32 unpack32be_(const FLAC__byte *b)
|
||||
{
|
||||
return ((FLAC__uint32)b[0]<<24) + ((FLAC__uint32)b[1]<<16) + ((FLAC__uint32)b[2]<<8) + (FLAC__uint32)b[3];
|
||||
}
|
||||
|
||||
static FLAC__uint32 unpack32le_(const FLAC__byte *b)
|
||||
{
|
||||
return (FLAC__uint32)b[0] + ((FLAC__uint32)b[1]<<8) + ((FLAC__uint32)b[2]<<16) + ((FLAC__uint32)b[3]<<24);
|
||||
}
|
||||
|
||||
static FLAC__uint64 unpack64le_(const FLAC__byte *b)
|
||||
{
|
||||
return (FLAC__uint64)b[0] + ((FLAC__uint64)b[1]<<8) + ((FLAC__uint64)b[2]<<16) + ((FLAC__uint64)b[3]<<24) + ((FLAC__uint64)b[4]<<32) + ((FLAC__uint64)b[5]<<40) + ((FLAC__uint64)b[6]<<48) + ((FLAC__uint64)b[7]<<56);
|
||||
}
|
||||
|
||||
/* copies 'size' bytes from file 'fin' to 'fout', filling in *error with 'read_error' or 'write_error' as necessary */
|
||||
static FLAC__bool copy_data_(FILE *fin, FILE *fout, size_t size, const char **error, const char * const read_error, const char * const write_error)
|
||||
{
|
||||
FLAC__byte buffer[4096];
|
||||
size_t left;
|
||||
for(left = size; left > 0; ) {
|
||||
size_t need = min(sizeof(buffer), left);
|
||||
if(fread(buffer, 1, need, fin) < need) {
|
||||
if(error) *error = read_error;
|
||||
return false;
|
||||
}
|
||||
if(fwrite(buffer, 1, need, fout) < need) {
|
||||
if(error) *error = write_error;
|
||||
return false;
|
||||
}
|
||||
left -= need;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static FLAC__bool append_block_(foreign_metadata_t *fm, off_t offset, FLAC__uint32 size, const char **error)
|
||||
{
|
||||
foreign_block_t *fb = safe_realloc_muladd2_(fm->blocks, sizeof(foreign_block_t), /*times (*/fm->num_blocks, /*+*/1/*)*/);
|
||||
if(fb) {
|
||||
fb[fm->num_blocks].offset = offset;
|
||||
fb[fm->num_blocks].size = size;
|
||||
fm->num_blocks++;
|
||||
fm->blocks = fb;
|
||||
return true;
|
||||
}
|
||||
if(error) *error = "out of memory";
|
||||
return false;
|
||||
}
|
||||
|
||||
static FLAC__bool read_from_aiff_(foreign_metadata_t *fm, FILE *f, const char **error)
|
||||
{
|
||||
FLAC__byte buffer[12];
|
||||
off_t offset, eof_offset;
|
||||
if((offset = ftello(f)) < 0) {
|
||||
if(error) *error = "ftello() error (001)";
|
||||
return false;
|
||||
}
|
||||
if(fread(buffer, 1, 12, f) < 12 || memcmp(buffer, "FORM", 4) || (memcmp(buffer+8, "AIFF", 4) && memcmp(buffer+8, "AIFC", 4))) {
|
||||
if(error) *error = "unsupported FORM layout (002)";
|
||||
return false;
|
||||
}
|
||||
if(!append_block_(fm, offset, 12, error))
|
||||
return false;
|
||||
eof_offset = (off_t)8 + (off_t)unpack32be_(buffer+4);
|
||||
while(!feof(f)) {
|
||||
FLAC__uint32 size;
|
||||
if((offset = ftello(f)) < 0) {
|
||||
if(error) *error = "ftello() error (003)";
|
||||
return false;
|
||||
}
|
||||
if((size = fread(buffer, 1, 8, f)) < 8) {
|
||||
if(size == 0 && feof(f))
|
||||
break;
|
||||
if(error) *error = "invalid AIFF file (004)";
|
||||
return false;
|
||||
}
|
||||
size = unpack32be_(buffer+4);
|
||||
/* check if pad byte needed */
|
||||
if(size & 1)
|
||||
size++;
|
||||
if(!memcmp(buffer, "COMM", 4)) {
|
||||
if(fm->format_block) {
|
||||
if(error) *error = "invalid AIFF file: multiple \"COMM\" chunks (005)";
|
||||
return false;
|
||||
}
|
||||
if(fm->audio_block) {
|
||||
if(error) *error = "invalid AIFF file: \"SSND\" chunk before \"COMM\" chunk (006)";
|
||||
return false;
|
||||
}
|
||||
fm->format_block = fm->num_blocks;
|
||||
}
|
||||
else if(!memcmp(buffer, "SSND", 4)) {
|
||||
if(fm->audio_block) {
|
||||
if(error) *error = "invalid AIFF file: multiple \"SSND\" chunks (007)";
|
||||
return false;
|
||||
}
|
||||
if(!fm->format_block) {
|
||||
if(error) *error = "invalid AIFF file: \"SSND\" chunk before \"COMM\" chunk (008)";
|
||||
return false;
|
||||
}
|
||||
fm->audio_block = fm->num_blocks;
|
||||
/* read #offset bytes */
|
||||
if(fread(buffer+8, 1, 4, f) < 4) {
|
||||
if(error) *error = "invalid AIFF file (009)";
|
||||
return false;
|
||||
}
|
||||
fm->ssnd_offset_size = unpack32be_(buffer+8);
|
||||
if(fseeko(f, -4, SEEK_CUR) < 0) {
|
||||
if(error) *error = "invalid AIFF file: seek error (010)";
|
||||
return false;
|
||||
}
|
||||
/* WATCHOUT: For SSND we ignore the blockSize and are not saving any
|
||||
* unaligned part at the end of the chunk. In retrospect it is pretty
|
||||
* pointless to save the unaligned data before the PCM but now it is
|
||||
* done and cast in stone.
|
||||
*/
|
||||
}
|
||||
if(!append_block_(fm, offset, 8 + (memcmp(buffer, "SSND", 4)? size : 8 + fm->ssnd_offset_size), error))
|
||||
return false;
|
||||
/* skip to next chunk */
|
||||
if(fseeko(f, size, SEEK_CUR) < 0) {
|
||||
if(error) *error = "invalid AIFF file: seek error (011)";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(eof_offset != ftello(f)) {
|
||||
if(error) *error = "invalid AIFF file: unexpected EOF (012)";
|
||||
return false;
|
||||
}
|
||||
if(!fm->format_block) {
|
||||
if(error) *error = "invalid AIFF file: missing \"COMM\" chunk (013)";
|
||||
return false;
|
||||
}
|
||||
if(!fm->audio_block) {
|
||||
if(error) *error = "invalid AIFF file: missing \"SSND\" chunk (014)";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static FLAC__bool read_from_wave_(foreign_metadata_t *fm, FILE *f, const char **error)
|
||||
{
|
||||
FLAC__byte buffer[12];
|
||||
off_t offset, eof_offset = -1, ds64_data_size = -1;
|
||||
if((offset = ftello(f)) < 0) {
|
||||
if(error) *error = "ftello() error (001)";
|
||||
return false;
|
||||
}
|
||||
if(fread(buffer, 1, 12, f) < 12 || (memcmp(buffer, "RIFF", 4) && memcmp(buffer, "RF64", 4)) || memcmp(buffer+8, "WAVE", 4)) {
|
||||
if(error) *error = "unsupported RIFF layout (002)";
|
||||
return false;
|
||||
}
|
||||
if(!memcmp(buffer, "RF64", 4))
|
||||
fm->is_rf64 = true;
|
||||
if(fm->is_rf64 && sizeof(off_t) < 8) {
|
||||
if(error) *error = "RF64 is not supported on this compile (r00)";
|
||||
return false;
|
||||
}
|
||||
if(!append_block_(fm, offset, 12, error))
|
||||
return false;
|
||||
if(!fm->is_rf64 || unpack32le_(buffer+4) != 0xffffffffu)
|
||||
eof_offset = (off_t)8 + (off_t)unpack32le_(buffer+4);
|
||||
while(!feof(f)) {
|
||||
FLAC__uint32 size;
|
||||
if((offset = ftello(f)) < 0) {
|
||||
if(error) *error = "ftello() error (003)";
|
||||
return false;
|
||||
}
|
||||
if((size = fread(buffer, 1, 8, f)) < 8) {
|
||||
if(size == 0 && feof(f))
|
||||
break;
|
||||
if(error) *error = "invalid WAVE file (004)";
|
||||
return false;
|
||||
}
|
||||
size = unpack32le_(buffer+4);
|
||||
/* check if pad byte needed */
|
||||
if(size & 1)
|
||||
size++;
|
||||
if(!memcmp(buffer, "fmt ", 4)) {
|
||||
if(fm->format_block) {
|
||||
if(error) *error = "invalid WAVE file: multiple \"fmt \" chunks (005)";
|
||||
return false;
|
||||
}
|
||||
if(fm->audio_block) {
|
||||
if(error) *error = "invalid WAVE file: \"data\" chunk before \"fmt \" chunk (006)";
|
||||
return false;
|
||||
}
|
||||
fm->format_block = fm->num_blocks;
|
||||
}
|
||||
else if(!memcmp(buffer, "data", 4)) {
|
||||
if(fm->audio_block) {
|
||||
if(error) *error = "invalid WAVE file: multiple \"data\" chunks (007)";
|
||||
return false;
|
||||
}
|
||||
if(!fm->format_block) {
|
||||
if(error) *error = "invalid WAVE file: \"data\" chunk before \"fmt \" chunk (008)";
|
||||
return false;
|
||||
}
|
||||
fm->audio_block = fm->num_blocks;
|
||||
if(fm->is_rf64 && fm->num_blocks < 2) {
|
||||
if(error) *error = "invalid RF64 file: \"data\" chunk before \"ds64\" chunk (r01)";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(!append_block_(fm, offset, 8 + (memcmp(buffer, "data", 4)? size : 0), error))
|
||||
return false;
|
||||
/* parse ds64 chunk if necessary */
|
||||
if(fm->is_rf64 && fm->num_blocks == 2) {
|
||||
FLAC__byte buffer2[7*4];
|
||||
if(memcmp(buffer, "ds64", 4)) {
|
||||
if(error) *error = "invalid RF64 file: \"ds64\" chunk does not immediately follow \"WAVE\" marker (r02)";
|
||||
return false;
|
||||
}
|
||||
/* unpack the size again since we don't want the padding byte effect */
|
||||
size = unpack32le_(buffer+4);
|
||||
if(size < sizeof(buffer2)) {
|
||||
if(error) *error = "invalid RF64 file: \"ds64\" chunk size is < 28 (r03)";
|
||||
return false;
|
||||
}
|
||||
if(size > sizeof(buffer2)) {
|
||||
if(error) *error = "RF64 file has \"ds64\" chunk with extra size table, which is not currently supported (r04)";
|
||||
return false;
|
||||
}
|
||||
if(fread(buffer2, 1, sizeof(buffer2), f) < sizeof(buffer2)) {
|
||||
if(error) *error = "unexpected EOF reading \"ds64\" chunk data in RF64 file (r05)";
|
||||
return false;
|
||||
}
|
||||
ds64_data_size = (off_t)unpack64le_(buffer2+8);
|
||||
if(ds64_data_size == (off_t)(-1)) {
|
||||
if(error) *error = "RF64 file has \"ds64\" chunk with data size == -1 (r08)";
|
||||
return false;
|
||||
}
|
||||
/* check if pad byte needed */
|
||||
if(ds64_data_size & 1)
|
||||
ds64_data_size++;
|
||||
/* @@@ [2^63 limit] */
|
||||
if(ds64_data_size < 0) {
|
||||
if(error) *error = "RF64 file too large (r09)";
|
||||
return false;
|
||||
}
|
||||
if(unpack32le_(buffer2+24)) {
|
||||
if(error) *error = "RF64 file has \"ds64\" chunk with extra size table, which is not currently supported (r06)";
|
||||
return false;
|
||||
}
|
||||
eof_offset = (off_t)8 + (off_t)unpack64le_(buffer2);
|
||||
/* @@@ [2^63 limit] */
|
||||
if((off_t)unpack64le_(buffer2) < 0 || eof_offset < 0) {
|
||||
if(error) *error = "RF64 file too large (r07)";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else { /* skip to next chunk */
|
||||
if(fm->is_rf64 && !memcmp(buffer, "data", 4) && unpack32le_(buffer+4) == 0xffffffffu) {
|
||||
if(fseeko(f, ds64_data_size, SEEK_CUR) < 0) {
|
||||
if(error) *error = "invalid RF64 file: seek error (r10)";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(fseeko(f, size, SEEK_CUR) < 0) {
|
||||
if(error) *error = "invalid WAVE file: seek error (009)";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(fm->is_rf64 && eof_offset == (off_t)(-1)) {
|
||||
if(error) *error = "invalid RF64 file: all RIFF sizes are -1 (r11)";
|
||||
return false;
|
||||
}
|
||||
if(eof_offset != ftello(f)) {
|
||||
if(error) *error = "invalid WAVE file: unexpected EOF (010)";
|
||||
return false;
|
||||
}
|
||||
if(!fm->format_block) {
|
||||
if(error) *error = "invalid WAVE file: missing \"fmt \" chunk (011)";
|
||||
return false;
|
||||
}
|
||||
if(!fm->audio_block) {
|
||||
if(error) *error = "invalid WAVE file: missing \"data\" chunk (012)";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static FLAC__bool read_from_wave64_(foreign_metadata_t *fm, FILE *f, const char **error)
|
||||
{
|
||||
FLAC__byte buffer[40];
|
||||
off_t offset, eof_offset = -1;
|
||||
if((offset = ftello(f)) < 0) {
|
||||
if(error) *error = "ftello() error (001)";
|
||||
return false;
|
||||
}
|
||||
if(
|
||||
fread(buffer, 1, 40, f) < 40 ||
|
||||
/* RIFF GUID 66666972-912E-11CF-A5D6-28DB04C10000 */
|
||||
memcmp(buffer, "\x72\x69\x66\x66\x2E\x91\xCF\x11\xD6\xA5\x28\xDB\x04\xC1\x00\x00", 16) ||
|
||||
/* WAVE GUID 65766177-ACF3-11D3-8CD1-00C04F8EDB8A */
|
||||
memcmp(buffer+24, "\x77\x61\x76\x65\xF3\xAC\xD3\x11\xD1\x8C\x00\xC0\x4F\x8E\xDB\x8A", 16)
|
||||
) {
|
||||
if(error) *error = "unsupported Wave64 layout (002)";
|
||||
return false;
|
||||
}
|
||||
if(sizeof(off_t) < 8) {
|
||||
if(error) *error = "Wave64 is not supported on this compile (r00)";
|
||||
return false;
|
||||
}
|
||||
if(!append_block_(fm, offset, 40, error))
|
||||
return false;
|
||||
eof_offset = (off_t)unpack64le_(buffer+16); /*@@@ [2^63 limit] */
|
||||
while(!feof(f)) {
|
||||
FLAC__uint64 size;
|
||||
if((offset = ftello(f)) < 0) {
|
||||
if(error) *error = "ftello() error (003)";
|
||||
return false;
|
||||
}
|
||||
if((size = fread(buffer, 1, 24, f)) < 24) {
|
||||
if(size == 0 && feof(f))
|
||||
break;
|
||||
if(error) *error = "invalid Wave64 file (004)";
|
||||
return false;
|
||||
}
|
||||
size = unpack64le_(buffer+16);
|
||||
/* check if pad bytes needed */
|
||||
if(size & 7)
|
||||
size = (size+7) & (~((FLAC__uint64)7));
|
||||
/* fmt GUID 20746D66-ACF3-11D3-8CD1-00C04F8EDB8A */
|
||||
if(!memcmp(buffer, "\x66\x6D\x74\x20\xF3\xAC\xD3\x11\xD1\x8C\x00\xC0\x4F\x8E\xDB\x8A", 16)) {
|
||||
if(fm->format_block) {
|
||||
if(error) *error = "invalid Wave64 file: multiple \"fmt \" chunks (005)";
|
||||
return false;
|
||||
}
|
||||
if(fm->audio_block) {
|
||||
if(error) *error = "invalid Wave64 file: \"data\" chunk before \"fmt \" chunk (006)";
|
||||
return false;
|
||||
}
|
||||
fm->format_block = fm->num_blocks;
|
||||
}
|
||||
/* data GUID 61746164-ACF3-11D3-8CD1-00C04F8EDB8A */
|
||||
else if(!memcmp(buffer, "\x64\x61\x74\x61\xF3\xAC\xD3\x11\xD1\x8C\x00\xC0\x4F\x8E\xDB\x8A", 16)) {
|
||||
if(fm->audio_block) {
|
||||
if(error) *error = "invalid Wave64 file: multiple \"data\" chunks (007)";
|
||||
return false;
|
||||
}
|
||||
if(!fm->format_block) {
|
||||
if(error) *error = "invalid Wave64 file: \"data\" chunk before \"fmt \" chunk (008)";
|
||||
return false;
|
||||
}
|
||||
fm->audio_block = fm->num_blocks;
|
||||
}
|
||||
if(!append_block_(fm, offset, memcmp(buffer, "\x64\x61\x74\x61\xF3\xAC\xD3\x11\xD1\x8C\x00\xC0\x4F\x8E\xDB\x8A", 16)? (FLAC__uint32)size : 16+8, error))
|
||||
return false;
|
||||
/* skip to next chunk */
|
||||
if(fseeko(f, size-24, SEEK_CUR) < 0) {
|
||||
if(error) *error = "invalid Wave64 file: seek error (009)";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(eof_offset != ftello(f)) {
|
||||
if(error) *error = "invalid Wave64 file: unexpected EOF (010)";
|
||||
return false;
|
||||
}
|
||||
if(!fm->format_block) {
|
||||
if(error) *error = "invalid Wave64 file: missing \"fmt \" chunk (011)";
|
||||
return false;
|
||||
}
|
||||
if(!fm->audio_block) {
|
||||
if(error) *error = "invalid Wave64 file: missing \"data\" chunk (012)";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static FLAC__bool write_to_flac_(foreign_metadata_t *fm, FILE *fin, FILE *fout, FLAC__Metadata_SimpleIterator *it, const char **error)
|
||||
{
|
||||
FLAC__byte buffer[4];
|
||||
const unsigned ID_LEN = FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8;
|
||||
size_t block_num = 0;
|
||||
FLAC__ASSERT(sizeof(buffer) >= ID_LEN);
|
||||
while(block_num < fm->num_blocks) {
|
||||
/* find next matching padding block */
|
||||
do {
|
||||
/* even on the first chunk's loop there will be a skippable STREAMINFO block, on subsequent loops we are first moving past the PADDING we just used */
|
||||
if(!FLAC__metadata_simple_iterator_next(it)) {
|
||||
if(error) *error = "no matching PADDING block found (004)";
|
||||
return false;
|
||||
}
|
||||
} while(FLAC__metadata_simple_iterator_get_block_type(it) != FLAC__METADATA_TYPE_PADDING);
|
||||
if(FLAC__metadata_simple_iterator_get_block_length(it) != ID_LEN+fm->blocks[block_num].size) {
|
||||
if(error) *error = "PADDING block with wrong size found (005)";
|
||||
return false;
|
||||
}
|
||||
/* transfer chunk into APPLICATION block */
|
||||
/* first set up the file pointers */
|
||||
if(fseeko(fin, fm->blocks[block_num].offset, SEEK_SET) < 0) {
|
||||
if(error) *error = "seek failed in WAVE/AIFF file (006)";
|
||||
return false;
|
||||
}
|
||||
if(fseeko(fout, FLAC__metadata_simple_iterator_get_block_offset(it), SEEK_SET) < 0) {
|
||||
if(error) *error = "seek failed in FLAC file (007)";
|
||||
return false;
|
||||
}
|
||||
/* update the type */
|
||||
buffer[0] = FLAC__METADATA_TYPE_APPLICATION;
|
||||
if(FLAC__metadata_simple_iterator_is_last(it))
|
||||
buffer[0] |= 0x80; /*MAGIC number*/
|
||||
if(fwrite(buffer, 1, 1, fout) < 1) {
|
||||
if(error) *error = "write failed in FLAC file (008)";
|
||||
return false;
|
||||
}
|
||||
/* length stays the same so skip over it */
|
||||
if(fseeko(fout, FLAC__STREAM_METADATA_LENGTH_LEN/8, SEEK_CUR) < 0) {
|
||||
if(error) *error = "seek failed in FLAC file (009)";
|
||||
return false;
|
||||
}
|
||||
/* write the APPLICATION ID */
|
||||
memcpy(buffer, FLAC__FOREIGN_METADATA_APPLICATION_ID[fm->type], ID_LEN);
|
||||
if(fwrite(buffer, 1, ID_LEN, fout) < ID_LEN) {
|
||||
if(error) *error = "write failed in FLAC file (010)";
|
||||
return false;
|
||||
}
|
||||
/* transfer the foreign metadata */
|
||||
if(!copy_data_(fin, fout, fm->blocks[block_num].size, error, "read failed in WAVE/AIFF file (011)", "write failed in FLAC file (012)"))
|
||||
return false;
|
||||
block_num++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static FLAC__bool read_from_flac_(foreign_metadata_t *fm, FILE *f, FLAC__Metadata_SimpleIterator *it, const char **error)
|
||||
{
|
||||
FLAC__byte id[4], buffer[12];
|
||||
off_t offset;
|
||||
FLAC__bool type_found = false, ds64_found = false;
|
||||
|
||||
FLAC__ASSERT(FLAC__STREAM_METADATA_APPLICATION_ID_LEN == sizeof(id)*8);
|
||||
|
||||
while(FLAC__metadata_simple_iterator_next(it)) {
|
||||
if(FLAC__metadata_simple_iterator_get_block_type(it) != FLAC__METADATA_TYPE_APPLICATION)
|
||||
continue;
|
||||
if(!FLAC__metadata_simple_iterator_get_application_id(it, id)) {
|
||||
if(error) *error = "FLAC__metadata_simple_iterator_get_application_id() error (002)";
|
||||
return false;
|
||||
}
|
||||
if(memcmp(id, FLAC__FOREIGN_METADATA_APPLICATION_ID[fm->type], sizeof(id)))
|
||||
continue;
|
||||
offset = FLAC__metadata_simple_iterator_get_block_offset(it);
|
||||
/* skip over header and app ID */
|
||||
offset += (FLAC__STREAM_METADATA_IS_LAST_LEN + FLAC__STREAM_METADATA_TYPE_LEN + FLAC__STREAM_METADATA_LENGTH_LEN) / 8;
|
||||
offset += sizeof(id);
|
||||
/* look for format or audio blocks */
|
||||
if(fseek(f, offset, SEEK_SET) < 0) {
|
||||
if(error) *error = "seek error (003)";
|
||||
return false;
|
||||
}
|
||||
if(fread(buffer, 1, 4, f) != 4) {
|
||||
if(error) *error = "read error (004)";
|
||||
return false;
|
||||
}
|
||||
if(fm->num_blocks == 0) { /* first block? */
|
||||
fm->is_rf64 = 0 == memcmp(buffer, "RF64", 4);
|
||||
if(fm->type == FOREIGN_BLOCK_TYPE__RIFF && (0 == memcmp(buffer, "RIFF", 4) || fm->is_rf64))
|
||||
type_found = true;
|
||||
else if(fm->type == FOREIGN_BLOCK_TYPE__WAVE64 && 0 == memcmp(buffer, "riff", 4)) /* use first 4 bytes instead of whole GUID */
|
||||
type_found = true;
|
||||
else if(fm->type == FOREIGN_BLOCK_TYPE__AIFF && 0 == memcmp(buffer, "FORM", 4))
|
||||
type_found = true;
|
||||
else {
|
||||
if(error) *error = "unsupported foreign metadata found, may need newer FLAC decoder (005)";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if(!type_found) {
|
||||
FLAC__ASSERT(0);
|
||||
/* double protection: */
|
||||
if(error) *error = "unsupported foreign metadata found, may need newer FLAC decoder (006)";
|
||||
return false;
|
||||
}
|
||||
else if(fm->type == FOREIGN_BLOCK_TYPE__RIFF) {
|
||||
if(!memcmp(buffer, "fmt ", 4)) {
|
||||
if(fm->format_block) {
|
||||
if(error) *error = "invalid WAVE metadata: multiple \"fmt \" chunks (007)";
|
||||
return false;
|
||||
}
|
||||
if(fm->audio_block) {
|
||||
if(error) *error = "invalid WAVE metadata: \"data\" chunk before \"fmt \" chunk (008)";
|
||||
return false;
|
||||
}
|
||||
fm->format_block = fm->num_blocks;
|
||||
}
|
||||
else if(!memcmp(buffer, "data", 4)) {
|
||||
if(fm->audio_block) {
|
||||
if(error) *error = "invalid WAVE metadata: multiple \"data\" chunks (009)";
|
||||
return false;
|
||||
}
|
||||
if(!fm->format_block) {
|
||||
if(error) *error = "invalid WAVE metadata: \"data\" chunk before \"fmt \" chunk (010)";
|
||||
return false;
|
||||
}
|
||||
fm->audio_block = fm->num_blocks;
|
||||
}
|
||||
else if(fm->is_rf64 && fm->num_blocks == 1) {
|
||||
if(memcmp(buffer, "ds64", 4)) {
|
||||
if(error) *error = "invalid RF64 metadata: second chunk is not \"ds64\" (011)";
|
||||
return false;
|
||||
}
|
||||
ds64_found = true;
|
||||
}
|
||||
}
|
||||
else if(fm->type == FOREIGN_BLOCK_TYPE__WAVE64) {
|
||||
if(!memcmp(buffer, "fmt ", 4)) { /* use first 4 bytes instead of whole GUID */
|
||||
if(fm->format_block) {
|
||||
if(error) *error = "invalid Wave64 metadata: multiple \"fmt \" chunks (012)";
|
||||
return false;
|
||||
}
|
||||
if(fm->audio_block) {
|
||||
if(error) *error = "invalid Wave64 metadata: \"data\" chunk before \"fmt \" chunk (013)";
|
||||
return false;
|
||||
}
|
||||
fm->format_block = fm->num_blocks;
|
||||
}
|
||||
else if(!memcmp(buffer, "data", 4)) { /* use first 4 bytes instead of whole GUID */
|
||||
if(fm->audio_block) {
|
||||
if(error) *error = "invalid Wave64 metadata: multiple \"data\" chunks (014)";
|
||||
return false;
|
||||
}
|
||||
if(!fm->format_block) {
|
||||
if(error) *error = "invalid Wave64 metadata: \"data\" chunk before \"fmt \" chunk (015)";
|
||||
return false;
|
||||
}
|
||||
fm->audio_block = fm->num_blocks;
|
||||
}
|
||||
}
|
||||
else if(fm->type == FOREIGN_BLOCK_TYPE__AIFF) {
|
||||
if(!memcmp(buffer, "COMM", 4)) {
|
||||
if(fm->format_block) {
|
||||
if(error) *error = "invalid AIFF metadata: multiple \"COMM\" chunks (016)";
|
||||
return false;
|
||||
}
|
||||
if(fm->audio_block) {
|
||||
if(error) *error = "invalid AIFF metadata: \"SSND\" chunk before \"COMM\" chunk (017)";
|
||||
return false;
|
||||
}
|
||||
fm->format_block = fm->num_blocks;
|
||||
}
|
||||
else if(!memcmp(buffer, "SSND", 4)) {
|
||||
if(fm->audio_block) {
|
||||
if(error) *error = "invalid AIFF metadata: multiple \"SSND\" chunks (018)";
|
||||
return false;
|
||||
}
|
||||
if(!fm->format_block) {
|
||||
if(error) *error = "invalid AIFF metadata: \"SSND\" chunk before \"COMM\" chunk (019)";
|
||||
return false;
|
||||
}
|
||||
fm->audio_block = fm->num_blocks;
|
||||
/* read SSND offset size */
|
||||
if(fread(buffer+4, 1, 8, f) != 8) {
|
||||
if(error) *error = "read error (020)";
|
||||
return false;
|
||||
}
|
||||
fm->ssnd_offset_size = unpack32be_(buffer+8);
|
||||
}
|
||||
}
|
||||
else {
|
||||
FLAC__ASSERT(0);
|
||||
/* double protection: */
|
||||
if(error) *error = "unsupported foreign metadata found, may need newer FLAC decoder (021)";
|
||||
return false;
|
||||
}
|
||||
if(!append_block_(fm, offset, FLAC__metadata_simple_iterator_get_block_length(it)-sizeof(id), error))
|
||||
return false;
|
||||
}
|
||||
if(!type_found) {
|
||||
if(error) *error = "no foreign metadata found (022)";
|
||||
return false;
|
||||
}
|
||||
if(fm->is_rf64 && !ds64_found) {
|
||||
if(error) *error = "invalid RF64 file: second chunk is not \"ds64\" (023)";
|
||||
return false;
|
||||
}
|
||||
if(!fm->format_block) {
|
||||
if(error)
|
||||
*error =
|
||||
fm->type==FOREIGN_BLOCK_TYPE__RIFF? "invalid WAVE file: missing \"fmt \" chunk (024)" :
|
||||
fm->type==FOREIGN_BLOCK_TYPE__WAVE64? "invalid Wave64 file: missing \"fmt \" chunk (025)" :
|
||||
"invalid AIFF file: missing \"COMM\" chunk (026)";
|
||||
return false;
|
||||
}
|
||||
if(!fm->audio_block) {
|
||||
if(error)
|
||||
*error =
|
||||
fm->type==FOREIGN_BLOCK_TYPE__RIFF? "invalid WAVE file: missing \"data\" chunk (027)" :
|
||||
fm->type==FOREIGN_BLOCK_TYPE__WAVE64? "invalid Wave64 file: missing \"data\" chunk (028)" :
|
||||
"invalid AIFF file: missing \"SSND\" chunk (029)";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static FLAC__bool write_to_iff_(foreign_metadata_t *fm, FILE *fin, FILE *fout, off_t offset1, off_t offset2, off_t offset3, const char **error)
|
||||
{
|
||||
size_t i;
|
||||
if(fseeko(fout, offset1, SEEK_SET) < 0) {
|
||||
if(error) *error = "seek failed in WAVE/AIFF file (002)";
|
||||
return false;
|
||||
}
|
||||
/* don't write first (RIFF/RF64/FORM) chunk, or ds64 chunk in the case of RF64 */
|
||||
for(i = fm->is_rf64?2:1; i < fm->format_block; i++) {
|
||||
if(fseeko(fin, fm->blocks[i].offset, SEEK_SET) < 0) {
|
||||
if(error) *error = "seek failed in FLAC file (003)";
|
||||
return false;
|
||||
}
|
||||
if(!copy_data_(fin, fout, fm->blocks[i].size, error, "read failed in WAVE/AIFF file (004)", "write failed in FLAC file (005)"))
|
||||
return false;
|
||||
}
|
||||
if(fseeko(fout, offset2, SEEK_SET) < 0) {
|
||||
if(error) *error = "seek failed in WAVE/AIFF file (006)";
|
||||
return false;
|
||||
}
|
||||
for(i = fm->format_block+1; i < fm->audio_block; i++) {
|
||||
if(fseeko(fin, fm->blocks[i].offset, SEEK_SET) < 0) {
|
||||
if(error) *error = "seek failed in FLAC file (007)";
|
||||
return false;
|
||||
}
|
||||
if(!copy_data_(fin, fout, fm->blocks[i].size, error, "read failed in WAVE/AIFF file (008)", "write failed in FLAC file (009)"))
|
||||
return false;
|
||||
}
|
||||
if(fseeko(fout, offset3, SEEK_SET) < 0) {
|
||||
if(error) *error = "seek failed in WAVE/AIFF file (010)";
|
||||
return false;
|
||||
}
|
||||
for(i = fm->audio_block+1; i < fm->num_blocks; i++) {
|
||||
if(fseeko(fin, fm->blocks[i].offset, SEEK_SET) < 0) {
|
||||
if(error) *error = "seek failed in FLAC file (011)";
|
||||
return false;
|
||||
}
|
||||
if(!copy_data_(fin, fout, fm->blocks[i].size, error, "read failed in WAVE/AIFF file (012)", "write failed in FLAC file (013)"))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
foreign_metadata_t *flac__foreign_metadata_new(foreign_block_type_t type)
|
||||
{
|
||||
/* calloc() to zero all the member variables */
|
||||
foreign_metadata_t *x = (foreign_metadata_t*)calloc(sizeof(foreign_metadata_t), 1);
|
||||
if(x) {
|
||||
x->type = type;
|
||||
x->is_rf64 = false;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
void flac__foreign_metadata_delete(foreign_metadata_t *fm)
|
||||
{
|
||||
if(fm) {
|
||||
if(fm->blocks)
|
||||
free(fm->blocks);
|
||||
free(fm);
|
||||
}
|
||||
}
|
||||
|
||||
FLAC__bool flac__foreign_metadata_read_from_aiff(foreign_metadata_t *fm, const char *filename, const char **error)
|
||||
{
|
||||
FLAC__bool ok;
|
||||
FILE *f = fopen(filename, "rb");
|
||||
if(!f) {
|
||||
if(error) *error = "can't open AIFF file for reading (000)";
|
||||
return false;
|
||||
}
|
||||
ok = read_from_aiff_(fm, f, error);
|
||||
fclose(f);
|
||||
return ok;
|
||||
}
|
||||
|
||||
FLAC__bool flac__foreign_metadata_read_from_wave(foreign_metadata_t *fm, const char *filename, const char **error)
|
||||
{
|
||||
FLAC__bool ok;
|
||||
FILE *f = fopen(filename, "rb");
|
||||
if(!f) {
|
||||
if(error) *error = "can't open WAVE file for reading (000)";
|
||||
return false;
|
||||
}
|
||||
ok = read_from_wave_(fm, f, error);
|
||||
fclose(f);
|
||||
return ok;
|
||||
}
|
||||
|
||||
FLAC__bool flac__foreign_metadata_read_from_wave64(foreign_metadata_t *fm, const char *filename, const char **error)
|
||||
{
|
||||
FLAC__bool ok;
|
||||
FILE *f = fopen(filename, "rb");
|
||||
if(!f) {
|
||||
if(error) *error = "can't open Wave64 file for reading (000)";
|
||||
return false;
|
||||
}
|
||||
ok = read_from_wave64_(fm, f, error);
|
||||
fclose(f);
|
||||
return ok;
|
||||
}
|
||||
|
||||
FLAC__bool flac__foreign_metadata_write_to_flac(foreign_metadata_t *fm, const char *infilename, const char *outfilename, const char **error)
|
||||
{
|
||||
FLAC__bool ok;
|
||||
FILE *fin, *fout;
|
||||
FLAC__Metadata_SimpleIterator *it = FLAC__metadata_simple_iterator_new();
|
||||
if(!it) {
|
||||
if(error) *error = "out of memory (000)";
|
||||
return false;
|
||||
}
|
||||
if(!FLAC__metadata_simple_iterator_init(it, outfilename, /*read_only=*/true, /*preserve_file_stats=*/false)) {
|
||||
if(error) *error = "can't initialize iterator (001)";
|
||||
FLAC__metadata_simple_iterator_delete(it);
|
||||
return false;
|
||||
}
|
||||
if(0 == (fin = fopen(infilename, "rb"))) {
|
||||
if(error) *error = "can't open WAVE/AIFF file for reading (002)";
|
||||
FLAC__metadata_simple_iterator_delete(it);
|
||||
return false;
|
||||
}
|
||||
if(0 == (fout = fopen(outfilename, "r+b"))) {
|
||||
if(error) *error = "can't open FLAC file for updating (003)";
|
||||
FLAC__metadata_simple_iterator_delete(it);
|
||||
fclose(fin);
|
||||
return false;
|
||||
}
|
||||
ok = write_to_flac_(fm, fin, fout, it, error);
|
||||
FLAC__metadata_simple_iterator_delete(it);
|
||||
fclose(fin);
|
||||
fclose(fout);
|
||||
return ok;
|
||||
}
|
||||
|
||||
FLAC__bool flac__foreign_metadata_read_from_flac(foreign_metadata_t *fm, const char *filename, const char **error)
|
||||
{
|
||||
FLAC__bool ok;
|
||||
FILE *f;
|
||||
FLAC__Metadata_SimpleIterator *it = FLAC__metadata_simple_iterator_new();
|
||||
if(!it) {
|
||||
if(error) *error = "out of memory (000)";
|
||||
return false;
|
||||
}
|
||||
if(!FLAC__metadata_simple_iterator_init(it, filename, /*read_only=*/true, /*preserve_file_stats=*/false)) {
|
||||
if(error) *error = "can't initialize iterator (001)";
|
||||
FLAC__metadata_simple_iterator_delete(it);
|
||||
return false;
|
||||
}
|
||||
if(0 == (f = fopen(filename, "rb"))) {
|
||||
if(error) *error = "can't open FLAC file for reading (002)";
|
||||
FLAC__metadata_simple_iterator_delete(it);
|
||||
return false;
|
||||
}
|
||||
ok = read_from_flac_(fm, f, it, error);
|
||||
FLAC__metadata_simple_iterator_delete(it);
|
||||
fclose(f);
|
||||
return ok;
|
||||
}
|
||||
|
||||
FLAC__bool flac__foreign_metadata_write_to_iff(foreign_metadata_t *fm, const char *infilename, const char *outfilename, off_t offset1, off_t offset2, off_t offset3, const char **error)
|
||||
{
|
||||
FLAC__bool ok;
|
||||
FILE *fin, *fout;
|
||||
if(0 == (fin = fopen(infilename, "rb"))) {
|
||||
if(error) *error = "can't open FLAC file for reading (000)";
|
||||
return false;
|
||||
}
|
||||
if(0 == (fout = fopen(outfilename, "r+b"))) {
|
||||
if(error) *error = "can't open WAVE/AIFF file for updating (001)";
|
||||
fclose(fin);
|
||||
return false;
|
||||
}
|
||||
ok = write_to_iff_(fm, fin, fout, offset1, offset2, offset3, error);
|
||||
fclose(fin);
|
||||
fclose(fout);
|
||||
return ok;
|
||||
}
|
||||
72
flac/src/flac/foreign_metadata.h
Normal file
72
flac/src/flac/foreign_metadata.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/* flac - Command-line FLAC encoder/decoder
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef flac__foreign_metadata_h
|
||||
#define flac__foreign_metadata_h
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "FLAC/metadata.h"
|
||||
#include "utils.h"
|
||||
|
||||
/* WATCHOUT: these enums are used to index internal arrays */
|
||||
typedef enum {
|
||||
FOREIGN_BLOCK_TYPE__AIFF = 0, /* for AIFF and AIFF-C */
|
||||
FOREIGN_BLOCK_TYPE__RIFF = 1, /* for WAVE and RF64 */
|
||||
FOREIGN_BLOCK_TYPE__WAVE64 = 2 /* only for Sony's flavor */
|
||||
} foreign_block_type_t;
|
||||
|
||||
typedef struct {
|
||||
/* for encoding, this will be the offset in the WAVE/AIFF file of the chunk */
|
||||
/* for decoding, this will be the offset in the FLAC file of the chunk data inside the APPLICATION block */
|
||||
off_t offset;
|
||||
/* size is the actual size in bytes of the chunk to be stored/recreated. */
|
||||
/* It includes the 8 bytes of chunk type and size, and any padding byte for alignment. */
|
||||
/* For 'data'/'SSND' chunks, the size does not include the actual sound or padding bytes */
|
||||
/* because these are not stored, they are recreated from the compressed FLAC stream. */
|
||||
/* So for RIFF 'data', size is 8, and for AIFF 'SSND', size is 8 + 8 + ssnd_offset_size */
|
||||
/* 32 bit size is OK because we only care about the non-sound data and FLAC metadata */
|
||||
/* only supports a few megs anyway. */
|
||||
FLAC__uint32 size;
|
||||
} foreign_block_t;
|
||||
|
||||
typedef struct {
|
||||
foreign_block_type_t type; /* currently we don't support multiple foreign types in a stream (and maybe never will) */
|
||||
foreign_block_t *blocks;
|
||||
size_t num_blocks;
|
||||
size_t format_block; /* block number of 'fmt ' or 'COMM' chunk */
|
||||
size_t audio_block; /* block number of 'data' or 'SSND' chunk */
|
||||
FLAC__bool is_rf64; /* always false if type!=RIFF */
|
||||
FLAC__uint32 ssnd_offset_size; /* 0 if type!=AIFF */
|
||||
} foreign_metadata_t;
|
||||
|
||||
foreign_metadata_t *flac__foreign_metadata_new(foreign_block_type_t type);
|
||||
|
||||
void flac__foreign_metadata_delete(foreign_metadata_t *fm);
|
||||
|
||||
FLAC__bool flac__foreign_metadata_read_from_aiff(foreign_metadata_t *fm, const char *filename, const char **error);
|
||||
FLAC__bool flac__foreign_metadata_read_from_wave(foreign_metadata_t *fm, const char *filename, const char **error);
|
||||
FLAC__bool flac__foreign_metadata_read_from_wave64(foreign_metadata_t *fm, const char *filename, const char **error);
|
||||
FLAC__bool flac__foreign_metadata_write_to_flac(foreign_metadata_t *fm, const char *infilename, const char *outfilename, const char **error);
|
||||
|
||||
FLAC__bool flac__foreign_metadata_read_from_flac(foreign_metadata_t *fm, const char *filename, const char **error);
|
||||
FLAC__bool flac__foreign_metadata_write_to_iff(foreign_metadata_t *fm, const char *infilename, const char *outfilename, off_t offset1, off_t offset2, off_t offset3, const char **error);
|
||||
|
||||
#endif
|
||||
133
flac/src/flac/iffscan.c
Normal file
133
flac/src/flac/iffscan.c
Normal file
@@ -0,0 +1,133 @@
|
||||
/* iffscan - Simple AIFF/RIFF chunk scanner
|
||||
* Copyright (C) 2007,2008 Josh Coalson
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if defined _MSC_VER || defined __MINGW32__
|
||||
#include <sys/types.h> /* for off_t */
|
||||
#if _MSC_VER <= 1600 /* @@@ [2G limit] */
|
||||
#define fseeko fseek
|
||||
#define ftello ftell
|
||||
#endif
|
||||
#endif
|
||||
#include "foreign_metadata.h"
|
||||
|
||||
static FLAC__uint32 unpack32be_(const FLAC__byte *b)
|
||||
{
|
||||
return ((FLAC__uint32)b[0]<<24) + ((FLAC__uint32)b[1]<<16) + ((FLAC__uint32)b[2]<<8) + (FLAC__uint32)b[3];
|
||||
}
|
||||
|
||||
static FLAC__uint32 unpack32le_(const FLAC__byte *b)
|
||||
{
|
||||
return (FLAC__uint32)b[0] + ((FLAC__uint32)b[1]<<8) + ((FLAC__uint32)b[2]<<16) + ((FLAC__uint32)b[3]<<24);
|
||||
}
|
||||
|
||||
static FLAC__uint64 unpack64le_(const FLAC__byte *b)
|
||||
{
|
||||
return (FLAC__uint64)b[0] + ((FLAC__uint64)b[1]<<8) + ((FLAC__uint64)b[2]<<16) + ((FLAC__uint64)b[3]<<24) + ((FLAC__uint64)b[4]<<32) + ((FLAC__uint64)b[5]<<40) + ((FLAC__uint64)b[6]<<48) + ((FLAC__uint64)b[7]<<56);
|
||||
}
|
||||
|
||||
static FLAC__uint32 unpack32_(const FLAC__byte *b, foreign_block_type_t type)
|
||||
{
|
||||
if(type == FOREIGN_BLOCK_TYPE__AIFF)
|
||||
return unpack32be_(b);
|
||||
else
|
||||
return unpack32le_(b);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
FILE *f;
|
||||
char buf[36];
|
||||
foreign_metadata_t *fm;
|
||||
const char *fn, *error;
|
||||
size_t i;
|
||||
FLAC__uint32 size;
|
||||
|
||||
if(argc != 2) {
|
||||
fprintf(stderr, "usage: %s { file.wav | file.aif }\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
fn = argv[1];
|
||||
if(0 == (f = fopen(fn, "rb")) || fread(buf, 1, 4, f) != 4) {
|
||||
fprintf(stderr, "ERROR opening %s for reading\n", fn);
|
||||
return 1;
|
||||
}
|
||||
fclose(f);
|
||||
if(0 == (fm = flac__foreign_metadata_new(memcmp(buf, "RIFF", 4) && memcmp(buf, "RF64", 4)? FOREIGN_BLOCK_TYPE__AIFF : FOREIGN_BLOCK_TYPE__RIFF))) {
|
||||
fprintf(stderr, "ERROR: out of memory\n");
|
||||
return 1;
|
||||
}
|
||||
if(fm->type == FOREIGN_BLOCK_TYPE__AIFF) {
|
||||
if(!flac__foreign_metadata_read_from_aiff(fm, fn, &error)) {
|
||||
fprintf(stderr, "ERROR reading chunks from %s: %s\n", fn, error);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!flac__foreign_metadata_read_from_wave(fm, fn, &error)) {
|
||||
fprintf(stderr, "ERROR reading chunks from %s: %s\n", fn, error);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if(0 == (f = fopen(fn, "rb"))) {
|
||||
fprintf(stderr, "ERROR opening %s for reading\n", fn);
|
||||
return 1;
|
||||
}
|
||||
for(i = 0; i < fm->num_blocks; i++) {
|
||||
if(fseeko(f, fm->blocks[i].offset, SEEK_SET) < 0) {
|
||||
fprintf(stderr, "ERROR seeking in %s\n", fn);
|
||||
return 1;
|
||||
}
|
||||
if(fread(buf, 1, i==0?12:8, f) != (i==0?12:8)) {
|
||||
fprintf(stderr, "ERROR reading %s\n", fn);
|
||||
return 1;
|
||||
}
|
||||
size = unpack32_((const FLAC__byte*)buf+4, fm->type);
|
||||
printf("block:[%c%c%c%c] size=%08x=(%10u)", buf[0], buf[1], buf[2], buf[3], size, size);
|
||||
if(i == 0)
|
||||
printf(" type:[%c%c%c%c]", buf[8], buf[9], buf[10], buf[11]);
|
||||
else if(fm->type == FOREIGN_BLOCK_TYPE__AIFF && i == fm->audio_block)
|
||||
printf(" offset size=%08x=(%10u)", fm->ssnd_offset_size, fm->ssnd_offset_size);
|
||||
else if(fm->type == FOREIGN_BLOCK_TYPE__RIFF && i == 1 && !memcmp(buf, "ds64", 4)) {
|
||||
if(fread(buf+8, 1, 36-8, f) != 36-8) {
|
||||
fprintf(stderr, "ERROR reading %s\n", fn);
|
||||
return 1;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
printf(" RIFF size=%016I64x=(%I64u)", unpack64le_(buf+8), unpack64le_(buf+8));
|
||||
printf(" data size=%016I64x=(%I64u)", unpack64le_(buf+16), unpack64le_(buf+16));
|
||||
printf(" sample count=%016I64x=(%I64u)", unpack64le_(buf+24), unpack64le_(buf+24));
|
||||
#else
|
||||
printf(" RIFF size=%016llx=(%llu)", unpack64le_(buf+8), unpack64le_(buf+8));
|
||||
printf(" data size=%016llx=(%llu)", unpack64le_(buf+16), unpack64le_(buf+16));
|
||||
printf(" sample count=%016llx=(%llu)", unpack64le_(buf+24), unpack64le_(buf+24));
|
||||
#endif
|
||||
printf(" table size=%08x=(%u)", unpack32le_(buf+32), unpack32le_(buf+32));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
fclose(f);
|
||||
flac__foreign_metadata_delete(fm);
|
||||
return 0;
|
||||
}
|
||||
108
flac/src/flac/iffscan.dsp
Normal file
108
flac/src/flac/iffscan.dsp
Normal file
@@ -0,0 +1,108 @@
|
||||
# Microsoft Developer Studio Project File - Name="iffscan" - Package Owner=<4>
|
||||
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
|
||||
|
||||
CFG=iffscan - Win32 Debug
|
||||
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE NMAKE /f "iffscan.mak".
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE NMAKE /f "iffscan.mak" CFG="iffscan - Win32 Debug"
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE "iffscan - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
|
||||
!MESSAGE "iffscan - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
|
||||
!MESSAGE
|
||||
|
||||
|
||||
|
||||
# Begin Project
|
||||
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
|
||||
# PROP Scc_ProjName ""
|
||||
|
||||
# PROP Scc_LocalPath ""
|
||||
|
||||
CPP=cl.exe
|
||||
|
||||
RSC=rc.exe
|
||||
|
||||
|
||||
|
||||
!IF "$(CFG)" == "iffscan - Win32 Release"
|
||||
|
||||
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
|
||||
# PROP BASE Output_Dir "Release"
|
||||
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
|
||||
# PROP BASE Target_Dir ""
|
||||
|
||||
# PROP Use_MFC 0
|
||||
|
||||
# PROP Use_Debug_Libraries 0
|
||||
|
||||
# PROP Output_Dir "..\..\obj\release\bin"
|
||||
|
||||
# PROP Intermediate_Dir "Release"
|
||||
|
||||
# PROP Ignore_Export_Lib 0
|
||||
|
||||
# PROP Target_Dir ""
|
||||
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
||||
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\include" /D "NDEBUG" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
|
||||
BSC32=bscmake.exe
|
||||
|
||||
# ADD BASE BSC32 /nologo
|
||||
|
||||
# ADD BSC32 /nologo
|
||||
|
||||
LINK32=link.exe
|
||||
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
# ADD LINK32 ..\..\obj\release\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
380
flac/src/flac/iffscan.vcproj
Normal file
380
flac/src/flac/iffscan.vcproj
Normal file
@@ -0,0 +1,380 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="iffscan"
|
||||
ProjectGUID="{4cefbc94-c215-11db-8314-0800200c9a66}"
|
||||
RootNamespace="iffscan"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\..\obj\debug\bin"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib"
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="uuid.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\..\obj\release\bin"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories=".;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib"
|
||||
LinkIncremental="1"
|
||||
IgnoreDefaultLibraryNames="uuid.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
LinkTimeCodeGeneration="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib"
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="uuid.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories=".;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib"
|
||||
LinkIncremental="1"
|
||||
IgnoreDefaultLibraryNames="uuid.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
LinkTimeCodeGeneration="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-6E5FBE522BFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\foreign_metadata.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2D32A752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\foreign_metadata.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\iffscan.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
109
flac/src/flac/local_string_utils.c
Normal file
109
flac/src/flac/local_string_utils.c
Normal file
@@ -0,0 +1,109 @@
|
||||
/* flac - Command-line FLAC encoder/decoder
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "local_string_utils.h"
|
||||
|
||||
/* $OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $
|
||||
*
|
||||
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
*
|
||||
* Copy src to string dst of size siz. At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz == 0).
|
||||
* Returns strlen(src); if retval >= siz, truncation occurred.
|
||||
*/
|
||||
size_t
|
||||
flac__strlcpy(char *dst, const char *src, size_t siz)
|
||||
{
|
||||
register char *d = dst;
|
||||
register const char *s = src;
|
||||
register size_t n = siz;
|
||||
|
||||
/* Copy as many bytes as will fit */
|
||||
if (n != 0 && --n != 0) {
|
||||
do {
|
||||
if ((*d++ = *s++) == 0)
|
||||
break;
|
||||
} while (--n != 0);
|
||||
}
|
||||
|
||||
/* Not enough room in dst, add NUL and traverse rest of src */
|
||||
if (n == 0) {
|
||||
if (siz != 0)
|
||||
*d = '\0'; /* NUL-terminate dst */
|
||||
while (*s++)
|
||||
;
|
||||
}
|
||||
|
||||
return(s - src - 1); /* count does not include NUL */
|
||||
}
|
||||
|
||||
/* $OpenBSD: strlcat.c,v 1.11 2003/06/17 21:56:24 millert Exp $
|
||||
*
|
||||
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
*
|
||||
* Appends src to string dst of size siz (unlike strncat, siz is the
|
||||
* full size of dst, not space left). At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz <= strlen(dst)).
|
||||
* Returns strlen(src) + MIN(siz, strlen(initial dst)).
|
||||
* If retval >= siz, truncation occurred.
|
||||
*/
|
||||
size_t
|
||||
flac__strlcat(char *dst, const char *src, size_t siz)
|
||||
{
|
||||
register char *d = dst;
|
||||
register const char *s = src;
|
||||
register size_t n = siz;
|
||||
size_t dlen;
|
||||
|
||||
/* Find the end of dst and adjust bytes left but don't go past end */
|
||||
while (n-- != 0 && *d != '\0')
|
||||
d++;
|
||||
dlen = d - dst;
|
||||
n = siz - dlen;
|
||||
|
||||
if (n == 0)
|
||||
return(dlen + strlen(s));
|
||||
while (*s != '\0') {
|
||||
if (n != 1) {
|
||||
*d++ = *s;
|
||||
n--;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
*d = '\0';
|
||||
|
||||
return(dlen + (s - src)); /* count does not include NUL */
|
||||
}
|
||||
27
flac/src/flac/local_string_utils.h
Normal file
27
flac/src/flac/local_string_utils.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/* flac - Command-line FLAC encoder/decoder
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef flac__local_string_utils_h
|
||||
#define flac__local_string_utils_h
|
||||
|
||||
#include <stdlib.h> /* for size_t */
|
||||
|
||||
size_t flac__strlcpy(char *dst, const char *src, size_t siz);
|
||||
size_t flac__strlcat(char *dst, const char *src, size_t siz);
|
||||
|
||||
#endif
|
||||
2253
flac/src/flac/main.c
Normal file
2253
flac/src/flac/main.c
Normal file
File diff suppressed because it is too large
Load Diff
316
flac/src/flac/utils.c
Normal file
316
flac/src/flac/utils.c
Normal file
@@ -0,0 +1,316 @@
|
||||
/* flac - Command-line FLAC encoder/decoder
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "utils.h"
|
||||
#include "FLAC/assert.h"
|
||||
#include "FLAC/metadata.h"
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
const char *CHANNEL_MASK_TAG = "WAVEFORMATEXTENSIBLE_CHANNEL_MASK";
|
||||
|
||||
int flac__utils_verbosity_ = 2;
|
||||
|
||||
static FLAC__bool local__parse_uint64_(const char *s, FLAC__uint64 *value)
|
||||
{
|
||||
FLAC__uint64 ret = 0;
|
||||
char c;
|
||||
|
||||
if(*s == '\0')
|
||||
return false;
|
||||
|
||||
while('\0' != (c = *s++))
|
||||
if(c >= '0' && c <= '9')
|
||||
ret = ret * 10 + (c - '0');
|
||||
else
|
||||
return false;
|
||||
|
||||
*value = ret;
|
||||
return true;
|
||||
}
|
||||
|
||||
static FLAC__bool local__parse_timecode_(const char *s, double *value)
|
||||
{
|
||||
double ret;
|
||||
unsigned i;
|
||||
char c;
|
||||
|
||||
/* parse [0-9][0-9]*: */
|
||||
c = *s++;
|
||||
if(c >= '0' && c <= '9')
|
||||
i = (c - '0');
|
||||
else
|
||||
return false;
|
||||
while(':' != (c = *s++)) {
|
||||
if(c >= '0' && c <= '9')
|
||||
i = i * 10 + (c - '0');
|
||||
else
|
||||
return false;
|
||||
}
|
||||
ret = (double)i * 60.;
|
||||
|
||||
/* parse [0-9]*[.,]?[0-9]* i.e. a sign-less rational number (. or , OK for fractional seconds, to support different locales) */
|
||||
if(strspn(s, "1234567890.,") != strlen(s))
|
||||
return false;
|
||||
{
|
||||
const char *p = strpbrk(s, ".,");
|
||||
if(p && 0 != strpbrk(++p, ".,"))
|
||||
return false;
|
||||
}
|
||||
ret += atof(s);
|
||||
|
||||
*value = ret;
|
||||
return true;
|
||||
}
|
||||
|
||||
static FLAC__bool local__parse_cue_(const char *s, const char *end, unsigned *track, unsigned *index)
|
||||
{
|
||||
FLAC__bool got_track = false, got_index = false;
|
||||
unsigned t = 0, i = 0;
|
||||
char c;
|
||||
|
||||
while(end? s < end : *s != '\0') {
|
||||
c = *s++;
|
||||
if(c >= '0' && c <= '9') {
|
||||
t = t * 10 + (c - '0');
|
||||
got_track = true;
|
||||
}
|
||||
else if(c == '.')
|
||||
break;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
while(end? s < end : *s != '\0') {
|
||||
c = *s++;
|
||||
if(c >= '0' && c <= '9') {
|
||||
i = i * 10 + (c - '0');
|
||||
got_index = true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
*track = t;
|
||||
*index = i;
|
||||
return got_track && got_index;
|
||||
}
|
||||
|
||||
/*
|
||||
* this only works with sorted cuesheets (the spec strongly recommends but
|
||||
* does not require sorted cuesheets). but if it's not sorted, picking a
|
||||
* nearest cue point has no significance.
|
||||
*/
|
||||
static FLAC__uint64 local__find_closest_cue_(const FLAC__StreamMetadata_CueSheet *cuesheet, unsigned track, unsigned index, FLAC__uint64 total_samples, FLAC__bool look_forward)
|
||||
{
|
||||
int t, i;
|
||||
if(look_forward) {
|
||||
for(t = 0; t < (int)cuesheet->num_tracks; t++)
|
||||
for(i = 0; i < (int)cuesheet->tracks[t].num_indices; i++)
|
||||
if(cuesheet->tracks[t].number > track || (cuesheet->tracks[t].number == track && cuesheet->tracks[t].indices[i].number >= index))
|
||||
return cuesheet->tracks[t].offset + cuesheet->tracks[t].indices[i].offset;
|
||||
return total_samples;
|
||||
}
|
||||
else {
|
||||
for(t = (int)cuesheet->num_tracks - 1; t >= 0; t--)
|
||||
for(i = (int)cuesheet->tracks[t].num_indices - 1; i >= 0; i--)
|
||||
if(cuesheet->tracks[t].number < track || (cuesheet->tracks[t].number == track && cuesheet->tracks[t].indices[i].number <= index))
|
||||
return cuesheet->tracks[t].offset + cuesheet->tracks[t].indices[i].offset;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void flac__utils_printf(FILE *stream, int level, const char *format, ...)
|
||||
{
|
||||
if(flac__utils_verbosity_ >= level) {
|
||||
va_list args;
|
||||
|
||||
FLAC__ASSERT(0 != format);
|
||||
|
||||
va_start(args, format);
|
||||
|
||||
(void) vfprintf(stream, format, args);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FLAC__VALGRIND_TESTING
|
||||
size_t flac__utils_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
|
||||
{
|
||||
size_t ret = fwrite(ptr, size, nmemb, stream);
|
||||
if(!ferror(stream))
|
||||
fflush(stream);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
FLAC__bool flac__utils_parse_skip_until_specification(const char *s, utils__SkipUntilSpecification *spec)
|
||||
{
|
||||
FLAC__uint64 val;
|
||||
FLAC__bool is_negative = false;
|
||||
|
||||
FLAC__ASSERT(0 != spec);
|
||||
|
||||
spec->is_relative = false;
|
||||
spec->value_is_samples = true;
|
||||
spec->value.samples = 0;
|
||||
|
||||
if(0 != s) {
|
||||
if(s[0] == '-') {
|
||||
is_negative = true;
|
||||
spec->is_relative = true;
|
||||
s++;
|
||||
}
|
||||
else if(s[0] == '+') {
|
||||
spec->is_relative = true;
|
||||
s++;
|
||||
}
|
||||
|
||||
if(local__parse_uint64_(s, &val)) {
|
||||
spec->value_is_samples = true;
|
||||
spec->value.samples = (FLAC__int64)val;
|
||||
if(is_negative)
|
||||
spec->value.samples = -(spec->value.samples);
|
||||
}
|
||||
else {
|
||||
double d;
|
||||
if(!local__parse_timecode_(s, &d))
|
||||
return false;
|
||||
spec->value_is_samples = false;
|
||||
spec->value.seconds = d;
|
||||
if(is_negative)
|
||||
spec->value.seconds = -(spec->value.seconds);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void flac__utils_canonicalize_skip_until_specification(utils__SkipUntilSpecification *spec, unsigned sample_rate)
|
||||
{
|
||||
FLAC__ASSERT(0 != spec);
|
||||
if(!spec->value_is_samples) {
|
||||
spec->value.samples = (FLAC__int64)(spec->value.seconds * (double)sample_rate);
|
||||
spec->value_is_samples = true;
|
||||
}
|
||||
}
|
||||
|
||||
FLAC__bool flac__utils_parse_cue_specification(const char *s, utils__CueSpecification *spec)
|
||||
{
|
||||
const char *start = s, *end = 0;
|
||||
|
||||
FLAC__ASSERT(0 != spec);
|
||||
|
||||
spec->has_start_point = spec->has_end_point = false;
|
||||
|
||||
s = strchr(s, '-');
|
||||
|
||||
if(0 != s) {
|
||||
if(s == start)
|
||||
start = 0;
|
||||
end = s+1;
|
||||
if(*end == '\0')
|
||||
end = 0;
|
||||
}
|
||||
|
||||
if(start) {
|
||||
if(!local__parse_cue_(start, s, &spec->start_track, &spec->start_index))
|
||||
return false;
|
||||
spec->has_start_point = true;
|
||||
}
|
||||
|
||||
if(end) {
|
||||
if(!local__parse_cue_(end, 0, &spec->end_track, &spec->end_index))
|
||||
return false;
|
||||
spec->has_end_point = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void flac__utils_canonicalize_cue_specification(const utils__CueSpecification *cue_spec, const FLAC__StreamMetadata_CueSheet *cuesheet, FLAC__uint64 total_samples, utils__SkipUntilSpecification *skip_spec, utils__SkipUntilSpecification *until_spec)
|
||||
{
|
||||
FLAC__ASSERT(0 != cue_spec);
|
||||
FLAC__ASSERT(0 != cuesheet);
|
||||
FLAC__ASSERT(0 != total_samples);
|
||||
FLAC__ASSERT(0 != skip_spec);
|
||||
FLAC__ASSERT(0 != until_spec);
|
||||
|
||||
skip_spec->is_relative = false;
|
||||
skip_spec->value_is_samples = true;
|
||||
|
||||
until_spec->is_relative = false;
|
||||
until_spec->value_is_samples = true;
|
||||
|
||||
if(cue_spec->has_start_point)
|
||||
skip_spec->value.samples = local__find_closest_cue_(cuesheet, cue_spec->start_track, cue_spec->start_index, total_samples, /*look_forward=*/false);
|
||||
else
|
||||
skip_spec->value.samples = 0;
|
||||
|
||||
if(cue_spec->has_end_point)
|
||||
until_spec->value.samples = local__find_closest_cue_(cuesheet, cue_spec->end_track, cue_spec->end_index, total_samples, /*look_forward=*/true);
|
||||
else
|
||||
until_spec->value.samples = total_samples;
|
||||
}
|
||||
|
||||
FLAC__bool flac__utils_set_channel_mask_tag(FLAC__StreamMetadata *object, FLAC__uint32 channel_mask)
|
||||
{
|
||||
FLAC__StreamMetadata_VorbisComment_Entry entry = { 0, 0 };
|
||||
char tag[128];
|
||||
|
||||
FLAC__ASSERT(object);
|
||||
FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
|
||||
FLAC__ASSERT(strlen(CHANNEL_MASK_TAG+1+2+16+1) <= sizeof(tag)); /* +1 for =, +2 for 0x, +16 for digits, +1 for NUL */
|
||||
entry.entry = (FLAC__byte*)tag;
|
||||
#if defined _MSC_VER || defined __MINGW32__
|
||||
if((entry.length = _snprintf(tag, sizeof(tag), "%s=0x%04X", CHANNEL_MASK_TAG, (unsigned)channel_mask)) >= sizeof(tag))
|
||||
#else
|
||||
if((entry.length = snprintf(tag, sizeof(tag), "%s=0x%04X", CHANNEL_MASK_TAG, (unsigned)channel_mask)) >= sizeof(tag))
|
||||
#endif
|
||||
return false;
|
||||
if(!FLAC__metadata_object_vorbiscomment_replace_comment(object, entry, /*all=*/true, /*copy=*/true))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC__bool flac__utils_get_channel_mask_tag(const FLAC__StreamMetadata *object, FLAC__uint32 *channel_mask)
|
||||
{
|
||||
int offset;
|
||||
unsigned val;
|
||||
char *p;
|
||||
FLAC__ASSERT(object);
|
||||
FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
|
||||
if(0 > (offset = FLAC__metadata_object_vorbiscomment_find_entry_from(object, /*offset=*/0, CHANNEL_MASK_TAG)))
|
||||
return false;
|
||||
if(object->data.vorbis_comment.comments[offset].length < strlen(CHANNEL_MASK_TAG)+4)
|
||||
return false;
|
||||
if(0 == (p = strchr((const char *)object->data.vorbis_comment.comments[offset].entry, '='))) /* should never happen, but just in case */
|
||||
return false;
|
||||
if(strncmp(p, "=0x", 3))
|
||||
return false;
|
||||
if(sscanf(p+3, "%x", &val) != 1)
|
||||
return false;
|
||||
*channel_mask = val;
|
||||
return true;
|
||||
}
|
||||
65
flac/src/flac/utils.h
Normal file
65
flac/src/flac/utils.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/* flac - Command-line FLAC encoder/decoder
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef flac__utils_h
|
||||
#define flac__utils_h
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "FLAC/ordinals.h"
|
||||
#include "FLAC/format.h" /* for FLAC__StreamMetadata_CueSheet */
|
||||
#include <stdio.h> /* for FILE */
|
||||
|
||||
typedef enum { FORMAT_RAW, FORMAT_WAVE, FORMAT_WAVE64, FORMAT_RF64, FORMAT_AIFF, FORMAT_AIFF_C, FORMAT_FLAC, FORMAT_OGGFLAC } FileFormat;
|
||||
|
||||
typedef struct {
|
||||
FLAC__bool is_relative; /* i.e. specification string started with + or - */
|
||||
FLAC__bool value_is_samples;
|
||||
union {
|
||||
double seconds;
|
||||
FLAC__int64 samples;
|
||||
} value;
|
||||
} utils__SkipUntilSpecification;
|
||||
|
||||
typedef struct {
|
||||
FLAC__bool has_start_point, has_end_point;
|
||||
unsigned start_track, start_index;
|
||||
unsigned end_track, end_index;
|
||||
} utils__CueSpecification;
|
||||
|
||||
#ifdef FLAC__VALGRIND_TESTING
|
||||
size_t flac__utils_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
#else
|
||||
#define flac__utils_fwrite fwrite
|
||||
#endif
|
||||
|
||||
extern int flac__utils_verbosity_;
|
||||
void flac__utils_printf(FILE *stream, int level, const char *format, ...);
|
||||
|
||||
FLAC__bool flac__utils_parse_skip_until_specification(const char *s, utils__SkipUntilSpecification *spec);
|
||||
void flac__utils_canonicalize_skip_until_specification(utils__SkipUntilSpecification *spec, unsigned sample_rate);
|
||||
|
||||
FLAC__bool flac__utils_parse_cue_specification(const char *s, utils__CueSpecification *spec);
|
||||
void flac__utils_canonicalize_cue_specification(const utils__CueSpecification *cue_spec, const FLAC__StreamMetadata_CueSheet *cuesheet, FLAC__uint64 total_samples, utils__SkipUntilSpecification *skip_spec, utils__SkipUntilSpecification *until_spec);
|
||||
|
||||
FLAC__bool flac__utils_set_channel_mask_tag(FLAC__StreamMetadata *object, FLAC__uint32 channel_mask);
|
||||
FLAC__bool flac__utils_get_channel_mask_tag(const FLAC__StreamMetadata *object, FLAC__uint32 *channel_mask);
|
||||
|
||||
#endif
|
||||
248
flac/src/flac/vorbiscomment.c
Normal file
248
flac/src/flac/vorbiscomment.c
Normal file
@@ -0,0 +1,248 @@
|
||||
/* flac - Command-line FLAC encoder/decoder
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "vorbiscomment.h"
|
||||
#include "FLAC/assert.h"
|
||||
#include "FLAC/metadata.h"
|
||||
#include "share/grabbag.h" /* for grabbag__file_get_filesize() */
|
||||
#include "share/utf8.h"
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/*
|
||||
* This struct and the following 4 static functions are copied from
|
||||
* ../metaflac/. Maybe someday there will be a convenience
|
||||
* library for Vorbis comment parsing.
|
||||
*/
|
||||
typedef struct {
|
||||
char *field; /* the whole field as passed on the command line, i.e. "NAME=VALUE" */
|
||||
char *field_name;
|
||||
/* according to the vorbis spec, field values can contain \0 so simple C strings are not enough here */
|
||||
unsigned field_value_length;
|
||||
char *field_value;
|
||||
FLAC__bool field_value_from_file; /* true if field_value holds a filename for the value, false for plain value */
|
||||
} Argument_VcField;
|
||||
|
||||
static void die(const char *message)
|
||||
{
|
||||
FLAC__ASSERT(0 != message);
|
||||
fprintf(stderr, "ERROR: %s\n", message);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static char *local_strdup(const char *source)
|
||||
{
|
||||
char *ret;
|
||||
FLAC__ASSERT(0 != source);
|
||||
if(0 == (ret = strdup(source)))
|
||||
die("out of memory during strdup()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
static FLAC__bool parse_vorbis_comment_field(const char *field_ref, char **field, char **name, char **value, unsigned *length, const char **violation)
|
||||
{
|
||||
static const char * const violations[] = {
|
||||
"field name contains invalid character",
|
||||
"field contains no '=' character"
|
||||
};
|
||||
|
||||
char *p, *q, *s;
|
||||
|
||||
if(0 != field)
|
||||
*field = local_strdup(field_ref);
|
||||
|
||||
s = local_strdup(field_ref);
|
||||
|
||||
if(0 == (p = strchr(s, '='))) {
|
||||
free(s);
|
||||
*violation = violations[1];
|
||||
return false;
|
||||
}
|
||||
*p++ = '\0';
|
||||
|
||||
for(q = s; *q; q++) {
|
||||
if(*q < 0x20 || *q > 0x7d || *q == 0x3d) {
|
||||
free(s);
|
||||
*violation = violations[0];
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
*name = local_strdup(s);
|
||||
*value = local_strdup(p);
|
||||
*length = strlen(p);
|
||||
|
||||
free(s);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* slight modification: no 'filename' arg, and errors are passed back in 'violation' instead of printed to stderr */
|
||||
static FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcField *field, FLAC__bool *needs_write, FLAC__bool raw, const char **violation)
|
||||
{
|
||||
FLAC__StreamMetadata_VorbisComment_Entry entry;
|
||||
char *converted;
|
||||
|
||||
FLAC__ASSERT(0 != block);
|
||||
FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
|
||||
FLAC__ASSERT(0 != field);
|
||||
FLAC__ASSERT(0 != needs_write);
|
||||
|
||||
if(field->field_value_from_file) {
|
||||
/* read the file into 'data' */
|
||||
FILE *f = 0;
|
||||
char *data = 0;
|
||||
const off_t size = grabbag__file_get_filesize(field->field_value);
|
||||
if(size < 0) {
|
||||
*violation = "can't open file for tag value";
|
||||
return false;
|
||||
}
|
||||
if(size >= 0x100000) { /* magic arbitrary limit, actual format limit is near 16MB */
|
||||
*violation = "file for tag value is too large";
|
||||
return false;
|
||||
}
|
||||
if(0 == (data = malloc(size+1)))
|
||||
die("out of memory allocating tag value");
|
||||
data[size] = '\0';
|
||||
if(0 == (f = fopen(field->field_value, "rb")) || fread(data, 1, size, f) != (size_t)size) {
|
||||
free(data);
|
||||
if(f)
|
||||
fclose(f);
|
||||
*violation = "error while reading file for tag value";
|
||||
return false;
|
||||
}
|
||||
fclose(f);
|
||||
if(strlen(data) != (size_t)size) {
|
||||
free(data);
|
||||
*violation = "file for tag value has embedded NULs";
|
||||
return false;
|
||||
}
|
||||
|
||||
/* move 'data' into 'converted', converting to UTF-8 if necessary */
|
||||
if(raw) {
|
||||
converted = data;
|
||||
}
|
||||
else if(utf8_encode(data, &converted) >= 0) {
|
||||
free(data);
|
||||
}
|
||||
else {
|
||||
free(data);
|
||||
*violation = "error converting file contents to UTF-8 for tag value";
|
||||
return false;
|
||||
}
|
||||
|
||||
/* create and entry and append it */
|
||||
if(!FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, field->field_name, converted)) {
|
||||
free(converted);
|
||||
*violation = "file for tag value is not valid UTF-8";
|
||||
return false;
|
||||
}
|
||||
free(converted);
|
||||
if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/false)) {
|
||||
*violation = "memory allocation failure";
|
||||
return false;
|
||||
}
|
||||
|
||||
*needs_write = true;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
FLAC__bool needs_free = false;
|
||||
if(raw) {
|
||||
entry.entry = (FLAC__byte *)field->field;
|
||||
}
|
||||
else if(utf8_encode(field->field, &converted) >= 0) {
|
||||
entry.entry = (FLAC__byte *)converted;
|
||||
needs_free = true;
|
||||
}
|
||||
else {
|
||||
*violation = "error converting comment to UTF-8";
|
||||
return false;
|
||||
}
|
||||
entry.length = strlen((const char *)entry.entry);
|
||||
if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) {
|
||||
if(needs_free)
|
||||
free(converted);
|
||||
/*
|
||||
* our previous parsing has already established that the field
|
||||
* name is OK, so it must be the field value
|
||||
*/
|
||||
*violation = "tag value for is not valid UTF-8";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/true)) {
|
||||
if(needs_free)
|
||||
free(converted);
|
||||
*violation = "memory allocation failure";
|
||||
return false;
|
||||
}
|
||||
|
||||
*needs_write = true;
|
||||
if(needs_free)
|
||||
free(converted);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The rest of the code is novel
|
||||
*/
|
||||
|
||||
static void free_field(Argument_VcField *obj)
|
||||
{
|
||||
if(0 != obj->field)
|
||||
free(obj->field);
|
||||
if(0 != obj->field_name)
|
||||
free(obj->field_name);
|
||||
if(0 != obj->field_value)
|
||||
free(obj->field_value);
|
||||
}
|
||||
|
||||
FLAC__bool flac__vorbiscomment_add(FLAC__StreamMetadata *block, const char *comment, FLAC__bool value_from_file, FLAC__bool raw, const char **violation)
|
||||
{
|
||||
Argument_VcField parsed;
|
||||
FLAC__bool dummy;
|
||||
|
||||
FLAC__ASSERT(0 != block);
|
||||
FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
|
||||
FLAC__ASSERT(0 != comment);
|
||||
|
||||
memset(&parsed, 0, sizeof(parsed));
|
||||
|
||||
parsed.field_value_from_file = value_from_file;
|
||||
if(!parse_vorbis_comment_field(comment, &(parsed.field), &(parsed.field_name), &(parsed.field_value), &(parsed.field_value_length), violation)) {
|
||||
free_field(&parsed);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!set_vc_field(block, &parsed, &dummy, raw, violation)) {
|
||||
free_field(&parsed);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
free_field(&parsed);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
26
flac/src/flac/vorbiscomment.h
Normal file
26
flac/src/flac/vorbiscomment.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/* flac - Command-line FLAC encoder/decoder
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef flac__vorbiscomment_h
|
||||
#define flac__vorbiscomment_h
|
||||
|
||||
#include "FLAC/metadata.h"
|
||||
|
||||
FLAC__bool flac__vorbiscomment_add(FLAC__StreamMetadata *block, const char *comment, FLAC__bool value_from_file, FLAC__bool raw, const char **violation);
|
||||
|
||||
#endif
|
||||
55
flac/src/libFLAC++/Makefile.am
Normal file
55
flac/src/libFLAC++/Makefile.am
Normal file
@@ -0,0 +1,55 @@
|
||||
# libFLAC++ - Free Lossless Audio Codec library
|
||||
# Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# - Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# - Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
lib_LTLIBRARIES = libFLAC++.la
|
||||
|
||||
m4datadir = $(datadir)/aclocal
|
||||
m4data_DATA = libFLAC++.m4
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = flac++.pc
|
||||
|
||||
EXTRA_DIST = \
|
||||
Makefile.lite \
|
||||
flac++.pc.in \
|
||||
libFLAC++_dynamic.dsp \
|
||||
libFLAC++_dynamic.vcproj \
|
||||
libFLAC++_static.dsp \
|
||||
libFLAC++_static.vcproj \
|
||||
libFLAC++.m4
|
||||
|
||||
# see 'http://www.gnu.org/software/libtool/manual.html#Libtool-versioning' for numbering convention
|
||||
libFLAC___la_LDFLAGS = -version-info 8:0:2
|
||||
libFLAC___la_LIBADD = ../libFLAC/libFLAC.la
|
||||
|
||||
libFLAC___la_SOURCES = \
|
||||
metadata.cpp \
|
||||
stream_decoder.cpp \
|
||||
stream_encoder.cpp
|
||||
47
flac/src/libFLAC++/Makefile.lite
Normal file
47
flac/src/libFLAC++/Makefile.lite
Normal file
@@ -0,0 +1,47 @@
|
||||
# libFLAC++ - Free Lossless Audio Codec library
|
||||
# Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# - Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# - Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#
|
||||
# GNU makefile
|
||||
#
|
||||
|
||||
topdir = ../..
|
||||
|
||||
LIB_NAME = libFLAC++
|
||||
INCLUDES = -I$(topdir)/include
|
||||
|
||||
SRCS_CPP = \
|
||||
metadata.cpp \
|
||||
stream_decoder.cpp \
|
||||
stream_encoder.cpp
|
||||
|
||||
include $(topdir)/build/lib.mk
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
11
flac/src/libFLAC++/flac++.pc.in
Normal file
11
flac/src/libFLAC++/flac++.pc.in
Normal file
@@ -0,0 +1,11 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: FLAC++
|
||||
Description: Free Lossless Audio Codec Library (C++ API)
|
||||
Version: @VERSION@
|
||||
Requires: flac
|
||||
Libs: -L${libdir} -lFLAC++ -lm
|
||||
Cflags: -I${includedir}/FLAC++
|
||||
117
flac/src/libFLAC++/libFLAC++.m4
Normal file
117
flac/src/libFLAC++/libFLAC++.m4
Normal file
@@ -0,0 +1,117 @@
|
||||
# Configure paths for libFLAC++
|
||||
# "Inspired" by ogg.m4
|
||||
# Caller must first run AM_PATH_LIBFLAC
|
||||
|
||||
dnl AM_PATH_LIBFLACPP([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for libFLAC++, and define LIBFLACPP_CFLAGS, LIBFLACPP_LIBS, LIBFLACPP_LIBDIR
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_LIBFLACPP],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries
|
||||
dnl
|
||||
AC_ARG_WITH(libFLACPP,[ --with-libFLACPP=PFX Prefix where libFLAC++ is installed (optional)], libFLACPP_prefix="$withval", libFLACPP_prefix="")
|
||||
AC_ARG_WITH(libFLACPP-libraries,[ --with-libFLACPP-libraries=DIR Directory where libFLAC++ library is installed (optional)], libFLACPP_libraries="$withval", libFLACPP_libraries="")
|
||||
AC_ARG_WITH(libFLACPP-includes,[ --with-libFLACPP-includes=DIR Directory where libFLAC++ header files are installed (optional)], libFLACPP_includes="$withval", libFLACPP_includes="")
|
||||
AC_ARG_ENABLE(libFLACPPtest, [ --disable-libFLACPPtest Do not try to compile and run a test libFLAC++ program],, enable_libFLACPPtest=yes)
|
||||
|
||||
if test "x$libFLACPP_libraries" != "x" ; then
|
||||
LIBFLACPP_LIBDIR="$libFLACPP_libraries"
|
||||
elif test "x$libFLACPP_prefix" != "x" ; then
|
||||
LIBFLACPP_LIBDIR="$libFLACPP_prefix/lib"
|
||||
elif test "x$prefix" != "xNONE" ; then
|
||||
LIBFLACPP_LIBDIR="$libdir"
|
||||
fi
|
||||
|
||||
LIBFLACPP_LIBS="-L$LIBFLACPP_LIBDIR -lFLAC++ $LIBFLAC_LIBS"
|
||||
|
||||
if test "x$libFLACPP_includes" != "x" ; then
|
||||
LIBFLACPP_CFLAGS="-I$libFLACPP_includes"
|
||||
elif test "x$libFLACPP_prefix" != "x" ; then
|
||||
LIBFLACPP_CFLAGS="-I$libFLACPP_prefix/include"
|
||||
elif test "$prefix" != "xNONE"; then
|
||||
LIBFLACPP_CFLAGS=""
|
||||
fi
|
||||
|
||||
LIBFLACPP_CFLAGS="$LIBFLACPP_CFLAGS $LIBFLAC_CFLAGS"
|
||||
|
||||
AC_MSG_CHECKING(for libFLAC++)
|
||||
no_libFLACPP=""
|
||||
|
||||
|
||||
if test "x$enable_libFLACPPtest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
ac_save_LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
|
||||
CFLAGS="$CFLAGS $LIBFLACPP_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $LIBFLACPP_CFLAGS"
|
||||
LIBS="$LIBS $LIBFLACPP_LIBS"
|
||||
LD_LIBRARY_PATH="$LIBFLACPP_LIBDIR:$LIBFLAC_LIBDIR:$LD_LIBRARY_PATH"
|
||||
dnl
|
||||
dnl Now check if the installed libFLAC++ is sufficiently new.
|
||||
dnl
|
||||
rm -f conf.libFLAC++test
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <FLAC++/decoder.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
system("touch conf.libFLAC++test");
|
||||
return 0;
|
||||
}
|
||||
|
||||
],, no_libFLACPP=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
LD_LIBRARY_PATH="$ac_save_LD_LIBRARY_PATH"
|
||||
fi
|
||||
|
||||
if test "x$no_libFLACPP" = "x" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test -f conf.libFLAC++test ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run libFLAC++ test program, checking why..."
|
||||
CFLAGS="$CFLAGS $LIBFLACPP_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $LIBFLACPP_CFLAGS"
|
||||
LIBS="$LIBS $LIBFLACPP_LIBS"
|
||||
LD_LIBRARY_PATH="$LIBFLACPP_LIBDIR:$LIBFLAC_LIBDIR:$LD_LIBRARY_PATH"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include <FLAC++/decoder.h>
|
||||
], [ return 0; ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding libFLAC++ or finding the wrong"
|
||||
echo "*** version of libFLAC++. If it is not finding libFLAC++, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means libFLAC++ was incorrectly installed"
|
||||
echo "*** or that you have moved libFLAC++ since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the libFLAC++-config script: $LIBFLACPP_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
LD_LIBRARY_PATH="$ac_save_LD_LIBRARY_PATH"
|
||||
fi
|
||||
LIBFLACPP_CFLAGS=""
|
||||
LIBFLACPP_LIBDIR=""
|
||||
LIBFLACPP_LIBS=""
|
||||
ifelse([$2], , :, [$2])
|
||||
fi
|
||||
AC_SUBST(LIBFLACPP_CFLAGS)
|
||||
AC_SUBST(LIBFLACPP_LIBDIR)
|
||||
AC_SUBST(LIBFLACPP_LIBS)
|
||||
rm -f conf.libFLAC++test
|
||||
])
|
||||
139
flac/src/libFLAC++/libFLAC++_dynamic.dsp
Normal file
139
flac/src/libFLAC++/libFLAC++_dynamic.dsp
Normal file
@@ -0,0 +1,139 @@
|
||||
# Microsoft Developer Studio Project File - Name="libFLAC++_dynamic" - Package Owner=<4>
|
||||
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
|
||||
|
||||
CFG=libFLAC++_dynamic - Win32 Debug
|
||||
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE NMAKE /f "libFLAC++_dynamic.mak".
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE NMAKE /f "libFLAC++_dynamic.mak" CFG="libFLAC++_dynamic - Win32 Debug"
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE "libFLAC++_dynamic - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
|
||||
!MESSAGE "libFLAC++_dynamic - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
|
||||
!MESSAGE
|
||||
|
||||
|
||||
|
||||
# Begin Project
|
||||
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
|
||||
# PROP Scc_ProjName "libFLAC++"
|
||||
|
||||
# PROP Scc_LocalPath "..\.."
|
||||
|
||||
CPP=cl.exe
|
||||
|
||||
MTL=midl.exe
|
||||
|
||||
RSC=rc.exe
|
||||
|
||||
|
||||
|
||||
!IF "$(CFG)" == "libFLAC++_dynamic - Win32 Release"
|
||||
|
||||
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
|
||||
# PROP BASE Output_Dir "Release"
|
||||
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
|
||||
# PROP BASE Target_Dir ""
|
||||
|
||||
# PROP Use_MFC 0
|
||||
|
||||
# PROP Use_Debug_Libraries 0
|
||||
|
||||
# PROP Output_Dir "..\..\obj\release\lib"
|
||||
|
||||
# PROP Intermediate_Dir "Release_dynamic"
|
||||
|
||||
# PROP Ignore_Export_Lib 0
|
||||
|
||||
# PROP Target_Dir ""
|
||||
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".\include" /I "..\..\include" /D "NDEBUG" /D "FLACPP_API_EXPORTS" /D "_WINDOWS" /D "_WINDLL" /D "WIN32" /D "_USRDLL" /FR /FD /c
|
||||
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
|
||||
# ADD RSC /l 0x409 /d "NDEBUG" /d "_USRDLL"
|
||||
|
||||
BSC32=bscmake.exe
|
||||
|
||||
# ADD BASE BSC32 /nologo
|
||||
|
||||
# ADD BSC32 /nologo
|
||||
|
||||
LINK32=link.exe
|
||||
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
||||
|
||||
# ADD LINK32 ..\..\obj\release\lib\libFLAC.lib /nologo /subsystem:windows /dll /machine:I386 /out:"..\..\obj\release\bin/libFLAC++.dll"
|
||||
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "libFLAC++_dynamic - Win32 Debug"
|
||||
|
||||
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
|
||||
# PROP BASE Target_Dir ""
|
||||
|
||||
# PROP Use_MFC 0
|
||||
|
||||
# PROP Use_Debug_Libraries 1
|
||||
|
||||
# PROP Output_Dir "..\..\obj\debug\lib"
|
||||
|
||||
# PROP Intermediate_Dir "Debug_dynamic"
|
||||
|
||||
# PROP Ignore_Export_Lib 0
|
||||
|
||||
# PROP Target_Dir ""
|
||||
392
flac/src/libFLAC++/libFLAC++_dynamic.vcproj
Normal file
392
flac/src/libFLAC++/libFLAC++_dynamic.vcproj
Normal file
@@ -0,0 +1,392 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="libFLAC++_dynamic"
|
||||
ProjectGUID="{4cefbc85-c215-11db-8314-0800200c9a66}"
|
||||
RootNamespace="libFLAC++_dynamic"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\..\obj\debug\lib"
|
||||
IntermediateDirectory="Debug_dynamic"
|
||||
ConfigurationType="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FLACPP_API_EXPORTS;DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\..\obj\release\lib"
|
||||
IntermediateDirectory="Release_dynamic"
|
||||
ConfigurationType="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories=".\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLACPP_API_EXPORTS"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
LinkTimeCodeGeneration="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FLACPP_API_EXPORTS;DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories=".\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLACPP_API_EXPORTS"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
LinkTimeCodeGeneration="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\metadata.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stream_decoder.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stream_encoder.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Public Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC++\all.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC++\decoder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC++\encoder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC++\export.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC++\metadata.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
132
flac/src/libFLAC++/libFLAC++_static.dsp
Normal file
132
flac/src/libFLAC++/libFLAC++_static.dsp
Normal file
@@ -0,0 +1,132 @@
|
||||
# Microsoft Developer Studio Project File - Name="libFLAC++_static" - Package Owner=<4>
|
||||
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
|
||||
|
||||
CFG=libFLAC++_static - Win32 Debug
|
||||
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE NMAKE /f "libFLAC++_static.mak".
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE NMAKE /f "libFLAC++_static.mak" CFG="libFLAC++_static - Win32 Debug"
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE "libFLAC++_static - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
|
||||
!MESSAGE "libFLAC++_static - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
|
||||
!MESSAGE
|
||||
|
||||
|
||||
|
||||
# Begin Project
|
||||
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
|
||||
# PROP Scc_ProjName "libFLAC++"
|
||||
|
||||
# PROP Scc_LocalPath "..\.."
|
||||
|
||||
CPP=cl.exe
|
||||
|
||||
RSC=rc.exe
|
||||
|
||||
|
||||
|
||||
!IF "$(CFG)" == "libFLAC++_static - Win32 Release"
|
||||
|
||||
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
|
||||
# PROP BASE Output_Dir "Release"
|
||||
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
|
||||
# PROP BASE Target_Dir ""
|
||||
|
||||
# PROP Use_MFC 0
|
||||
|
||||
# PROP Use_Debug_Libraries 0
|
||||
|
||||
# PROP Output_Dir "..\..\obj\release\lib"
|
||||
|
||||
# PROP Intermediate_Dir "Release_static"
|
||||
|
||||
# PROP Target_Dir ""
|
||||
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".\include" /I "..\..\include" /D "FLAC__NO_DLL" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
|
||||
BSC32=bscmake.exe
|
||||
|
||||
# ADD BASE BSC32 /nologo
|
||||
|
||||
# ADD BSC32 /nologo
|
||||
|
||||
LIB32=link.exe -lib
|
||||
|
||||
# ADD BASE LIB32 /nologo
|
||||
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "libFLAC++_static - Win32 Debug"
|
||||
|
||||
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
|
||||
# PROP BASE Target_Dir ""
|
||||
|
||||
# PROP Use_MFC 0
|
||||
|
||||
# PROP Use_Debug_Libraries 1
|
||||
|
||||
# PROP Output_Dir "..\..\obj\debug\lib"
|
||||
|
||||
# PROP Intermediate_Dir "Debug_static"
|
||||
|
||||
# PROP Target_Dir ""
|
||||
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
|
||||
338
flac/src/libFLAC++/libFLAC++_static.vcproj
Normal file
338
flac/src/libFLAC++/libFLAC++_static.vcproj
Normal file
@@ -0,0 +1,338 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="libFLAC++_static"
|
||||
ProjectGUID="{4cefbc86-c215-11db-8314-0800200c9a66}"
|
||||
RootNamespace="libFLAC++_static"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\..\obj\debug\lib"
|
||||
IntermediateDirectory="Debug_static"
|
||||
ConfigurationType="4"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\obj\debug\lib\$(ProjectName).lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\..\obj\release\lib"
|
||||
IntermediateDirectory="Release_static"
|
||||
ConfigurationType="4"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories=".\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__NO_DLL"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\obj\release\lib\$(ProjectName).lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\obj\debug\lib\$(ProjectName).lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories=".\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__NO_DLL"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="..\..\obj\release\lib\$(ProjectName).lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\metadata.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stream_decoder.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stream_encoder.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Public Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC++\all.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC++\decoder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC++\encoder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC++\export.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC++\metadata.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
1589
flac/src/libFLAC++/metadata.cpp
Normal file
1589
flac/src/libFLAC++/metadata.cpp
Normal file
File diff suppressed because it is too large
Load Diff
389
flac/src/libFLAC++/stream_decoder.cpp
Normal file
389
flac/src/libFLAC++/stream_decoder.cpp
Normal file
@@ -0,0 +1,389 @@
|
||||
/* libFLAC++ - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "FLAC++/decoder.h"
|
||||
#include "FLAC/assert.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning)
|
||||
#pragma warning ( disable : 4800 )
|
||||
#endif
|
||||
|
||||
namespace FLAC {
|
||||
namespace Decoder {
|
||||
|
||||
// ------------------------------------------------------------
|
||||
//
|
||||
// Stream
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
Stream::Stream():
|
||||
decoder_(::FLAC__stream_decoder_new())
|
||||
{ }
|
||||
|
||||
Stream::~Stream()
|
||||
{
|
||||
if(0 != decoder_) {
|
||||
(void)::FLAC__stream_decoder_finish(decoder_);
|
||||
::FLAC__stream_decoder_delete(decoder_);
|
||||
}
|
||||
}
|
||||
|
||||
bool Stream::is_valid() const
|
||||
{
|
||||
return 0 != decoder_;
|
||||
}
|
||||
|
||||
bool Stream::set_ogg_serial_number(long value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_set_ogg_serial_number(decoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_md5_checking(bool value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_set_md5_checking(decoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_metadata_respond(::FLAC__MetadataType type)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_set_metadata_respond(decoder_, type);
|
||||
}
|
||||
|
||||
bool Stream::set_metadata_respond_application(const FLAC__byte id[4])
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_set_metadata_respond_application(decoder_, id);
|
||||
}
|
||||
|
||||
bool Stream::set_metadata_respond_all()
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_set_metadata_respond_all(decoder_);
|
||||
}
|
||||
|
||||
bool Stream::set_metadata_ignore(::FLAC__MetadataType type)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_set_metadata_ignore(decoder_, type);
|
||||
}
|
||||
|
||||
bool Stream::set_metadata_ignore_application(const FLAC__byte id[4])
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_set_metadata_ignore_application(decoder_, id);
|
||||
}
|
||||
|
||||
bool Stream::set_metadata_ignore_all()
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_set_metadata_ignore_all(decoder_);
|
||||
}
|
||||
|
||||
Stream::State Stream::get_state() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return State(::FLAC__stream_decoder_get_state(decoder_));
|
||||
}
|
||||
|
||||
bool Stream::get_md5_checking() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_get_md5_checking(decoder_);
|
||||
}
|
||||
|
||||
FLAC__uint64 Stream::get_total_samples() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_decoder_get_total_samples(decoder_);
|
||||
}
|
||||
|
||||
unsigned Stream::get_channels() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_decoder_get_channels(decoder_);
|
||||
}
|
||||
|
||||
::FLAC__ChannelAssignment Stream::get_channel_assignment() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_decoder_get_channel_assignment(decoder_);
|
||||
}
|
||||
|
||||
unsigned Stream::get_bits_per_sample() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_decoder_get_bits_per_sample(decoder_);
|
||||
}
|
||||
|
||||
unsigned Stream::get_sample_rate() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_decoder_get_sample_rate(decoder_);
|
||||
}
|
||||
|
||||
unsigned Stream::get_blocksize() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_decoder_get_blocksize(decoder_);
|
||||
}
|
||||
|
||||
bool Stream::get_decode_position(FLAC__uint64 *position) const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_decoder_get_decode_position(decoder_, position);
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderInitStatus Stream::init()
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_decoder_init_stream(decoder_, read_callback_, seek_callback_, tell_callback_, length_callback_, eof_callback_, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this);
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderInitStatus Stream::init_ogg()
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_decoder_init_ogg_stream(decoder_, read_callback_, seek_callback_, tell_callback_, length_callback_, eof_callback_, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this);
|
||||
}
|
||||
|
||||
bool Stream::finish()
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_finish(decoder_);
|
||||
}
|
||||
|
||||
bool Stream::flush()
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_flush(decoder_);
|
||||
}
|
||||
|
||||
bool Stream::reset()
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_reset(decoder_);
|
||||
}
|
||||
|
||||
bool Stream::process_single()
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_process_single(decoder_);
|
||||
}
|
||||
|
||||
bool Stream::process_until_end_of_metadata()
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_process_until_end_of_metadata(decoder_);
|
||||
}
|
||||
|
||||
bool Stream::process_until_end_of_stream()
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_process_until_end_of_stream(decoder_);
|
||||
}
|
||||
|
||||
bool Stream::skip_single_frame()
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_skip_single_frame(decoder_);
|
||||
}
|
||||
|
||||
bool Stream::seek_absolute(FLAC__uint64 sample)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_decoder_seek_absolute(decoder_, sample);
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderSeekStatus Stream::seek_callback(FLAC__uint64 absolute_byte_offset)
|
||||
{
|
||||
(void)absolute_byte_offset;
|
||||
return ::FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderTellStatus Stream::tell_callback(FLAC__uint64 *absolute_byte_offset)
|
||||
{
|
||||
(void)absolute_byte_offset;
|
||||
return ::FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderLengthStatus Stream::length_callback(FLAC__uint64 *stream_length)
|
||||
{
|
||||
(void)stream_length;
|
||||
return ::FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
bool Stream::eof_callback()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void Stream::metadata_callback(const ::FLAC__StreamMetadata *metadata)
|
||||
{
|
||||
(void)metadata;
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderReadStatus Stream::read_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
|
||||
{
|
||||
(void)decoder;
|
||||
FLAC__ASSERT(0 != client_data);
|
||||
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
||||
FLAC__ASSERT(0 != instance);
|
||||
return instance->read_callback(buffer, bytes);
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderSeekStatus Stream::seek_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data)
|
||||
{
|
||||
(void) decoder;
|
||||
FLAC__ASSERT(0 != client_data);
|
||||
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
||||
FLAC__ASSERT(0 != instance);
|
||||
return instance->seek_callback(absolute_byte_offset);
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderTellStatus Stream::tell_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
|
||||
{
|
||||
(void) decoder;
|
||||
FLAC__ASSERT(0 != client_data);
|
||||
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
||||
FLAC__ASSERT(0 != instance);
|
||||
return instance->tell_callback(absolute_byte_offset);
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderLengthStatus Stream::length_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data)
|
||||
{
|
||||
(void) decoder;
|
||||
FLAC__ASSERT(0 != client_data);
|
||||
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
||||
FLAC__ASSERT(0 != instance);
|
||||
return instance->length_callback(stream_length);
|
||||
}
|
||||
|
||||
FLAC__bool Stream::eof_callback_(const ::FLAC__StreamDecoder *decoder, void *client_data)
|
||||
{
|
||||
(void) decoder;
|
||||
FLAC__ASSERT(0 != client_data);
|
||||
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
||||
FLAC__ASSERT(0 != instance);
|
||||
return instance->eof_callback();
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderWriteStatus Stream::write_callback_(const ::FLAC__StreamDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
|
||||
{
|
||||
(void)decoder;
|
||||
FLAC__ASSERT(0 != client_data);
|
||||
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
||||
FLAC__ASSERT(0 != instance);
|
||||
return instance->write_callback(frame, buffer);
|
||||
}
|
||||
|
||||
void Stream::metadata_callback_(const ::FLAC__StreamDecoder *decoder, const ::FLAC__StreamMetadata *metadata, void *client_data)
|
||||
{
|
||||
(void)decoder;
|
||||
FLAC__ASSERT(0 != client_data);
|
||||
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
||||
FLAC__ASSERT(0 != instance);
|
||||
instance->metadata_callback(metadata);
|
||||
}
|
||||
|
||||
void Stream::error_callback_(const ::FLAC__StreamDecoder *decoder, ::FLAC__StreamDecoderErrorStatus status, void *client_data)
|
||||
{
|
||||
(void)decoder;
|
||||
FLAC__ASSERT(0 != client_data);
|
||||
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
||||
FLAC__ASSERT(0 != instance);
|
||||
instance->error_callback(status);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
//
|
||||
// File
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
File::File():
|
||||
Stream()
|
||||
{ }
|
||||
|
||||
File::~File()
|
||||
{
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderInitStatus File::init(FILE *file)
|
||||
{
|
||||
FLAC__ASSERT(0 != decoder_);
|
||||
return ::FLAC__stream_decoder_init_FILE(decoder_, file, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this);
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderInitStatus File::init(const char *filename)
|
||||
{
|
||||
FLAC__ASSERT(0 != decoder_);
|
||||
return ::FLAC__stream_decoder_init_file(decoder_, filename, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this);
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderInitStatus File::init(const std::string &filename)
|
||||
{
|
||||
return init(filename.c_str());
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderInitStatus File::init_ogg(FILE *file)
|
||||
{
|
||||
FLAC__ASSERT(0 != decoder_);
|
||||
return ::FLAC__stream_decoder_init_ogg_FILE(decoder_, file, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this);
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderInitStatus File::init_ogg(const char *filename)
|
||||
{
|
||||
FLAC__ASSERT(0 != decoder_);
|
||||
return ::FLAC__stream_decoder_init_ogg_file(decoder_, filename, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this);
|
||||
}
|
||||
|
||||
::FLAC__StreamDecoderInitStatus File::init_ogg(const std::string &filename)
|
||||
{
|
||||
return init_ogg(filename.c_str());
|
||||
}
|
||||
|
||||
// This is a dummy to satisfy the pure virtual from Stream; the
|
||||
// read callback will never be called since we are initializing
|
||||
// with FLAC__stream_decoder_init_FILE() or
|
||||
// FLAC__stream_decoder_init_file() and those supply the read
|
||||
// callback internally.
|
||||
::FLAC__StreamDecoderReadStatus File::read_callback(FLAC__byte buffer[], size_t *bytes)
|
||||
{
|
||||
(void)buffer, (void)bytes;
|
||||
FLAC__ASSERT(false);
|
||||
return ::FLAC__STREAM_DECODER_READ_STATUS_ABORT; // double protection
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
511
flac/src/libFLAC++/stream_encoder.cpp
Normal file
511
flac/src/libFLAC++/stream_encoder.cpp
Normal file
@@ -0,0 +1,511 @@
|
||||
/* libFLAC++ - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "FLAC++/encoder.h"
|
||||
#include "FLAC++/metadata.h"
|
||||
#include "FLAC/assert.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning)
|
||||
#pragma warning ( disable : 4800 )
|
||||
#endif
|
||||
|
||||
namespace FLAC {
|
||||
namespace Encoder {
|
||||
|
||||
// ------------------------------------------------------------
|
||||
//
|
||||
// Stream
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
Stream::Stream():
|
||||
encoder_(::FLAC__stream_encoder_new())
|
||||
{ }
|
||||
|
||||
Stream::~Stream()
|
||||
{
|
||||
if(0 != encoder_) {
|
||||
(void)::FLAC__stream_encoder_finish(encoder_);
|
||||
::FLAC__stream_encoder_delete(encoder_);
|
||||
}
|
||||
}
|
||||
|
||||
bool Stream::is_valid() const
|
||||
{
|
||||
return 0 != encoder_;
|
||||
}
|
||||
|
||||
bool Stream::set_ogg_serial_number(long value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_ogg_serial_number(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_verify(bool value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_verify(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_streamable_subset(bool value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_streamable_subset(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_channels(unsigned value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_channels(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_bits_per_sample(unsigned value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_bits_per_sample(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_sample_rate(unsigned value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_sample_rate(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_compression_level(unsigned value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_compression_level(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_blocksize(unsigned value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_blocksize(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_do_mid_side_stereo(bool value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_do_mid_side_stereo(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_loose_mid_side_stereo(bool value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_loose_mid_side_stereo(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_apodization(const char *specification)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_apodization(encoder_, specification);
|
||||
}
|
||||
|
||||
bool Stream::set_max_lpc_order(unsigned value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_max_lpc_order(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_qlp_coeff_precision(unsigned value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_qlp_coeff_precision(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_do_qlp_coeff_prec_search(bool value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_do_qlp_coeff_prec_search(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_do_escape_coding(bool value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_do_escape_coding(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_do_exhaustive_model_search(bool value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_do_exhaustive_model_search(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_min_residual_partition_order(unsigned value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_min_residual_partition_order(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_max_residual_partition_order(unsigned value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_max_residual_partition_order(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_rice_parameter_search_dist(unsigned value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_rice_parameter_search_dist(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_total_samples_estimate(FLAC__uint64 value)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_total_samples_estimate(encoder_, value);
|
||||
}
|
||||
|
||||
bool Stream::set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_set_metadata(encoder_, metadata, num_blocks);
|
||||
}
|
||||
|
||||
bool Stream::set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
#if (defined _MSC_VER) || (defined __BORLANDC__) || (defined __SUNPRO_CC)
|
||||
// MSVC++ can't handle:
|
||||
// ::FLAC__StreamMetadata *m[num_blocks];
|
||||
// so we do this ugly workaround
|
||||
::FLAC__StreamMetadata **m = new ::FLAC__StreamMetadata*[num_blocks];
|
||||
#else
|
||||
::FLAC__StreamMetadata *m[num_blocks];
|
||||
#endif
|
||||
for(unsigned i = 0; i < num_blocks; i++) {
|
||||
// we can get away with the const_cast since we know the encoder will only correct the is_last flags
|
||||
m[i] = const_cast< ::FLAC__StreamMetadata*>((const ::FLAC__StreamMetadata*)metadata[i]);
|
||||
}
|
||||
#if (defined _MSC_VER) || (defined __BORLANDC__) || (defined __SUNPRO_CC)
|
||||
// complete the hack
|
||||
const bool ok = (bool)::FLAC__stream_encoder_set_metadata(encoder_, m, num_blocks);
|
||||
delete [] m;
|
||||
return ok;
|
||||
#else
|
||||
return (bool)::FLAC__stream_encoder_set_metadata(encoder_, m, num_blocks);
|
||||
#endif
|
||||
}
|
||||
|
||||
Stream::State Stream::get_state() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return State(::FLAC__stream_encoder_get_state(encoder_));
|
||||
}
|
||||
|
||||
Decoder::Stream::State Stream::get_verify_decoder_state() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return Decoder::Stream::State(::FLAC__stream_encoder_get_verify_decoder_state(encoder_));
|
||||
}
|
||||
|
||||
void Stream::get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
::FLAC__stream_encoder_get_verify_decoder_error_stats(encoder_, absolute_sample, frame_number, channel, sample, expected, got);
|
||||
}
|
||||
|
||||
bool Stream::get_verify() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_get_verify(encoder_);
|
||||
}
|
||||
|
||||
bool Stream::get_streamable_subset() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_get_streamable_subset(encoder_);
|
||||
}
|
||||
|
||||
bool Stream::get_do_mid_side_stereo() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_get_do_mid_side_stereo(encoder_);
|
||||
}
|
||||
|
||||
bool Stream::get_loose_mid_side_stereo() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_get_loose_mid_side_stereo(encoder_);
|
||||
}
|
||||
|
||||
unsigned Stream::get_channels() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_encoder_get_channels(encoder_);
|
||||
}
|
||||
|
||||
unsigned Stream::get_bits_per_sample() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_encoder_get_bits_per_sample(encoder_);
|
||||
}
|
||||
|
||||
unsigned Stream::get_sample_rate() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_encoder_get_sample_rate(encoder_);
|
||||
}
|
||||
|
||||
unsigned Stream::get_blocksize() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_encoder_get_blocksize(encoder_);
|
||||
}
|
||||
|
||||
unsigned Stream::get_max_lpc_order() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_encoder_get_max_lpc_order(encoder_);
|
||||
}
|
||||
|
||||
unsigned Stream::get_qlp_coeff_precision() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_encoder_get_qlp_coeff_precision(encoder_);
|
||||
}
|
||||
|
||||
bool Stream::get_do_qlp_coeff_prec_search() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_get_do_qlp_coeff_prec_search(encoder_);
|
||||
}
|
||||
|
||||
bool Stream::get_do_escape_coding() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_get_do_escape_coding(encoder_);
|
||||
}
|
||||
|
||||
bool Stream::get_do_exhaustive_model_search() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_get_do_exhaustive_model_search(encoder_);
|
||||
}
|
||||
|
||||
unsigned Stream::get_min_residual_partition_order() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_encoder_get_min_residual_partition_order(encoder_);
|
||||
}
|
||||
|
||||
unsigned Stream::get_max_residual_partition_order() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_encoder_get_max_residual_partition_order(encoder_);
|
||||
}
|
||||
|
||||
unsigned Stream::get_rice_parameter_search_dist() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_encoder_get_rice_parameter_search_dist(encoder_);
|
||||
}
|
||||
|
||||
FLAC__uint64 Stream::get_total_samples_estimate() const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_encoder_get_total_samples_estimate(encoder_);
|
||||
}
|
||||
|
||||
::FLAC__StreamEncoderInitStatus Stream::init()
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_encoder_init_stream(encoder_, write_callback_, seek_callback_, tell_callback_, metadata_callback_, /*client_data=*/(void*)this);
|
||||
}
|
||||
|
||||
::FLAC__StreamEncoderInitStatus Stream::init_ogg()
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_encoder_init_ogg_stream(encoder_, read_callback_, write_callback_, seek_callback_, tell_callback_, metadata_callback_, /*client_data=*/(void*)this);
|
||||
}
|
||||
|
||||
bool Stream::finish()
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_finish(encoder_);
|
||||
}
|
||||
|
||||
bool Stream::process(const FLAC__int32 * const buffer[], unsigned samples)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_process(encoder_, buffer, samples);
|
||||
}
|
||||
|
||||
bool Stream::process_interleaved(const FLAC__int32 buffer[], unsigned samples)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return (bool)::FLAC__stream_encoder_process_interleaved(encoder_, buffer, samples);
|
||||
}
|
||||
|
||||
::FLAC__StreamEncoderReadStatus Stream::read_callback(FLAC__byte buffer[], size_t *bytes)
|
||||
{
|
||||
(void)buffer, (void)bytes;
|
||||
return ::FLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
::FLAC__StreamEncoderSeekStatus Stream::seek_callback(FLAC__uint64 absolute_byte_offset)
|
||||
{
|
||||
(void)absolute_byte_offset;
|
||||
return ::FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
::FLAC__StreamEncoderTellStatus Stream::tell_callback(FLAC__uint64 *absolute_byte_offset)
|
||||
{
|
||||
(void)absolute_byte_offset;
|
||||
return ::FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
void Stream::metadata_callback(const ::FLAC__StreamMetadata *metadata)
|
||||
{
|
||||
(void)metadata;
|
||||
}
|
||||
|
||||
::FLAC__StreamEncoderReadStatus Stream::read_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
|
||||
{
|
||||
(void)encoder;
|
||||
FLAC__ASSERT(0 != client_data);
|
||||
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
||||
FLAC__ASSERT(0 != instance);
|
||||
return instance->read_callback(buffer, bytes);
|
||||
}
|
||||
|
||||
::FLAC__StreamEncoderWriteStatus Stream::write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data)
|
||||
{
|
||||
(void)encoder;
|
||||
FLAC__ASSERT(0 != client_data);
|
||||
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
||||
FLAC__ASSERT(0 != instance);
|
||||
return instance->write_callback(buffer, bytes, samples, current_frame);
|
||||
}
|
||||
|
||||
::FLAC__StreamEncoderSeekStatus Stream::seek_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data)
|
||||
{
|
||||
(void)encoder;
|
||||
FLAC__ASSERT(0 != client_data);
|
||||
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
||||
FLAC__ASSERT(0 != instance);
|
||||
return instance->seek_callback(absolute_byte_offset);
|
||||
}
|
||||
|
||||
::FLAC__StreamEncoderTellStatus Stream::tell_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
|
||||
{
|
||||
(void)encoder;
|
||||
FLAC__ASSERT(0 != client_data);
|
||||
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
||||
FLAC__ASSERT(0 != instance);
|
||||
return instance->tell_callback(absolute_byte_offset);
|
||||
}
|
||||
|
||||
void Stream::metadata_callback_(const ::FLAC__StreamEncoder *encoder, const ::FLAC__StreamMetadata *metadata, void *client_data)
|
||||
{
|
||||
(void)encoder;
|
||||
FLAC__ASSERT(0 != client_data);
|
||||
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
||||
FLAC__ASSERT(0 != instance);
|
||||
instance->metadata_callback(metadata);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
//
|
||||
// File
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
File::File():
|
||||
Stream()
|
||||
{ }
|
||||
|
||||
File::~File()
|
||||
{
|
||||
}
|
||||
|
||||
::FLAC__StreamEncoderInitStatus File::init(FILE *file)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_encoder_init_FILE(encoder_, file, progress_callback_, /*client_data=*/(void*)this);
|
||||
}
|
||||
|
||||
::FLAC__StreamEncoderInitStatus File::init(const char *filename)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_encoder_init_file(encoder_, filename, progress_callback_, /*client_data=*/(void*)this);
|
||||
}
|
||||
|
||||
::FLAC__StreamEncoderInitStatus File::init(const std::string &filename)
|
||||
{
|
||||
return init(filename.c_str());
|
||||
}
|
||||
|
||||
::FLAC__StreamEncoderInitStatus File::init_ogg(FILE *file)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_encoder_init_ogg_FILE(encoder_, file, progress_callback_, /*client_data=*/(void*)this);
|
||||
}
|
||||
|
||||
::FLAC__StreamEncoderInitStatus File::init_ogg(const char *filename)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
return ::FLAC__stream_encoder_init_ogg_file(encoder_, filename, progress_callback_, /*client_data=*/(void*)this);
|
||||
}
|
||||
|
||||
::FLAC__StreamEncoderInitStatus File::init_ogg(const std::string &filename)
|
||||
{
|
||||
return init_ogg(filename.c_str());
|
||||
}
|
||||
|
||||
// This is a dummy to satisfy the pure virtual from Stream; the
|
||||
// read callback will never be called since we are initializing
|
||||
// with FLAC__stream_decoder_init_FILE() or
|
||||
// FLAC__stream_decoder_init_file() and those supply the read
|
||||
// callback internally.
|
||||
::FLAC__StreamEncoderWriteStatus File::write_callback(const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame)
|
||||
{
|
||||
(void)buffer, (void)bytes, (void)samples, (void)current_frame;
|
||||
FLAC__ASSERT(false);
|
||||
return ::FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; // double protection
|
||||
}
|
||||
|
||||
void File::progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate)
|
||||
{
|
||||
(void)bytes_written, (void)samples_written, (void)frames_written, (void)total_frames_estimate;
|
||||
}
|
||||
|
||||
void File::progress_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data)
|
||||
{
|
||||
(void)encoder;
|
||||
FLAC__ASSERT(0 != client_data);
|
||||
File *instance = reinterpret_cast<File *>(client_data);
|
||||
FLAC__ASSERT(0 != instance);
|
||||
instance->progress_callback(bytes_written, samples_written, frames_written, total_frames_estimate);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
118
flac/src/libFLAC/Makefile.am
Normal file
118
flac/src/libFLAC/Makefile.am
Normal file
@@ -0,0 +1,118 @@
|
||||
# libFLAC - Free Lossless Audio Codec library
|
||||
# Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# - Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# - Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
lib_LTLIBRARIES = libFLAC.la
|
||||
if DEBUG
|
||||
DEBUGCFLAGS = -DFLAC__OVERFLOW_DETECT
|
||||
endif
|
||||
if FLaC__CPU_PPC
|
||||
# The -force_cpusubtype_ALL is needed to insert a ppc64 instruction
|
||||
# into cpu.c with an asm().
|
||||
if FLaC__SYS_DARWIN
|
||||
#@@@ PPC optimizations temporarily disabled
|
||||
CPUCFLAGS = -faltivec -force_cpusubtype_ALL -DFLAC__NO_ASM
|
||||
else
|
||||
# Linux-gcc for PPC does not have -force_cpusubtype_ALL, it is Darwin-specific
|
||||
#@@@ PPC optimizations temporarily disabled
|
||||
CPUCFLAGS = -maltivec -mabi=altivec -DFLAC__NO_ASM
|
||||
endif
|
||||
endif
|
||||
|
||||
AM_CFLAGS = $(DEBUGCFLAGS) $(CPUCFLAGS) @OGG_CFLAGS@
|
||||
|
||||
if FLaC__NO_ASM
|
||||
else
|
||||
if FLaC__CPU_IA32
|
||||
if FLaC__HAS_NASM
|
||||
ARCH_SUBDIRS = ia32
|
||||
LOCAL_EXTRA_LIBADD = ia32/libFLAC-asm.la
|
||||
endif
|
||||
endif
|
||||
if FLaC__CPU_PPC
|
||||
ARCH_SUBDIRS = ppc
|
||||
if FLaC__HAS_AS__TEMPORARILY_DISABLED
|
||||
LOCAL_EXTRA_LIBADD = ppc/as/libFLAC-asm.la
|
||||
LOCAL_EXTRA_LDFLAGS = "-Wl,-read_only_relocs,warning"
|
||||
else
|
||||
if FLaC__HAS_GAS__TEMPORARILY_DISABLED
|
||||
LOCAL_EXTRA_LIBADD = ppc/gas/libFLAC-asm.la
|
||||
LOCAL_EXTRA_LDFLAGS = ""
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
libFLAC_la_LIBADD = $(LOCAL_EXTRA_LIBADD) @OGG_LIBS@
|
||||
|
||||
SUBDIRS = $(ARCH_SUBDIRS) include .
|
||||
|
||||
m4datadir = $(datadir)/aclocal
|
||||
m4data_DATA = libFLAC.m4
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = flac.pc
|
||||
|
||||
EXTRA_DIST = \
|
||||
Makefile.lite \
|
||||
flac.pc.in \
|
||||
libFLAC_dynamic.dsp \
|
||||
libFLAC_dynamic.vcproj \
|
||||
libFLAC_static.dsp \
|
||||
libFLAC_static.vcproj \
|
||||
libFLAC.m4
|
||||
|
||||
if FLaC__HAS_OGG
|
||||
extra_ogg_sources = \
|
||||
ogg_decoder_aspect.c \
|
||||
ogg_encoder_aspect.c \
|
||||
ogg_helper.c \
|
||||
ogg_mapping.c
|
||||
endif
|
||||
# see 'http://www.gnu.org/software/libtool/manual.html#Libtool-versioning' for numbering convention
|
||||
libFLAC_la_LDFLAGS = -version-info 10:0:2 -lm $(LOCAL_EXTRA_LDFLAGS)
|
||||
libFLAC_la_SOURCES = \
|
||||
bitmath.c \
|
||||
bitreader.c \
|
||||
bitwriter.c \
|
||||
cpu.c \
|
||||
crc.c \
|
||||
fixed.c \
|
||||
float.c \
|
||||
format.c \
|
||||
lpc.c \
|
||||
md5.c \
|
||||
memory.c \
|
||||
metadata_iterators.c \
|
||||
metadata_object.c \
|
||||
stream_decoder.c \
|
||||
stream_encoder.c \
|
||||
stream_encoder_framing.c \
|
||||
window.c \
|
||||
$(extra_ogg_sources)
|
||||
93
flac/src/libFLAC/Makefile.lite
Normal file
93
flac/src/libFLAC/Makefile.lite
Normal file
@@ -0,0 +1,93 @@
|
||||
# libFLAC - Free Lossless Audio Codec library
|
||||
# Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# - Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# - Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#
|
||||
# GNU makefile
|
||||
#
|
||||
|
||||
topdir = ../..
|
||||
|
||||
LIB_NAME = libFLAC
|
||||
ifeq ($(OS),Darwin)
|
||||
DEFINES = -DFLAC__CPU_PPC -DFLAC__USE_ALTIVEC -DFLAC__ALIGN_MALLOC_DATA
|
||||
else
|
||||
ifeq ($(OS),Solaris)
|
||||
DEFINES = -DFLAC__NO_ASM -DFLAC__ALIGN_MALLOC_DATA
|
||||
else
|
||||
ifeq ($(PROC),i386)
|
||||
DEFINES = -DFLAC__CPU_IA32 -DFLAC__USE_3DNOW -DFLAC__HAS_NASM -DFLAC__ALIGN_MALLOC_DATA
|
||||
else
|
||||
DEFINES = -DFLAC__ALIGN_MALLOC_DATA
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
INCLUDES = -I./include -I$(topdir)/include -I$(OGG_INCLUDE_DIR)
|
||||
DEBUG_CFLAGS = -DFLAC__OVERFLOW_DETECT
|
||||
|
||||
ifeq ($(OS),Darwin)
|
||||
SRCS_S = \
|
||||
ppc/as/lpc_asm.s
|
||||
else
|
||||
ifeq ($(PROC),i386)
|
||||
SRCS_NASM = \
|
||||
ia32/bitreader_asm.nasm \
|
||||
ia32/cpu_asm.nasm \
|
||||
ia32/fixed_asm.nasm \
|
||||
ia32/lpc_asm.nasm \
|
||||
ia32/stream_encoder_asm.nasm
|
||||
endif
|
||||
endif
|
||||
|
||||
SRCS_C = \
|
||||
bitmath.c \
|
||||
bitreader.c \
|
||||
bitwriter.c \
|
||||
cpu.c \
|
||||
crc.c \
|
||||
fixed.c \
|
||||
float.c \
|
||||
format.c \
|
||||
lpc.c \
|
||||
md5.c \
|
||||
memory.c \
|
||||
metadata_iterators.c \
|
||||
metadata_object.c \
|
||||
ogg_decoder_aspect.c \
|
||||
ogg_encoder_aspect.c \
|
||||
ogg_helper.c \
|
||||
ogg_mapping.c \
|
||||
stream_decoder.c \
|
||||
stream_encoder.c \
|
||||
stream_encoder_framing.c \
|
||||
window.c
|
||||
|
||||
include $(topdir)/build/lib.mk
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
149
flac/src/libFLAC/bitmath.c
Normal file
149
flac/src/libFLAC/bitmath.c
Normal file
@@ -0,0 +1,149 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "private/bitmath.h"
|
||||
#include "FLAC/assert.h"
|
||||
|
||||
/* An example of what FLAC__bitmath_ilog2() computes:
|
||||
*
|
||||
* ilog2( 0) = assertion failure
|
||||
* ilog2( 1) = 0
|
||||
* ilog2( 2) = 1
|
||||
* ilog2( 3) = 1
|
||||
* ilog2( 4) = 2
|
||||
* ilog2( 5) = 2
|
||||
* ilog2( 6) = 2
|
||||
* ilog2( 7) = 2
|
||||
* ilog2( 8) = 3
|
||||
* ilog2( 9) = 3
|
||||
* ilog2(10) = 3
|
||||
* ilog2(11) = 3
|
||||
* ilog2(12) = 3
|
||||
* ilog2(13) = 3
|
||||
* ilog2(14) = 3
|
||||
* ilog2(15) = 3
|
||||
* ilog2(16) = 4
|
||||
* ilog2(17) = 4
|
||||
* ilog2(18) = 4
|
||||
*/
|
||||
unsigned FLAC__bitmath_ilog2(FLAC__uint32 v)
|
||||
{
|
||||
unsigned l = 0;
|
||||
FLAC__ASSERT(v > 0);
|
||||
while(v >>= 1)
|
||||
l++;
|
||||
return l;
|
||||
}
|
||||
|
||||
unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v)
|
||||
{
|
||||
unsigned l = 0;
|
||||
FLAC__ASSERT(v > 0);
|
||||
while(v >>= 1)
|
||||
l++;
|
||||
return l;
|
||||
}
|
||||
|
||||
/* An example of what FLAC__bitmath_silog2() computes:
|
||||
*
|
||||
* silog2(-10) = 5
|
||||
* silog2(- 9) = 5
|
||||
* silog2(- 8) = 4
|
||||
* silog2(- 7) = 4
|
||||
* silog2(- 6) = 4
|
||||
* silog2(- 5) = 4
|
||||
* silog2(- 4) = 3
|
||||
* silog2(- 3) = 3
|
||||
* silog2(- 2) = 2
|
||||
* silog2(- 1) = 2
|
||||
* silog2( 0) = 0
|
||||
* silog2( 1) = 2
|
||||
* silog2( 2) = 3
|
||||
* silog2( 3) = 3
|
||||
* silog2( 4) = 4
|
||||
* silog2( 5) = 4
|
||||
* silog2( 6) = 4
|
||||
* silog2( 7) = 4
|
||||
* silog2( 8) = 5
|
||||
* silog2( 9) = 5
|
||||
* silog2( 10) = 5
|
||||
*/
|
||||
unsigned FLAC__bitmath_silog2(int v)
|
||||
{
|
||||
while(1) {
|
||||
if(v == 0) {
|
||||
return 0;
|
||||
}
|
||||
else if(v > 0) {
|
||||
unsigned l = 0;
|
||||
while(v) {
|
||||
l++;
|
||||
v >>= 1;
|
||||
}
|
||||
return l+1;
|
||||
}
|
||||
else if(v == -1) {
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
v++;
|
||||
v = -v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned FLAC__bitmath_silog2_wide(FLAC__int64 v)
|
||||
{
|
||||
while(1) {
|
||||
if(v == 0) {
|
||||
return 0;
|
||||
}
|
||||
else if(v > 0) {
|
||||
unsigned l = 0;
|
||||
while(v) {
|
||||
l++;
|
||||
v >>= 1;
|
||||
}
|
||||
return l+1;
|
||||
}
|
||||
else if(v == -1) {
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
v++;
|
||||
v = -v;
|
||||
}
|
||||
}
|
||||
}
|
||||
1380
flac/src/libFLAC/bitreader.c
Normal file
1380
flac/src/libFLAC/bitreader.c
Normal file
File diff suppressed because it is too large
Load Diff
889
flac/src/libFLAC/bitwriter.c
Normal file
889
flac/src/libFLAC/bitwriter.c
Normal file
@@ -0,0 +1,889 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h> /* for malloc() */
|
||||
#include <string.h> /* for memcpy(), memset() */
|
||||
#ifdef _MSC_VER
|
||||
#include <winsock.h> /* for ntohl() */
|
||||
#elif defined FLAC__SYS_DARWIN
|
||||
#include <machine/endian.h> /* for ntohl() */
|
||||
#elif defined __MINGW32__
|
||||
#include <winsock.h> /* for ntohl() */
|
||||
#else
|
||||
#include <netinet/in.h> /* for ntohl() */
|
||||
#endif
|
||||
#if 0 /* UNUSED */
|
||||
#include "private/bitmath.h"
|
||||
#endif
|
||||
#include "private/bitwriter.h"
|
||||
#include "private/crc.h"
|
||||
#include "FLAC/assert.h"
|
||||
#include "share/alloc.h"
|
||||
|
||||
/* Things should be fastest when this matches the machine word size */
|
||||
/* WATCHOUT: if you change this you must also change the following #defines down to SWAP_BE_WORD_TO_HOST below to match */
|
||||
/* WATCHOUT: there are a few places where the code will not work unless bwword is >= 32 bits wide */
|
||||
typedef FLAC__uint32 bwword;
|
||||
#define FLAC__BYTES_PER_WORD 4
|
||||
#define FLAC__BITS_PER_WORD 32
|
||||
#define FLAC__WORD_ALL_ONES ((FLAC__uint32)0xffffffff)
|
||||
/* SWAP_BE_WORD_TO_HOST swaps bytes in a bwword (which is always big-endian) if necessary to match host byte order */
|
||||
#if WORDS_BIGENDIAN
|
||||
#define SWAP_BE_WORD_TO_HOST(x) (x)
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#define SWAP_BE_WORD_TO_HOST(x) local_swap32_(x)
|
||||
#else
|
||||
#define SWAP_BE_WORD_TO_HOST(x) ntohl(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The default capacity here doesn't matter too much. The buffer always grows
|
||||
* to hold whatever is written to it. Usually the encoder will stop adding at
|
||||
* a frame or metadata block, then write that out and clear the buffer for the
|
||||
* next one.
|
||||
*/
|
||||
static const unsigned FLAC__BITWRITER_DEFAULT_CAPACITY = 32768u / sizeof(bwword); /* size in words */
|
||||
/* When growing, increment 4K at a time */
|
||||
static const unsigned FLAC__BITWRITER_DEFAULT_INCREMENT = 4096u / sizeof(bwword); /* size in words */
|
||||
|
||||
#define FLAC__WORDS_TO_BITS(words) ((words) * FLAC__BITS_PER_WORD)
|
||||
#define FLAC__TOTAL_BITS(bw) (FLAC__WORDS_TO_BITS((bw)->words) + (bw)->bits)
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
#define min(x,y) ((x)<(y)?(x):(y))
|
||||
|
||||
/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */
|
||||
#ifdef _MSC_VER
|
||||
#define FLAC__U64L(x) x
|
||||
#else
|
||||
#define FLAC__U64L(x) x##LLU
|
||||
#endif
|
||||
|
||||
#ifndef FLaC__INLINE
|
||||
#define FLaC__INLINE
|
||||
#endif
|
||||
|
||||
struct FLAC__BitWriter {
|
||||
bwword *buffer;
|
||||
bwword accum; /* accumulator; bits are right-justified; when full, accum is appended to buffer */
|
||||
unsigned capacity; /* capacity of buffer in words */
|
||||
unsigned words; /* # of complete words in buffer */
|
||||
unsigned bits; /* # of used bits in accum */
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* OPT: an MSVC built-in would be better */
|
||||
static _inline FLAC__uint32 local_swap32_(FLAC__uint32 x)
|
||||
{
|
||||
x = ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
|
||||
return (x>>16) | (x<<16);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* * WATCHOUT: The current implementation only grows the buffer. */
|
||||
static FLAC__bool bitwriter_grow_(FLAC__BitWriter *bw, unsigned bits_to_add)
|
||||
{
|
||||
unsigned new_capacity;
|
||||
bwword *new_buffer;
|
||||
|
||||
FLAC__ASSERT(0 != bw);
|
||||
FLAC__ASSERT(0 != bw->buffer);
|
||||
|
||||
/* calculate total words needed to store 'bits_to_add' additional bits */
|
||||
new_capacity = bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLAC__BITS_PER_WORD);
|
||||
|
||||
/* it's possible (due to pessimism in the growth estimation that
|
||||
* leads to this call) that we don't actually need to grow
|
||||
*/
|
||||
if(bw->capacity >= new_capacity)
|
||||
return true;
|
||||
|
||||
/* round up capacity increase to the nearest FLAC__BITWRITER_DEFAULT_INCREMENT */
|
||||
if((new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT)
|
||||
new_capacity += FLAC__BITWRITER_DEFAULT_INCREMENT - ((new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT);
|
||||
/* make sure we got everything right */
|
||||
FLAC__ASSERT(0 == (new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT);
|
||||
FLAC__ASSERT(new_capacity > bw->capacity);
|
||||
FLAC__ASSERT(new_capacity >= bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLAC__BITS_PER_WORD));
|
||||
|
||||
new_buffer = (bwword*)safe_realloc_mul_2op_(bw->buffer, sizeof(bwword), /*times*/new_capacity);
|
||||
if(new_buffer == 0)
|
||||
return false;
|
||||
bw->buffer = new_buffer;
|
||||
bw->capacity = new_capacity;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Class constructor/destructor
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
FLAC__BitWriter *FLAC__bitwriter_new(void)
|
||||
{
|
||||
FLAC__BitWriter *bw = (FLAC__BitWriter*)calloc(1, sizeof(FLAC__BitWriter));
|
||||
/* note that calloc() sets all members to 0 for us */
|
||||
return bw;
|
||||
}
|
||||
|
||||
void FLAC__bitwriter_delete(FLAC__BitWriter *bw)
|
||||
{
|
||||
FLAC__ASSERT(0 != bw);
|
||||
|
||||
FLAC__bitwriter_free(bw);
|
||||
free(bw);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Public class methods
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
FLAC__bool FLAC__bitwriter_init(FLAC__BitWriter *bw)
|
||||
{
|
||||
FLAC__ASSERT(0 != bw);
|
||||
|
||||
bw->words = bw->bits = 0;
|
||||
bw->capacity = FLAC__BITWRITER_DEFAULT_CAPACITY;
|
||||
bw->buffer = (bwword*)malloc(sizeof(bwword) * bw->capacity);
|
||||
if(bw->buffer == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void FLAC__bitwriter_free(FLAC__BitWriter *bw)
|
||||
{
|
||||
FLAC__ASSERT(0 != bw);
|
||||
|
||||
if(0 != bw->buffer)
|
||||
free(bw->buffer);
|
||||
bw->buffer = 0;
|
||||
bw->capacity = 0;
|
||||
bw->words = bw->bits = 0;
|
||||
}
|
||||
|
||||
void FLAC__bitwriter_clear(FLAC__BitWriter *bw)
|
||||
{
|
||||
bw->words = bw->bits = 0;
|
||||
}
|
||||
|
||||
void FLAC__bitwriter_dump(const FLAC__BitWriter *bw, FILE *out)
|
||||
{
|
||||
unsigned i, j;
|
||||
if(bw == 0) {
|
||||
fprintf(out, "bitwriter is NULL\n");
|
||||
}
|
||||
else {
|
||||
fprintf(out, "bitwriter: capacity=%u words=%u bits=%u total_bits=%u\n", bw->capacity, bw->words, bw->bits, FLAC__TOTAL_BITS(bw));
|
||||
|
||||
for(i = 0; i < bw->words; i++) {
|
||||
fprintf(out, "%08X: ", i);
|
||||
for(j = 0; j < FLAC__BITS_PER_WORD; j++)
|
||||
fprintf(out, "%01u", bw->buffer[i] & (1 << (FLAC__BITS_PER_WORD-j-1)) ? 1:0);
|
||||
fprintf(out, "\n");
|
||||
}
|
||||
if(bw->bits > 0) {
|
||||
fprintf(out, "%08X: ", i);
|
||||
for(j = 0; j < bw->bits; j++)
|
||||
fprintf(out, "%01u", bw->accum & (1 << (bw->bits-j-1)) ? 1:0);
|
||||
fprintf(out, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__bitwriter_get_write_crc16(FLAC__BitWriter *bw, FLAC__uint16 *crc)
|
||||
{
|
||||
const FLAC__byte *buffer;
|
||||
size_t bytes;
|
||||
|
||||
FLAC__ASSERT((bw->bits & 7) == 0); /* assert that we're byte-aligned */
|
||||
|
||||
if(!FLAC__bitwriter_get_buffer(bw, &buffer, &bytes))
|
||||
return false;
|
||||
|
||||
*crc = (FLAC__uint16)FLAC__crc16(buffer, bytes);
|
||||
FLAC__bitwriter_release_buffer(bw);
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__bitwriter_get_write_crc8(FLAC__BitWriter *bw, FLAC__byte *crc)
|
||||
{
|
||||
const FLAC__byte *buffer;
|
||||
size_t bytes;
|
||||
|
||||
FLAC__ASSERT((bw->bits & 7) == 0); /* assert that we're byte-aligned */
|
||||
|
||||
if(!FLAC__bitwriter_get_buffer(bw, &buffer, &bytes))
|
||||
return false;
|
||||
|
||||
*crc = FLAC__crc8(buffer, bytes);
|
||||
FLAC__bitwriter_release_buffer(bw);
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__bitwriter_is_byte_aligned(const FLAC__BitWriter *bw)
|
||||
{
|
||||
return ((bw->bits & 7) == 0);
|
||||
}
|
||||
|
||||
unsigned FLAC__bitwriter_get_input_bits_unconsumed(const FLAC__BitWriter *bw)
|
||||
{
|
||||
return FLAC__TOTAL_BITS(bw);
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__bitwriter_get_buffer(FLAC__BitWriter *bw, const FLAC__byte **buffer, size_t *bytes)
|
||||
{
|
||||
FLAC__ASSERT((bw->bits & 7) == 0);
|
||||
/* double protection */
|
||||
if(bw->bits & 7)
|
||||
return false;
|
||||
/* if we have bits in the accumulator we have to flush those to the buffer first */
|
||||
if(bw->bits) {
|
||||
FLAC__ASSERT(bw->words <= bw->capacity);
|
||||
if(bw->words == bw->capacity && !bitwriter_grow_(bw, FLAC__BITS_PER_WORD))
|
||||
return false;
|
||||
/* append bits as complete word to buffer, but don't change bw->accum or bw->bits */
|
||||
bw->buffer[bw->words] = SWAP_BE_WORD_TO_HOST(bw->accum << (FLAC__BITS_PER_WORD-bw->bits));
|
||||
}
|
||||
/* now we can just return what we have */
|
||||
*buffer = (FLAC__byte*)bw->buffer;
|
||||
*bytes = (FLAC__BYTES_PER_WORD * bw->words) + (bw->bits >> 3);
|
||||
return true;
|
||||
}
|
||||
|
||||
void FLAC__bitwriter_release_buffer(FLAC__BitWriter *bw)
|
||||
{
|
||||
/* nothing to do. in the future, strict checking of a 'writer-is-in-
|
||||
* get-mode' flag could be added everywhere and then cleared here
|
||||
*/
|
||||
(void)bw;
|
||||
}
|
||||
|
||||
FLaC__INLINE FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsigned bits)
|
||||
{
|
||||
unsigned n;
|
||||
|
||||
FLAC__ASSERT(0 != bw);
|
||||
FLAC__ASSERT(0 != bw->buffer);
|
||||
|
||||
if(bits == 0)
|
||||
return true;
|
||||
/* slightly pessimistic size check but faster than "<= bw->words + (bw->bits+bits+FLAC__BITS_PER_WORD-1)/FLAC__BITS_PER_WORD" */
|
||||
if(bw->capacity <= bw->words + bits && !bitwriter_grow_(bw, bits))
|
||||
return false;
|
||||
/* first part gets to word alignment */
|
||||
if(bw->bits) {
|
||||
n = min(FLAC__BITS_PER_WORD - bw->bits, bits);
|
||||
bw->accum <<= n;
|
||||
bits -= n;
|
||||
bw->bits += n;
|
||||
if(bw->bits == FLAC__BITS_PER_WORD) {
|
||||
bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum);
|
||||
bw->bits = 0;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
/* do whole words */
|
||||
while(bits >= FLAC__BITS_PER_WORD) {
|
||||
bw->buffer[bw->words++] = 0;
|
||||
bits -= FLAC__BITS_PER_WORD;
|
||||
}
|
||||
/* do any leftovers */
|
||||
if(bits > 0) {
|
||||
bw->accum = 0;
|
||||
bw->bits = bits;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, unsigned bits)
|
||||
{
|
||||
register unsigned left;
|
||||
|
||||
/* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
|
||||
FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
|
||||
|
||||
FLAC__ASSERT(0 != bw);
|
||||
FLAC__ASSERT(0 != bw->buffer);
|
||||
|
||||
FLAC__ASSERT(bits <= 32);
|
||||
if(bits == 0)
|
||||
return true;
|
||||
|
||||
/* slightly pessimistic size check but faster than "<= bw->words + (bw->bits+bits+FLAC__BITS_PER_WORD-1)/FLAC__BITS_PER_WORD" */
|
||||
if(bw->capacity <= bw->words + bits && !bitwriter_grow_(bw, bits))
|
||||
return false;
|
||||
|
||||
left = FLAC__BITS_PER_WORD - bw->bits;
|
||||
if(bits < left) {
|
||||
bw->accum <<= bits;
|
||||
bw->accum |= val;
|
||||
bw->bits += bits;
|
||||
}
|
||||
else if(bw->bits) { /* WATCHOUT: if bw->bits == 0, left==FLAC__BITS_PER_WORD and bw->accum<<=left is a NOP instead of setting to 0 */
|
||||
bw->accum <<= left;
|
||||
bw->accum |= val >> (bw->bits = bits - left);
|
||||
bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum);
|
||||
bw->accum = val;
|
||||
}
|
||||
else {
|
||||
bw->accum = val;
|
||||
bw->bits = 0;
|
||||
bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(val);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, unsigned bits)
|
||||
{
|
||||
/* zero-out unused bits */
|
||||
if(bits < 32)
|
||||
val &= (~(0xffffffff << bits));
|
||||
|
||||
return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, bits);
|
||||
}
|
||||
|
||||
FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, unsigned bits)
|
||||
{
|
||||
/* this could be a little faster but it's not used for much */
|
||||
if(bits > 32) {
|
||||
return
|
||||
FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)(val>>32), bits-32) &&
|
||||
FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, 32);
|
||||
}
|
||||
else
|
||||
return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, bits);
|
||||
}
|
||||
|
||||
FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_uint32_little_endian(FLAC__BitWriter *bw, FLAC__uint32 val)
|
||||
{
|
||||
/* this doesn't need to be that fast as currently it is only used for vorbis comments */
|
||||
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, val & 0xff, 8))
|
||||
return false;
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, (val>>8) & 0xff, 8))
|
||||
return false;
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, (val>>16) & 0xff, 8))
|
||||
return false;
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, val>>24, 8))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
FLaC__INLINE FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], unsigned nvals)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
/* this could be faster but currently we don't need it to be since it's only used for writing metadata */
|
||||
for(i = 0; i < nvals; i++) {
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)(vals[i]), 8))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, unsigned val)
|
||||
{
|
||||
if(val < 32)
|
||||
return FLAC__bitwriter_write_raw_uint32(bw, 1, ++val);
|
||||
else
|
||||
return
|
||||
FLAC__bitwriter_write_zeroes(bw, val) &&
|
||||
FLAC__bitwriter_write_raw_uint32(bw, 1, 1);
|
||||
}
|
||||
|
||||
unsigned FLAC__bitwriter_rice_bits(FLAC__int32 val, unsigned parameter)
|
||||
{
|
||||
FLAC__uint32 uval;
|
||||
|
||||
FLAC__ASSERT(parameter < sizeof(unsigned)*8);
|
||||
|
||||
/* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */
|
||||
uval = (val<<1) ^ (val>>31);
|
||||
|
||||
return 1 + parameter + (uval >> parameter);
|
||||
}
|
||||
|
||||
#if 0 /* UNUSED */
|
||||
unsigned FLAC__bitwriter_golomb_bits_signed(int val, unsigned parameter)
|
||||
{
|
||||
unsigned bits, msbs, uval;
|
||||
unsigned k;
|
||||
|
||||
FLAC__ASSERT(parameter > 0);
|
||||
|
||||
/* fold signed to unsigned */
|
||||
if(val < 0)
|
||||
uval = (unsigned)(((-(++val)) << 1) + 1);
|
||||
else
|
||||
uval = (unsigned)(val << 1);
|
||||
|
||||
k = FLAC__bitmath_ilog2(parameter);
|
||||
if(parameter == 1u<<k) {
|
||||
FLAC__ASSERT(k <= 30);
|
||||
|
||||
msbs = uval >> k;
|
||||
bits = 1 + k + msbs;
|
||||
}
|
||||
else {
|
||||
unsigned q, r, d;
|
||||
|
||||
d = (1 << (k+1)) - parameter;
|
||||
q = uval / parameter;
|
||||
r = uval - (q * parameter);
|
||||
|
||||
bits = 1 + q + k;
|
||||
if(r >= d)
|
||||
bits++;
|
||||
}
|
||||
return bits;
|
||||
}
|
||||
|
||||
unsigned FLAC__bitwriter_golomb_bits_unsigned(unsigned uval, unsigned parameter)
|
||||
{
|
||||
unsigned bits, msbs;
|
||||
unsigned k;
|
||||
|
||||
FLAC__ASSERT(parameter > 0);
|
||||
|
||||
k = FLAC__bitmath_ilog2(parameter);
|
||||
if(parameter == 1u<<k) {
|
||||
FLAC__ASSERT(k <= 30);
|
||||
|
||||
msbs = uval >> k;
|
||||
bits = 1 + k + msbs;
|
||||
}
|
||||
else {
|
||||
unsigned q, r, d;
|
||||
|
||||
d = (1 << (k+1)) - parameter;
|
||||
q = uval / parameter;
|
||||
r = uval - (q * parameter);
|
||||
|
||||
bits = 1 + q + k;
|
||||
if(r >= d)
|
||||
bits++;
|
||||
}
|
||||
return bits;
|
||||
}
|
||||
#endif /* UNUSED */
|
||||
|
||||
FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 val, unsigned parameter)
|
||||
{
|
||||
unsigned total_bits, interesting_bits, msbs;
|
||||
FLAC__uint32 uval, pattern;
|
||||
|
||||
FLAC__ASSERT(0 != bw);
|
||||
FLAC__ASSERT(0 != bw->buffer);
|
||||
FLAC__ASSERT(parameter < 8*sizeof(uval));
|
||||
|
||||
/* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */
|
||||
uval = (val<<1) ^ (val>>31);
|
||||
|
||||
msbs = uval >> parameter;
|
||||
interesting_bits = 1 + parameter;
|
||||
total_bits = interesting_bits + msbs;
|
||||
pattern = 1 << parameter; /* the unary end bit */
|
||||
pattern |= (uval & ((1<<parameter)-1)); /* the binary LSBs */
|
||||
|
||||
if(total_bits <= 32)
|
||||
return FLAC__bitwriter_write_raw_uint32(bw, pattern, total_bits);
|
||||
else
|
||||
return
|
||||
FLAC__bitwriter_write_zeroes(bw, msbs) && /* write the unary MSBs */
|
||||
FLAC__bitwriter_write_raw_uint32(bw, pattern, interesting_bits); /* write the unary end bit and binary LSBs */
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FLAC__int32 *vals, unsigned nvals, unsigned parameter)
|
||||
{
|
||||
const FLAC__uint32 mask1 = FLAC__WORD_ALL_ONES << parameter; /* we val|=mask1 to set the stop bit above it... */
|
||||
const FLAC__uint32 mask2 = FLAC__WORD_ALL_ONES >> (31-parameter); /* ...then mask off the bits above the stop bit with val&=mask2*/
|
||||
FLAC__uint32 uval;
|
||||
unsigned left;
|
||||
const unsigned lsbits = 1 + parameter;
|
||||
unsigned msbits;
|
||||
|
||||
FLAC__ASSERT(0 != bw);
|
||||
FLAC__ASSERT(0 != bw->buffer);
|
||||
FLAC__ASSERT(parameter < 8*sizeof(bwword)-1);
|
||||
/* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
|
||||
FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
|
||||
|
||||
while(nvals) {
|
||||
/* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */
|
||||
uval = (*vals<<1) ^ (*vals>>31);
|
||||
|
||||
msbits = uval >> parameter;
|
||||
|
||||
#if 0 /* OPT: can remove this special case if it doesn't make up for the extra compare (doesn't make a statistically significant difference with msvc or gcc/x86) */
|
||||
if(bw->bits && bw->bits + msbits + lsbits <= FLAC__BITS_PER_WORD) { /* i.e. if the whole thing fits in the current bwword */
|
||||
/* ^^^ if bw->bits is 0 then we may have filled the buffer and have no free bwword to work in */
|
||||
bw->bits = bw->bits + msbits + lsbits;
|
||||
uval |= mask1; /* set stop bit */
|
||||
uval &= mask2; /* mask off unused top bits */
|
||||
/* NOT: bw->accum <<= msbits + lsbits because msbits+lsbits could be 32, then the shift would be a NOP */
|
||||
bw->accum <<= msbits;
|
||||
bw->accum <<= lsbits;
|
||||
bw->accum |= uval;
|
||||
if(bw->bits == FLAC__BITS_PER_WORD) {
|
||||
bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum);
|
||||
bw->bits = 0;
|
||||
/* burying the capacity check down here means we have to grow the buffer a little if there are more vals to do */
|
||||
if(bw->capacity <= bw->words && nvals > 1 && !bitwriter_grow_(bw, 1)) {
|
||||
FLAC__ASSERT(bw->capacity == bw->words);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
#elif 1 /*@@@@@@ OPT: try this version with MSVC6 to see if better, not much difference for gcc-4 */
|
||||
if(bw->bits && bw->bits + msbits + lsbits < FLAC__BITS_PER_WORD) { /* i.e. if the whole thing fits in the current bwword */
|
||||
/* ^^^ if bw->bits is 0 then we may have filled the buffer and have no free bwword to work in */
|
||||
bw->bits = bw->bits + msbits + lsbits;
|
||||
uval |= mask1; /* set stop bit */
|
||||
uval &= mask2; /* mask off unused top bits */
|
||||
bw->accum <<= msbits + lsbits;
|
||||
bw->accum |= uval;
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
/* slightly pessimistic size check but faster than "<= bw->words + (bw->bits+msbits+lsbits+FLAC__BITS_PER_WORD-1)/FLAC__BITS_PER_WORD" */
|
||||
/* OPT: pessimism may cause flurry of false calls to grow_ which eat up all savings before it */
|
||||
if(bw->capacity <= bw->words + bw->bits + msbits + 1/*lsbits always fit in 1 bwword*/ && !bitwriter_grow_(bw, msbits+lsbits))
|
||||
return false;
|
||||
|
||||
if(msbits) {
|
||||
/* first part gets to word alignment */
|
||||
if(bw->bits) {
|
||||
left = FLAC__BITS_PER_WORD - bw->bits;
|
||||
if(msbits < left) {
|
||||
bw->accum <<= msbits;
|
||||
bw->bits += msbits;
|
||||
goto break1;
|
||||
}
|
||||
else {
|
||||
bw->accum <<= left;
|
||||
msbits -= left;
|
||||
bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum);
|
||||
bw->bits = 0;
|
||||
}
|
||||
}
|
||||
/* do whole words */
|
||||
while(msbits >= FLAC__BITS_PER_WORD) {
|
||||
bw->buffer[bw->words++] = 0;
|
||||
msbits -= FLAC__BITS_PER_WORD;
|
||||
}
|
||||
/* do any leftovers */
|
||||
if(msbits > 0) {
|
||||
bw->accum = 0;
|
||||
bw->bits = msbits;
|
||||
}
|
||||
}
|
||||
break1:
|
||||
uval |= mask1; /* set stop bit */
|
||||
uval &= mask2; /* mask off unused top bits */
|
||||
|
||||
left = FLAC__BITS_PER_WORD - bw->bits;
|
||||
if(lsbits < left) {
|
||||
bw->accum <<= lsbits;
|
||||
bw->accum |= uval;
|
||||
bw->bits += lsbits;
|
||||
}
|
||||
else {
|
||||
/* if bw->bits == 0, left==FLAC__BITS_PER_WORD which will always
|
||||
* be > lsbits (because of previous assertions) so it would have
|
||||
* triggered the (lsbits<left) case above.
|
||||
*/
|
||||
FLAC__ASSERT(bw->bits);
|
||||
FLAC__ASSERT(left < FLAC__BITS_PER_WORD);
|
||||
bw->accum <<= left;
|
||||
bw->accum |= uval >> (bw->bits = lsbits - left);
|
||||
bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum);
|
||||
bw->accum = uval;
|
||||
}
|
||||
#if 1
|
||||
}
|
||||
#endif
|
||||
vals++;
|
||||
nvals--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0 /* UNUSED */
|
||||
FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, unsigned parameter)
|
||||
{
|
||||
unsigned total_bits, msbs, uval;
|
||||
unsigned k;
|
||||
|
||||
FLAC__ASSERT(0 != bw);
|
||||
FLAC__ASSERT(0 != bw->buffer);
|
||||
FLAC__ASSERT(parameter > 0);
|
||||
|
||||
/* fold signed to unsigned */
|
||||
if(val < 0)
|
||||
uval = (unsigned)(((-(++val)) << 1) + 1);
|
||||
else
|
||||
uval = (unsigned)(val << 1);
|
||||
|
||||
k = FLAC__bitmath_ilog2(parameter);
|
||||
if(parameter == 1u<<k) {
|
||||
unsigned pattern;
|
||||
|
||||
FLAC__ASSERT(k <= 30);
|
||||
|
||||
msbs = uval >> k;
|
||||
total_bits = 1 + k + msbs;
|
||||
pattern = 1 << k; /* the unary end bit */
|
||||
pattern |= (uval & ((1u<<k)-1)); /* the binary LSBs */
|
||||
|
||||
if(total_bits <= 32) {
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, pattern, total_bits))
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
/* write the unary MSBs */
|
||||
if(!FLAC__bitwriter_write_zeroes(bw, msbs))
|
||||
return false;
|
||||
/* write the unary end bit and binary LSBs */
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, pattern, k+1))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
unsigned q, r, d;
|
||||
|
||||
d = (1 << (k+1)) - parameter;
|
||||
q = uval / parameter;
|
||||
r = uval - (q * parameter);
|
||||
/* write the unary MSBs */
|
||||
if(!FLAC__bitwriter_write_zeroes(bw, q))
|
||||
return false;
|
||||
/* write the unary end bit */
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, 1, 1))
|
||||
return false;
|
||||
/* write the binary LSBs */
|
||||
if(r >= d) {
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, r+d, k+1))
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, r, k))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, unsigned uval, unsigned parameter)
|
||||
{
|
||||
unsigned total_bits, msbs;
|
||||
unsigned k;
|
||||
|
||||
FLAC__ASSERT(0 != bw);
|
||||
FLAC__ASSERT(0 != bw->buffer);
|
||||
FLAC__ASSERT(parameter > 0);
|
||||
|
||||
k = FLAC__bitmath_ilog2(parameter);
|
||||
if(parameter == 1u<<k) {
|
||||
unsigned pattern;
|
||||
|
||||
FLAC__ASSERT(k <= 30);
|
||||
|
||||
msbs = uval >> k;
|
||||
total_bits = 1 + k + msbs;
|
||||
pattern = 1 << k; /* the unary end bit */
|
||||
pattern |= (uval & ((1u<<k)-1)); /* the binary LSBs */
|
||||
|
||||
if(total_bits <= 32) {
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, pattern, total_bits))
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
/* write the unary MSBs */
|
||||
if(!FLAC__bitwriter_write_zeroes(bw, msbs))
|
||||
return false;
|
||||
/* write the unary end bit and binary LSBs */
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, pattern, k+1))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
unsigned q, r, d;
|
||||
|
||||
d = (1 << (k+1)) - parameter;
|
||||
q = uval / parameter;
|
||||
r = uval - (q * parameter);
|
||||
/* write the unary MSBs */
|
||||
if(!FLAC__bitwriter_write_zeroes(bw, q))
|
||||
return false;
|
||||
/* write the unary end bit */
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, 1, 1))
|
||||
return false;
|
||||
/* write the binary LSBs */
|
||||
if(r >= d) {
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, r+d, k+1))
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, r, k))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif /* UNUSED */
|
||||
|
||||
FLAC__bool FLAC__bitwriter_write_utf8_uint32(FLAC__BitWriter *bw, FLAC__uint32 val)
|
||||
{
|
||||
FLAC__bool ok = 1;
|
||||
|
||||
FLAC__ASSERT(0 != bw);
|
||||
FLAC__ASSERT(0 != bw->buffer);
|
||||
|
||||
FLAC__ASSERT(!(val & 0x80000000)); /* this version only handles 31 bits */
|
||||
|
||||
if(val < 0x80) {
|
||||
return FLAC__bitwriter_write_raw_uint32(bw, val, 8);
|
||||
}
|
||||
else if(val < 0x800) {
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xC0 | (val>>6), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8);
|
||||
}
|
||||
else if(val < 0x10000) {
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xE0 | (val>>12), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>6)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8);
|
||||
}
|
||||
else if(val < 0x200000) {
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF0 | (val>>18), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>12)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>6)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8);
|
||||
}
|
||||
else if(val < 0x4000000) {
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF8 | (val>>24), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>18)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>12)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>6)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8);
|
||||
}
|
||||
else {
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xFC | (val>>30), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>24)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>18)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>12)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>6)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8);
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__bitwriter_write_utf8_uint64(FLAC__BitWriter *bw, FLAC__uint64 val)
|
||||
{
|
||||
FLAC__bool ok = 1;
|
||||
|
||||
FLAC__ASSERT(0 != bw);
|
||||
FLAC__ASSERT(0 != bw->buffer);
|
||||
|
||||
FLAC__ASSERT(!(val & FLAC__U64L(0xFFFFFFF000000000))); /* this version only handles 36 bits */
|
||||
|
||||
if(val < 0x80) {
|
||||
return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, 8);
|
||||
}
|
||||
else if(val < 0x800) {
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xC0 | (FLAC__uint32)(val>>6), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8);
|
||||
}
|
||||
else if(val < 0x10000) {
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xE0 | (FLAC__uint32)(val>>12), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8);
|
||||
}
|
||||
else if(val < 0x200000) {
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF0 | (FLAC__uint32)(val>>18), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8);
|
||||
}
|
||||
else if(val < 0x4000000) {
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF8 | (FLAC__uint32)(val>>24), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8);
|
||||
}
|
||||
else if(val < 0x80000000) {
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xFC | (FLAC__uint32)(val>>30), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>24)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8);
|
||||
}
|
||||
else {
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xFE, 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>30)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>24)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8);
|
||||
ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8);
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__bitwriter_zero_pad_to_byte_boundary(FLAC__BitWriter *bw)
|
||||
{
|
||||
/* 0-pad to byte boundary */
|
||||
if(bw->bits & 7u)
|
||||
return FLAC__bitwriter_write_zeroes(bw, 8 - (bw->bits & 7u));
|
||||
else
|
||||
return true;
|
||||
}
|
||||
418
flac/src/libFLAC/cpu.c
Normal file
418
flac/src/libFLAC/cpu.c
Normal file
@@ -0,0 +1,418 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "private/cpu.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined FLAC__CPU_IA32
|
||||
# include <signal.h>
|
||||
#elif defined FLAC__CPU_PPC
|
||||
# if !defined FLAC__NO_ASM
|
||||
# if defined FLAC__SYS_DARWIN
|
||||
# include <sys/sysctl.h>
|
||||
# include <mach/mach.h>
|
||||
# include <mach/mach_host.h>
|
||||
# include <mach/host_info.h>
|
||||
# include <mach/machine.h>
|
||||
# ifndef CPU_SUBTYPE_POWERPC_970
|
||||
# define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100)
|
||||
# endif
|
||||
# else /* FLAC__SYS_DARWIN */
|
||||
|
||||
# include <signal.h>
|
||||
# include <setjmp.h>
|
||||
|
||||
static sigjmp_buf jmpbuf;
|
||||
static volatile sig_atomic_t canjump = 0;
|
||||
|
||||
static void sigill_handler (int sig)
|
||||
{
|
||||
if (!canjump) {
|
||||
signal (sig, SIG_DFL);
|
||||
raise (sig);
|
||||
}
|
||||
canjump = 0;
|
||||
siglongjmp (jmpbuf, 1);
|
||||
}
|
||||
# endif /* FLAC__SYS_DARWIN */
|
||||
# endif /* FLAC__NO_ASM */
|
||||
#endif /* FLAC__CPU_PPC */
|
||||
|
||||
#if defined (__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <machine/cpu.h>
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
/* how to get sysctlbyname()? */
|
||||
#endif
|
||||
|
||||
/* these are flags in EDX of CPUID AX=00000001 */
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_CMOV = 0x00008000;
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_MMX = 0x00800000;
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_FXSR = 0x01000000;
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE = 0x02000000;
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE2 = 0x04000000;
|
||||
/* these are flags in ECX of CPUID AX=00000001 */
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE3 = 0x00000001;
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_SSSE3 = 0x00000200;
|
||||
/* these are flags in EDX of CPUID AX=80000001 */
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_3DNOW = 0x80000000;
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXT3DNOW = 0x40000000;
|
||||
static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXTMMX = 0x00400000;
|
||||
|
||||
|
||||
/*
|
||||
* Extra stuff needed for detection of OS support for SSE on IA-32
|
||||
*/
|
||||
#if defined(FLAC__CPU_IA32) && !defined FLAC__NO_ASM && defined FLAC__HAS_NASM && !defined FLAC__NO_SSE_OS && !defined FLAC__SSE_OS
|
||||
# if defined(__linux__)
|
||||
/*
|
||||
* If the OS doesn't support SSE, we will get here with a SIGILL. We
|
||||
* modify the return address to jump over the offending SSE instruction
|
||||
* and also the operation following it that indicates the instruction
|
||||
* executed successfully. In this way we use no global variables and
|
||||
* stay thread-safe.
|
||||
*
|
||||
* 3 + 3 + 6:
|
||||
* 3 bytes for "xorps xmm0,xmm0"
|
||||
* 3 bytes for estimate of how long the follwing "inc var" instruction is
|
||||
* 6 bytes extra in case our estimate is wrong
|
||||
* 12 bytes puts us in the NOP "landing zone"
|
||||
*/
|
||||
# undef USE_OBSOLETE_SIGCONTEXT_FLAVOR /* #define this to use the older signal handler method */
|
||||
# ifdef USE_OBSOLETE_SIGCONTEXT_FLAVOR
|
||||
static void sigill_handler_sse_os(int signal, struct sigcontext sc)
|
||||
{
|
||||
(void)signal;
|
||||
sc.eip += 3 + 3 + 6;
|
||||
}
|
||||
# else
|
||||
# include <sys/ucontext.h>
|
||||
static void sigill_handler_sse_os(int signal, siginfo_t *si, void *uc)
|
||||
{
|
||||
(void)signal, (void)si;
|
||||
((ucontext_t*)uc)->uc_mcontext.gregs[14/*REG_EIP*/] += 3 + 3 + 6;
|
||||
}
|
||||
# endif
|
||||
# elif defined(_MSC_VER)
|
||||
# include <windows.h>
|
||||
# undef USE_TRY_CATCH_FLAVOR /* #define this to use the try/catch method for catching illegal opcode exception */
|
||||
# ifdef USE_TRY_CATCH_FLAVOR
|
||||
# else
|
||||
LONG CALLBACK sigill_handler_sse_os(EXCEPTION_POINTERS *ep)
|
||||
{
|
||||
if(ep->ExceptionRecord->ExceptionCode == EXCEPTION_ILLEGAL_INSTRUCTION) {
|
||||
ep->ContextRecord->Eip += 3 + 3 + 6;
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
void FLAC__cpu_info(FLAC__CPUInfo *info)
|
||||
{
|
||||
/*
|
||||
* IA32-specific
|
||||
*/
|
||||
#ifdef FLAC__CPU_IA32
|
||||
info->type = FLAC__CPUINFO_TYPE_IA32;
|
||||
#if !defined FLAC__NO_ASM && defined FLAC__HAS_NASM
|
||||
info->use_asm = true; /* we assume a minimum of 80386 with FLAC__CPU_IA32 */
|
||||
info->data.ia32.cpuid = FLAC__cpu_have_cpuid_asm_ia32()? true : false;
|
||||
info->data.ia32.bswap = info->data.ia32.cpuid; /* CPUID => BSWAP since it came after */
|
||||
info->data.ia32.cmov = false;
|
||||
info->data.ia32.mmx = false;
|
||||
info->data.ia32.fxsr = false;
|
||||
info->data.ia32.sse = false;
|
||||
info->data.ia32.sse2 = false;
|
||||
info->data.ia32.sse3 = false;
|
||||
info->data.ia32.ssse3 = false;
|
||||
info->data.ia32._3dnow = false;
|
||||
info->data.ia32.ext3dnow = false;
|
||||
info->data.ia32.extmmx = false;
|
||||
if(info->data.ia32.cpuid) {
|
||||
/* http://www.sandpile.org/ia32/cpuid.htm */
|
||||
FLAC__uint32 flags_edx, flags_ecx;
|
||||
FLAC__cpu_info_asm_ia32(&flags_edx, &flags_ecx);
|
||||
info->data.ia32.cmov = (flags_edx & FLAC__CPUINFO_IA32_CPUID_CMOV )? true : false;
|
||||
info->data.ia32.mmx = (flags_edx & FLAC__CPUINFO_IA32_CPUID_MMX )? true : false;
|
||||
info->data.ia32.fxsr = (flags_edx & FLAC__CPUINFO_IA32_CPUID_FXSR )? true : false;
|
||||
info->data.ia32.sse = (flags_edx & FLAC__CPUINFO_IA32_CPUID_SSE )? true : false;
|
||||
info->data.ia32.sse2 = (flags_edx & FLAC__CPUINFO_IA32_CPUID_SSE2 )? true : false;
|
||||
info->data.ia32.sse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE3 )? true : false;
|
||||
info->data.ia32.ssse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSSE3)? true : false;
|
||||
|
||||
#ifdef FLAC__USE_3DNOW
|
||||
flags_edx = FLAC__cpu_info_extended_amd_asm_ia32();
|
||||
info->data.ia32._3dnow = (flags_edx & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_3DNOW )? true : false;
|
||||
info->data.ia32.ext3dnow = (flags_edx & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXT3DNOW)? true : false;
|
||||
info->data.ia32.extmmx = (flags_edx & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXTMMX )? true : false;
|
||||
#else
|
||||
info->data.ia32._3dnow = info->data.ia32.ext3dnow = info->data.ia32.extmmx = false;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "CPU info (IA-32):\n");
|
||||
fprintf(stderr, " CPUID ...... %c\n", info->data.ia32.cpuid ? 'Y' : 'n');
|
||||
fprintf(stderr, " BSWAP ...... %c\n", info->data.ia32.bswap ? 'Y' : 'n');
|
||||
fprintf(stderr, " CMOV ....... %c\n", info->data.ia32.cmov ? 'Y' : 'n');
|
||||
fprintf(stderr, " MMX ........ %c\n", info->data.ia32.mmx ? 'Y' : 'n');
|
||||
fprintf(stderr, " FXSR ....... %c\n", info->data.ia32.fxsr ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE ........ %c\n", info->data.ia32.sse ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE2 ....... %c\n", info->data.ia32.sse2 ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSE3 ....... %c\n", info->data.ia32.sse3 ? 'Y' : 'n');
|
||||
fprintf(stderr, " SSSE3 ...... %c\n", info->data.ia32.ssse3 ? 'Y' : 'n');
|
||||
fprintf(stderr, " 3DNow! ..... %c\n", info->data.ia32._3dnow ? 'Y' : 'n');
|
||||
fprintf(stderr, " 3DNow!-ext . %c\n", info->data.ia32.ext3dnow? 'Y' : 'n');
|
||||
fprintf(stderr, " 3DNow!-MMX . %c\n", info->data.ia32.extmmx ? 'Y' : 'n');
|
||||
#endif
|
||||
|
||||
/*
|
||||
* now have to check for OS support of SSE/SSE2
|
||||
*/
|
||||
if(info->data.ia32.fxsr || info->data.ia32.sse || info->data.ia32.sse2) {
|
||||
#if defined FLAC__NO_SSE_OS
|
||||
/* assume user knows better than us; turn it off */
|
||||
info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
|
||||
#elif defined FLAC__SSE_OS
|
||||
/* assume user knows better than us; leave as detected above */
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__APPLE__)
|
||||
int sse = 0;
|
||||
size_t len;
|
||||
/* at least one of these must work: */
|
||||
len = sizeof(sse); sse = sse || (sysctlbyname("hw.instruction_sse", &sse, &len, NULL, 0) == 0 && sse);
|
||||
len = sizeof(sse); sse = sse || (sysctlbyname("hw.optional.sse" , &sse, &len, NULL, 0) == 0 && sse); /* __APPLE__ ? */
|
||||
if(!sse)
|
||||
info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
|
||||
#elif defined(__NetBSD__) || defined (__OpenBSD__)
|
||||
# if __NetBSD_Version__ >= 105250000 || (defined __OpenBSD__)
|
||||
int val = 0, mib[2] = { CTL_MACHDEP, CPU_SSE };
|
||||
size_t len = sizeof(val);
|
||||
if(sysctl(mib, 2, &val, &len, NULL, 0) < 0 || !val)
|
||||
info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
|
||||
else { /* double-check SSE2 */
|
||||
mib[1] = CPU_SSE2;
|
||||
len = sizeof(val);
|
||||
if(sysctl(mib, 2, &val, &len, NULL, 0) < 0 || !val)
|
||||
info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
|
||||
}
|
||||
# else
|
||||
info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
|
||||
# endif
|
||||
#elif defined(__linux__)
|
||||
int sse = 0;
|
||||
struct sigaction sigill_save;
|
||||
#ifdef USE_OBSOLETE_SIGCONTEXT_FLAVOR
|
||||
if(0 == sigaction(SIGILL, NULL, &sigill_save) && signal(SIGILL, (void (*)(int))sigill_handler_sse_os) != SIG_ERR)
|
||||
#else
|
||||
struct sigaction sigill_sse;
|
||||
sigill_sse.sa_sigaction = sigill_handler_sse_os;
|
||||
__sigemptyset(&sigill_sse.sa_mask);
|
||||
sigill_sse.sa_flags = SA_SIGINFO | SA_RESETHAND; /* SA_RESETHAND just in case our SIGILL return jump breaks, so we don't get stuck in a loop */
|
||||
if(0 == sigaction(SIGILL, &sigill_sse, &sigill_save))
|
||||
#endif
|
||||
{
|
||||
/* http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html */
|
||||
/* see sigill_handler_sse_os() for an explanation of the following: */
|
||||
asm volatile (
|
||||
"xorl %0,%0\n\t" /* for some reason, still need to do this to clear 'sse' var */
|
||||
"xorps %%xmm0,%%xmm0\n\t" /* will cause SIGILL if unsupported by OS */
|
||||
"incl %0\n\t" /* SIGILL handler will jump over this */
|
||||
/* landing zone */
|
||||
"nop\n\t" /* SIGILL jump lands here if "inc" is 9 bytes */
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t"
|
||||
"nop\n\t" /* SIGILL jump lands here if "inc" is 3 bytes (expected) */
|
||||
"nop\n\t"
|
||||
"nop" /* SIGILL jump lands here if "inc" is 1 byte */
|
||||
: "=r"(sse)
|
||||
: "r"(sse)
|
||||
);
|
||||
|
||||
sigaction(SIGILL, &sigill_save, NULL);
|
||||
}
|
||||
|
||||
if(!sse)
|
||||
info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
|
||||
#elif defined(_MSC_VER)
|
||||
# ifdef USE_TRY_CATCH_FLAVOR
|
||||
_try {
|
||||
__asm {
|
||||
# if _MSC_VER <= 1200
|
||||
/* VC6 assembler doesn't know SSE, have to emit bytecode instead */
|
||||
_emit 0x0F
|
||||
_emit 0x57
|
||||
_emit 0xC0
|
||||
# else
|
||||
xorps xmm0,xmm0
|
||||
# endif
|
||||
}
|
||||
}
|
||||
_except(EXCEPTION_EXECUTE_HANDLER) {
|
||||
if (_exception_code() == STATUS_ILLEGAL_INSTRUCTION)
|
||||
info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
|
||||
}
|
||||
# else
|
||||
int sse = 0;
|
||||
LPTOP_LEVEL_EXCEPTION_FILTER save = SetUnhandledExceptionFilter(sigill_handler_sse_os);
|
||||
/* see GCC version above for explanation */
|
||||
/* http://msdn2.microsoft.com/en-us/library/4ks26t93.aspx */
|
||||
/* http://www.codeproject.com/cpp/gccasm.asp */
|
||||
/* http://www.hick.org/~mmiller/msvc_inline_asm.html */
|
||||
__asm {
|
||||
# if _MSC_VER <= 1200
|
||||
/* VC6 assembler doesn't know SSE, have to emit bytecode instead */
|
||||
_emit 0x0F
|
||||
_emit 0x57
|
||||
_emit 0xC0
|
||||
# else
|
||||
xorps xmm0,xmm0
|
||||
# endif
|
||||
inc sse
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
}
|
||||
SetUnhandledExceptionFilter(save);
|
||||
if(!sse)
|
||||
info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
|
||||
# endif
|
||||
#else
|
||||
/* no way to test, disable to be safe */
|
||||
info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false;
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " SSE OS sup . %c\n", info->data.ia32.sse ? 'Y' : 'n');
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
#else
|
||||
info->use_asm = false;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* PPC-specific
|
||||
*/
|
||||
#elif defined FLAC__CPU_PPC
|
||||
info->type = FLAC__CPUINFO_TYPE_PPC;
|
||||
# if !defined FLAC__NO_ASM
|
||||
info->use_asm = true;
|
||||
# ifdef FLAC__USE_ALTIVEC
|
||||
# if defined FLAC__SYS_DARWIN
|
||||
{
|
||||
int val = 0, mib[2] = { CTL_HW, HW_VECTORUNIT };
|
||||
size_t len = sizeof(val);
|
||||
info->data.ppc.altivec = !(sysctl(mib, 2, &val, &len, NULL, 0) || !val);
|
||||
}
|
||||
{
|
||||
host_basic_info_data_t hostInfo;
|
||||
mach_msg_type_number_t infoCount;
|
||||
|
||||
infoCount = HOST_BASIC_INFO_COUNT;
|
||||
host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)&hostInfo, &infoCount);
|
||||
|
||||
info->data.ppc.ppc64 = (hostInfo.cpu_type == CPU_TYPE_POWERPC) && (hostInfo.cpu_subtype == CPU_SUBTYPE_POWERPC_970);
|
||||
}
|
||||
# else /* FLAC__USE_ALTIVEC && !FLAC__SYS_DARWIN */
|
||||
{
|
||||
/* no Darwin, do it the brute-force way */
|
||||
/* @@@@@@ this is not thread-safe; replace with SSE OS method above or remove */
|
||||
info->data.ppc.altivec = 0;
|
||||
info->data.ppc.ppc64 = 0;
|
||||
|
||||
signal (SIGILL, sigill_handler);
|
||||
canjump = 0;
|
||||
if (!sigsetjmp (jmpbuf, 1)) {
|
||||
canjump = 1;
|
||||
|
||||
asm volatile (
|
||||
"mtspr 256, %0\n\t"
|
||||
"vand %%v0, %%v0, %%v0"
|
||||
:
|
||||
: "r" (-1)
|
||||
);
|
||||
|
||||
info->data.ppc.altivec = 1;
|
||||
}
|
||||
canjump = 0;
|
||||
if (!sigsetjmp (jmpbuf, 1)) {
|
||||
int x = 0;
|
||||
canjump = 1;
|
||||
|
||||
/* PPC64 hardware implements the cntlzd instruction */
|
||||
asm volatile ("cntlzd %0, %1" : "=r" (x) : "r" (x) );
|
||||
|
||||
info->data.ppc.ppc64 = 1;
|
||||
}
|
||||
signal (SIGILL, SIG_DFL); /*@@@@@@ should save and restore old signal */
|
||||
}
|
||||
# endif
|
||||
# else /* !FLAC__USE_ALTIVEC */
|
||||
info->data.ppc.altivec = 0;
|
||||
info->data.ppc.ppc64 = 0;
|
||||
# endif
|
||||
# else
|
||||
info->use_asm = false;
|
||||
# endif
|
||||
|
||||
/*
|
||||
* unknown CPI
|
||||
*/
|
||||
#else
|
||||
info->type = FLAC__CPUINFO_TYPE_UNKNOWN;
|
||||
info->use_asm = false;
|
||||
#endif
|
||||
}
|
||||
142
flac/src/libFLAC/crc.c
Normal file
142
flac/src/libFLAC/crc.c
Normal file
@@ -0,0 +1,142 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "private/crc.h"
|
||||
|
||||
/* CRC-8, poly = x^8 + x^2 + x^1 + x^0, init = 0 */
|
||||
|
||||
FLAC__byte const FLAC__crc8_table[256] = {
|
||||
0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15,
|
||||
0x38, 0x3F, 0x36, 0x31, 0x24, 0x23, 0x2A, 0x2D,
|
||||
0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65,
|
||||
0x48, 0x4F, 0x46, 0x41, 0x54, 0x53, 0x5A, 0x5D,
|
||||
0xE0, 0xE7, 0xEE, 0xE9, 0xFC, 0xFB, 0xF2, 0xF5,
|
||||
0xD8, 0xDF, 0xD6, 0xD1, 0xC4, 0xC3, 0xCA, 0xCD,
|
||||
0x90, 0x97, 0x9E, 0x99, 0x8C, 0x8B, 0x82, 0x85,
|
||||
0xA8, 0xAF, 0xA6, 0xA1, 0xB4, 0xB3, 0xBA, 0xBD,
|
||||
0xC7, 0xC0, 0xC9, 0xCE, 0xDB, 0xDC, 0xD5, 0xD2,
|
||||
0xFF, 0xF8, 0xF1, 0xF6, 0xE3, 0xE4, 0xED, 0xEA,
|
||||
0xB7, 0xB0, 0xB9, 0xBE, 0xAB, 0xAC, 0xA5, 0xA2,
|
||||
0x8F, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9D, 0x9A,
|
||||
0x27, 0x20, 0x29, 0x2E, 0x3B, 0x3C, 0x35, 0x32,
|
||||
0x1F, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0D, 0x0A,
|
||||
0x57, 0x50, 0x59, 0x5E, 0x4B, 0x4C, 0x45, 0x42,
|
||||
0x6F, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7D, 0x7A,
|
||||
0x89, 0x8E, 0x87, 0x80, 0x95, 0x92, 0x9B, 0x9C,
|
||||
0xB1, 0xB6, 0xBF, 0xB8, 0xAD, 0xAA, 0xA3, 0xA4,
|
||||
0xF9, 0xFE, 0xF7, 0xF0, 0xE5, 0xE2, 0xEB, 0xEC,
|
||||
0xC1, 0xC6, 0xCF, 0xC8, 0xDD, 0xDA, 0xD3, 0xD4,
|
||||
0x69, 0x6E, 0x67, 0x60, 0x75, 0x72, 0x7B, 0x7C,
|
||||
0x51, 0x56, 0x5F, 0x58, 0x4D, 0x4A, 0x43, 0x44,
|
||||
0x19, 0x1E, 0x17, 0x10, 0x05, 0x02, 0x0B, 0x0C,
|
||||
0x21, 0x26, 0x2F, 0x28, 0x3D, 0x3A, 0x33, 0x34,
|
||||
0x4E, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5C, 0x5B,
|
||||
0x76, 0x71, 0x78, 0x7F, 0x6A, 0x6D, 0x64, 0x63,
|
||||
0x3E, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2C, 0x2B,
|
||||
0x06, 0x01, 0x08, 0x0F, 0x1A, 0x1D, 0x14, 0x13,
|
||||
0xAE, 0xA9, 0xA0, 0xA7, 0xB2, 0xB5, 0xBC, 0xBB,
|
||||
0x96, 0x91, 0x98, 0x9F, 0x8A, 0x8D, 0x84, 0x83,
|
||||
0xDE, 0xD9, 0xD0, 0xD7, 0xC2, 0xC5, 0xCC, 0xCB,
|
||||
0xE6, 0xE1, 0xE8, 0xEF, 0xFA, 0xFD, 0xF4, 0xF3
|
||||
};
|
||||
|
||||
/* CRC-16, poly = x^16 + x^15 + x^2 + x^0, init = 0 */
|
||||
|
||||
unsigned const FLAC__crc16_table[256] = {
|
||||
0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011,
|
||||
0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022,
|
||||
0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072,
|
||||
0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041,
|
||||
0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2,
|
||||
0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1,
|
||||
0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1,
|
||||
0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082,
|
||||
0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192,
|
||||
0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1,
|
||||
0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1,
|
||||
0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2,
|
||||
0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151,
|
||||
0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162,
|
||||
0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132,
|
||||
0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101,
|
||||
0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312,
|
||||
0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321,
|
||||
0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371,
|
||||
0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342,
|
||||
0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1,
|
||||
0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2,
|
||||
0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2,
|
||||
0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381,
|
||||
0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291,
|
||||
0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2,
|
||||
0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2,
|
||||
0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1,
|
||||
0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252,
|
||||
0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261,
|
||||
0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231,
|
||||
0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202
|
||||
};
|
||||
|
||||
|
||||
void FLAC__crc8_update(const FLAC__byte data, FLAC__uint8 *crc)
|
||||
{
|
||||
*crc = FLAC__crc8_table[*crc ^ data];
|
||||
}
|
||||
|
||||
void FLAC__crc8_update_block(const FLAC__byte *data, unsigned len, FLAC__uint8 *crc)
|
||||
{
|
||||
while(len--)
|
||||
*crc = FLAC__crc8_table[*crc ^ *data++];
|
||||
}
|
||||
|
||||
FLAC__uint8 FLAC__crc8(const FLAC__byte *data, unsigned len)
|
||||
{
|
||||
FLAC__uint8 crc = 0;
|
||||
|
||||
while(len--)
|
||||
crc = FLAC__crc8_table[crc ^ *data++];
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
unsigned FLAC__crc16(const FLAC__byte *data, unsigned len)
|
||||
{
|
||||
unsigned crc = 0;
|
||||
|
||||
while(len--)
|
||||
crc = ((crc<<8) ^ FLAC__crc16_table[(crc>>8) ^ *data++]) & 0xffff;
|
||||
|
||||
return crc;
|
||||
}
|
||||
435
flac/src/libFLAC/fixed.c
Normal file
435
flac/src/libFLAC/fixed.c
Normal file
@@ -0,0 +1,435 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "private/bitmath.h"
|
||||
#include "private/fixed.h"
|
||||
#include "FLAC/assert.h"
|
||||
|
||||
#ifndef M_LN2
|
||||
/* math.h in VC++ doesn't seem to have this (how Microsoft is that?) */
|
||||
#define M_LN2 0.69314718055994530942
|
||||
#endif
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
#define min(x,y) ((x) < (y)? (x) : (y))
|
||||
|
||||
#ifdef local_abs
|
||||
#undef local_abs
|
||||
#endif
|
||||
#define local_abs(x) ((unsigned)((x)<0? -(x) : (x)))
|
||||
|
||||
#ifdef FLAC__INTEGER_ONLY_LIBRARY
|
||||
/* rbps stands for residual bits per sample
|
||||
*
|
||||
* (ln(2) * err)
|
||||
* rbps = log (-----------)
|
||||
* 2 ( n )
|
||||
*/
|
||||
static FLAC__fixedpoint local__compute_rbps_integerized(FLAC__uint32 err, FLAC__uint32 n)
|
||||
{
|
||||
FLAC__uint32 rbps;
|
||||
unsigned bits; /* the number of bits required to represent a number */
|
||||
int fracbits; /* the number of bits of rbps that comprise the fractional part */
|
||||
|
||||
FLAC__ASSERT(sizeof(rbps) == sizeof(FLAC__fixedpoint));
|
||||
FLAC__ASSERT(err > 0);
|
||||
FLAC__ASSERT(n > 0);
|
||||
|
||||
FLAC__ASSERT(n <= FLAC__MAX_BLOCK_SIZE);
|
||||
if(err <= n)
|
||||
return 0;
|
||||
/*
|
||||
* The above two things tell us 1) n fits in 16 bits; 2) err/n > 1.
|
||||
* These allow us later to know we won't lose too much precision in the
|
||||
* fixed-point division (err<<fracbits)/n.
|
||||
*/
|
||||
|
||||
fracbits = (8*sizeof(err)) - (FLAC__bitmath_ilog2(err)+1);
|
||||
|
||||
err <<= fracbits;
|
||||
err /= n;
|
||||
/* err now holds err/n with fracbits fractional bits */
|
||||
|
||||
/*
|
||||
* Whittle err down to 16 bits max. 16 significant bits is enough for
|
||||
* our purposes.
|
||||
*/
|
||||
FLAC__ASSERT(err > 0);
|
||||
bits = FLAC__bitmath_ilog2(err)+1;
|
||||
if(bits > 16) {
|
||||
err >>= (bits-16);
|
||||
fracbits -= (bits-16);
|
||||
}
|
||||
rbps = (FLAC__uint32)err;
|
||||
|
||||
/* Multiply by fixed-point version of ln(2), with 16 fractional bits */
|
||||
rbps *= FLAC__FP_LN2;
|
||||
fracbits += 16;
|
||||
FLAC__ASSERT(fracbits >= 0);
|
||||
|
||||
/* FLAC__fixedpoint_log2 requires fracbits%4 to be 0 */
|
||||
{
|
||||
const int f = fracbits & 3;
|
||||
if(f) {
|
||||
rbps >>= f;
|
||||
fracbits -= f;
|
||||
}
|
||||
}
|
||||
|
||||
rbps = FLAC__fixedpoint_log2(rbps, fracbits, (unsigned)(-1));
|
||||
|
||||
if(rbps == 0)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* The return value must have 16 fractional bits. Since the whole part
|
||||
* of the base-2 log of a 32 bit number must fit in 5 bits, and fracbits
|
||||
* must be >= -3, these assertion allows us to be able to shift rbps
|
||||
* left if necessary to get 16 fracbits without losing any bits of the
|
||||
* whole part of rbps.
|
||||
*
|
||||
* There is a slight chance due to accumulated error that the whole part
|
||||
* will require 6 bits, so we use 6 in the assertion. Really though as
|
||||
* long as it fits in 13 bits (32 - (16 - (-3))) we are fine.
|
||||
*/
|
||||
FLAC__ASSERT((int)FLAC__bitmath_ilog2(rbps)+1 <= fracbits + 6);
|
||||
FLAC__ASSERT(fracbits >= -3);
|
||||
|
||||
/* now shift the decimal point into place */
|
||||
if(fracbits < 16)
|
||||
return rbps << (16-fracbits);
|
||||
else if(fracbits > 16)
|
||||
return rbps >> (fracbits-16);
|
||||
else
|
||||
return rbps;
|
||||
}
|
||||
|
||||
static FLAC__fixedpoint local__compute_rbps_wide_integerized(FLAC__uint64 err, FLAC__uint32 n)
|
||||
{
|
||||
FLAC__uint32 rbps;
|
||||
unsigned bits; /* the number of bits required to represent a number */
|
||||
int fracbits; /* the number of bits of rbps that comprise the fractional part */
|
||||
|
||||
FLAC__ASSERT(sizeof(rbps) == sizeof(FLAC__fixedpoint));
|
||||
FLAC__ASSERT(err > 0);
|
||||
FLAC__ASSERT(n > 0);
|
||||
|
||||
FLAC__ASSERT(n <= FLAC__MAX_BLOCK_SIZE);
|
||||
if(err <= n)
|
||||
return 0;
|
||||
/*
|
||||
* The above two things tell us 1) n fits in 16 bits; 2) err/n > 1.
|
||||
* These allow us later to know we won't lose too much precision in the
|
||||
* fixed-point division (err<<fracbits)/n.
|
||||
*/
|
||||
|
||||
fracbits = (8*sizeof(err)) - (FLAC__bitmath_ilog2_wide(err)+1);
|
||||
|
||||
err <<= fracbits;
|
||||
err /= n;
|
||||
/* err now holds err/n with fracbits fractional bits */
|
||||
|
||||
/*
|
||||
* Whittle err down to 16 bits max. 16 significant bits is enough for
|
||||
* our purposes.
|
||||
*/
|
||||
FLAC__ASSERT(err > 0);
|
||||
bits = FLAC__bitmath_ilog2_wide(err)+1;
|
||||
if(bits > 16) {
|
||||
err >>= (bits-16);
|
||||
fracbits -= (bits-16);
|
||||
}
|
||||
rbps = (FLAC__uint32)err;
|
||||
|
||||
/* Multiply by fixed-point version of ln(2), with 16 fractional bits */
|
||||
rbps *= FLAC__FP_LN2;
|
||||
fracbits += 16;
|
||||
FLAC__ASSERT(fracbits >= 0);
|
||||
|
||||
/* FLAC__fixedpoint_log2 requires fracbits%4 to be 0 */
|
||||
{
|
||||
const int f = fracbits & 3;
|
||||
if(f) {
|
||||
rbps >>= f;
|
||||
fracbits -= f;
|
||||
}
|
||||
}
|
||||
|
||||
rbps = FLAC__fixedpoint_log2(rbps, fracbits, (unsigned)(-1));
|
||||
|
||||
if(rbps == 0)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* The return value must have 16 fractional bits. Since the whole part
|
||||
* of the base-2 log of a 32 bit number must fit in 5 bits, and fracbits
|
||||
* must be >= -3, these assertion allows us to be able to shift rbps
|
||||
* left if necessary to get 16 fracbits without losing any bits of the
|
||||
* whole part of rbps.
|
||||
*
|
||||
* There is a slight chance due to accumulated error that the whole part
|
||||
* will require 6 bits, so we use 6 in the assertion. Really though as
|
||||
* long as it fits in 13 bits (32 - (16 - (-3))) we are fine.
|
||||
*/
|
||||
FLAC__ASSERT((int)FLAC__bitmath_ilog2(rbps)+1 <= fracbits + 6);
|
||||
FLAC__ASSERT(fracbits >= -3);
|
||||
|
||||
/* now shift the decimal point into place */
|
||||
if(fracbits < 16)
|
||||
return rbps << (16-fracbits);
|
||||
else if(fracbits > 16)
|
||||
return rbps >> (fracbits-16);
|
||||
else
|
||||
return rbps;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
|
||||
#else
|
||||
unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
|
||||
#endif
|
||||
{
|
||||
FLAC__int32 last_error_0 = data[-1];
|
||||
FLAC__int32 last_error_1 = data[-1] - data[-2];
|
||||
FLAC__int32 last_error_2 = last_error_1 - (data[-2] - data[-3]);
|
||||
FLAC__int32 last_error_3 = last_error_2 - (data[-2] - 2*data[-3] + data[-4]);
|
||||
FLAC__int32 error, save;
|
||||
FLAC__uint32 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0;
|
||||
unsigned i, order;
|
||||
|
||||
for(i = 0; i < data_len; i++) {
|
||||
error = data[i] ; total_error_0 += local_abs(error); save = error;
|
||||
error -= last_error_0; total_error_1 += local_abs(error); last_error_0 = save; save = error;
|
||||
error -= last_error_1; total_error_2 += local_abs(error); last_error_1 = save; save = error;
|
||||
error -= last_error_2; total_error_3 += local_abs(error); last_error_2 = save; save = error;
|
||||
error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save;
|
||||
}
|
||||
|
||||
if(total_error_0 < min(min(min(total_error_1, total_error_2), total_error_3), total_error_4))
|
||||
order = 0;
|
||||
else if(total_error_1 < min(min(total_error_2, total_error_3), total_error_4))
|
||||
order = 1;
|
||||
else if(total_error_2 < min(total_error_3, total_error_4))
|
||||
order = 2;
|
||||
else if(total_error_3 < total_error_4)
|
||||
order = 3;
|
||||
else
|
||||
order = 4;
|
||||
|
||||
/* Estimate the expected number of bits per residual signal sample. */
|
||||
/* 'total_error*' is linearly related to the variance of the residual */
|
||||
/* signal, so we use it directly to compute E(|x|) */
|
||||
FLAC__ASSERT(data_len > 0 || total_error_0 == 0);
|
||||
FLAC__ASSERT(data_len > 0 || total_error_1 == 0);
|
||||
FLAC__ASSERT(data_len > 0 || total_error_2 == 0);
|
||||
FLAC__ASSERT(data_len > 0 || total_error_3 == 0);
|
||||
FLAC__ASSERT(data_len > 0 || total_error_4 == 0);
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
#else
|
||||
residual_bits_per_sample[0] = (total_error_0 > 0) ? local__compute_rbps_integerized(total_error_0, data_len) : 0;
|
||||
residual_bits_per_sample[1] = (total_error_1 > 0) ? local__compute_rbps_integerized(total_error_1, data_len) : 0;
|
||||
residual_bits_per_sample[2] = (total_error_2 > 0) ? local__compute_rbps_integerized(total_error_2, data_len) : 0;
|
||||
residual_bits_per_sample[3] = (total_error_3 > 0) ? local__compute_rbps_integerized(total_error_3, data_len) : 0;
|
||||
residual_bits_per_sample[4] = (total_error_4 > 0) ? local__compute_rbps_integerized(total_error_4, data_len) : 0;
|
||||
#endif
|
||||
|
||||
return order;
|
||||
}
|
||||
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
|
||||
#else
|
||||
unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
|
||||
#endif
|
||||
{
|
||||
FLAC__int32 last_error_0 = data[-1];
|
||||
FLAC__int32 last_error_1 = data[-1] - data[-2];
|
||||
FLAC__int32 last_error_2 = last_error_1 - (data[-2] - data[-3]);
|
||||
FLAC__int32 last_error_3 = last_error_2 - (data[-2] - 2*data[-3] + data[-4]);
|
||||
FLAC__int32 error, save;
|
||||
/* total_error_* are 64-bits to avoid overflow when encoding
|
||||
* erratic signals when the bits-per-sample and blocksize are
|
||||
* large.
|
||||
*/
|
||||
FLAC__uint64 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0;
|
||||
unsigned i, order;
|
||||
|
||||
for(i = 0; i < data_len; i++) {
|
||||
error = data[i] ; total_error_0 += local_abs(error); save = error;
|
||||
error -= last_error_0; total_error_1 += local_abs(error); last_error_0 = save; save = error;
|
||||
error -= last_error_1; total_error_2 += local_abs(error); last_error_1 = save; save = error;
|
||||
error -= last_error_2; total_error_3 += local_abs(error); last_error_2 = save; save = error;
|
||||
error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save;
|
||||
}
|
||||
|
||||
if(total_error_0 < min(min(min(total_error_1, total_error_2), total_error_3), total_error_4))
|
||||
order = 0;
|
||||
else if(total_error_1 < min(min(total_error_2, total_error_3), total_error_4))
|
||||
order = 1;
|
||||
else if(total_error_2 < min(total_error_3, total_error_4))
|
||||
order = 2;
|
||||
else if(total_error_3 < total_error_4)
|
||||
order = 3;
|
||||
else
|
||||
order = 4;
|
||||
|
||||
/* Estimate the expected number of bits per residual signal sample. */
|
||||
/* 'total_error*' is linearly related to the variance of the residual */
|
||||
/* signal, so we use it directly to compute E(|x|) */
|
||||
FLAC__ASSERT(data_len > 0 || total_error_0 == 0);
|
||||
FLAC__ASSERT(data_len > 0 || total_error_1 == 0);
|
||||
FLAC__ASSERT(data_len > 0 || total_error_2 == 0);
|
||||
FLAC__ASSERT(data_len > 0 || total_error_3 == 0);
|
||||
FLAC__ASSERT(data_len > 0 || total_error_4 == 0);
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
#if defined _MSC_VER || defined __MINGW32__
|
||||
/* with MSVC you have to spoon feed it the casting */
|
||||
residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
#else
|
||||
residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
#endif
|
||||
#else
|
||||
residual_bits_per_sample[0] = (total_error_0 > 0) ? local__compute_rbps_wide_integerized(total_error_0, data_len) : 0;
|
||||
residual_bits_per_sample[1] = (total_error_1 > 0) ? local__compute_rbps_wide_integerized(total_error_1, data_len) : 0;
|
||||
residual_bits_per_sample[2] = (total_error_2 > 0) ? local__compute_rbps_wide_integerized(total_error_2, data_len) : 0;
|
||||
residual_bits_per_sample[3] = (total_error_3 > 0) ? local__compute_rbps_wide_integerized(total_error_3, data_len) : 0;
|
||||
residual_bits_per_sample[4] = (total_error_4 > 0) ? local__compute_rbps_wide_integerized(total_error_4, data_len) : 0;
|
||||
#endif
|
||||
|
||||
return order;
|
||||
}
|
||||
|
||||
void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, unsigned order, FLAC__int32 residual[])
|
||||
{
|
||||
const int idata_len = (int)data_len;
|
||||
int i;
|
||||
|
||||
switch(order) {
|
||||
case 0:
|
||||
FLAC__ASSERT(sizeof(residual[0]) == sizeof(data[0]));
|
||||
memcpy(residual, data, sizeof(residual[0])*data_len);
|
||||
break;
|
||||
case 1:
|
||||
for(i = 0; i < idata_len; i++)
|
||||
residual[i] = data[i] - data[i-1];
|
||||
break;
|
||||
case 2:
|
||||
for(i = 0; i < idata_len; i++)
|
||||
#if 1 /* OPT: may be faster with some compilers on some systems */
|
||||
residual[i] = data[i] - (data[i-1] << 1) + data[i-2];
|
||||
#else
|
||||
residual[i] = data[i] - 2*data[i-1] + data[i-2];
|
||||
#endif
|
||||
break;
|
||||
case 3:
|
||||
for(i = 0; i < idata_len; i++)
|
||||
#if 1 /* OPT: may be faster with some compilers on some systems */
|
||||
residual[i] = data[i] - (((data[i-1]-data[i-2])<<1) + (data[i-1]-data[i-2])) - data[i-3];
|
||||
#else
|
||||
residual[i] = data[i] - 3*data[i-1] + 3*data[i-2] - data[i-3];
|
||||
#endif
|
||||
break;
|
||||
case 4:
|
||||
for(i = 0; i < idata_len; i++)
|
||||
#if 1 /* OPT: may be faster with some compilers on some systems */
|
||||
residual[i] = data[i] - ((data[i-1]+data[i-3])<<2) + ((data[i-2]<<2) + (data[i-2]<<1)) + data[i-4];
|
||||
#else
|
||||
residual[i] = data[i] - 4*data[i-1] + 6*data[i-2] - 4*data[i-3] + data[i-4];
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
void FLAC__fixed_restore_signal(const FLAC__int32 residual[], unsigned data_len, unsigned order, FLAC__int32 data[])
|
||||
{
|
||||
int i, idata_len = (int)data_len;
|
||||
|
||||
switch(order) {
|
||||
case 0:
|
||||
FLAC__ASSERT(sizeof(residual[0]) == sizeof(data[0]));
|
||||
memcpy(data, residual, sizeof(residual[0])*data_len);
|
||||
break;
|
||||
case 1:
|
||||
for(i = 0; i < idata_len; i++)
|
||||
data[i] = residual[i] + data[i-1];
|
||||
break;
|
||||
case 2:
|
||||
for(i = 0; i < idata_len; i++)
|
||||
#if 1 /* OPT: may be faster with some compilers on some systems */
|
||||
data[i] = residual[i] + (data[i-1]<<1) - data[i-2];
|
||||
#else
|
||||
data[i] = residual[i] + 2*data[i-1] - data[i-2];
|
||||
#endif
|
||||
break;
|
||||
case 3:
|
||||
for(i = 0; i < idata_len; i++)
|
||||
#if 1 /* OPT: may be faster with some compilers on some systems */
|
||||
data[i] = residual[i] + (((data[i-1]-data[i-2])<<1) + (data[i-1]-data[i-2])) + data[i-3];
|
||||
#else
|
||||
data[i] = residual[i] + 3*data[i-1] - 3*data[i-2] + data[i-3];
|
||||
#endif
|
||||
break;
|
||||
case 4:
|
||||
for(i = 0; i < idata_len; i++)
|
||||
#if 1 /* OPT: may be faster with some compilers on some systems */
|
||||
data[i] = residual[i] + ((data[i-1]+data[i-3])<<2) - ((data[i-2]<<2) + (data[i-2]<<1)) - data[i-4];
|
||||
#else
|
||||
data[i] = residual[i] + 4*data[i-1] - 6*data[i-2] + 4*data[i-3] - data[i-4];
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
}
|
||||
10
flac/src/libFLAC/flac.pc.in
Normal file
10
flac/src/libFLAC/flac.pc.in
Normal file
@@ -0,0 +1,10 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: FLAC
|
||||
Description: Free Lossless Audio Codec Library
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lFLAC -lm
|
||||
Cflags: -I${includedir}/FLAC
|
||||
308
flac/src/libFLAC/float.c
Normal file
308
flac/src/libFLAC/float.c
Normal file
@@ -0,0 +1,308 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "FLAC/assert.h"
|
||||
|
||||
#include "private/float.h"
|
||||
|
||||
#ifdef FLAC__INTEGER_ONLY_LIBRARY
|
||||
|
||||
/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */
|
||||
#ifdef _MSC_VER
|
||||
#define FLAC__U64L(x) x
|
||||
#else
|
||||
#define FLAC__U64L(x) x##LLU
|
||||
#endif
|
||||
|
||||
const FLAC__fixedpoint FLAC__FP_ZERO = 0;
|
||||
const FLAC__fixedpoint FLAC__FP_ONE_HALF = 0x00008000;
|
||||
const FLAC__fixedpoint FLAC__FP_ONE = 0x00010000;
|
||||
const FLAC__fixedpoint FLAC__FP_LN2 = 45426;
|
||||
const FLAC__fixedpoint FLAC__FP_E = 178145;
|
||||
|
||||
/* Lookup tables for Knuth's logarithm algorithm */
|
||||
#define LOG2_LOOKUP_PRECISION 16
|
||||
static const FLAC__uint32 log2_lookup[][LOG2_LOOKUP_PRECISION] = {
|
||||
{
|
||||
/*
|
||||
* 0 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ 0x00000001,
|
||||
/* lg(4/3) = */ 0x00000000,
|
||||
/* lg(8/7) = */ 0x00000000,
|
||||
/* lg(16/15) = */ 0x00000000,
|
||||
/* lg(32/31) = */ 0x00000000,
|
||||
/* lg(64/63) = */ 0x00000000,
|
||||
/* lg(128/127) = */ 0x00000000,
|
||||
/* lg(256/255) = */ 0x00000000,
|
||||
/* lg(512/511) = */ 0x00000000,
|
||||
/* lg(1024/1023) = */ 0x00000000,
|
||||
/* lg(2048/2047) = */ 0x00000000,
|
||||
/* lg(4096/4095) = */ 0x00000000,
|
||||
/* lg(8192/8191) = */ 0x00000000,
|
||||
/* lg(16384/16383) = */ 0x00000000,
|
||||
/* lg(32768/32767) = */ 0x00000000
|
||||
},
|
||||
{
|
||||
/*
|
||||
* 4 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ 0x00000010,
|
||||
/* lg(4/3) = */ 0x00000007,
|
||||
/* lg(8/7) = */ 0x00000003,
|
||||
/* lg(16/15) = */ 0x00000001,
|
||||
/* lg(32/31) = */ 0x00000001,
|
||||
/* lg(64/63) = */ 0x00000000,
|
||||
/* lg(128/127) = */ 0x00000000,
|
||||
/* lg(256/255) = */ 0x00000000,
|
||||
/* lg(512/511) = */ 0x00000000,
|
||||
/* lg(1024/1023) = */ 0x00000000,
|
||||
/* lg(2048/2047) = */ 0x00000000,
|
||||
/* lg(4096/4095) = */ 0x00000000,
|
||||
/* lg(8192/8191) = */ 0x00000000,
|
||||
/* lg(16384/16383) = */ 0x00000000,
|
||||
/* lg(32768/32767) = */ 0x00000000
|
||||
},
|
||||
{
|
||||
/*
|
||||
* 8 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ 0x00000100,
|
||||
/* lg(4/3) = */ 0x0000006a,
|
||||
/* lg(8/7) = */ 0x00000031,
|
||||
/* lg(16/15) = */ 0x00000018,
|
||||
/* lg(32/31) = */ 0x0000000c,
|
||||
/* lg(64/63) = */ 0x00000006,
|
||||
/* lg(128/127) = */ 0x00000003,
|
||||
/* lg(256/255) = */ 0x00000001,
|
||||
/* lg(512/511) = */ 0x00000001,
|
||||
/* lg(1024/1023) = */ 0x00000000,
|
||||
/* lg(2048/2047) = */ 0x00000000,
|
||||
/* lg(4096/4095) = */ 0x00000000,
|
||||
/* lg(8192/8191) = */ 0x00000000,
|
||||
/* lg(16384/16383) = */ 0x00000000,
|
||||
/* lg(32768/32767) = */ 0x00000000
|
||||
},
|
||||
{
|
||||
/*
|
||||
* 12 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ 0x00001000,
|
||||
/* lg(4/3) = */ 0x000006a4,
|
||||
/* lg(8/7) = */ 0x00000315,
|
||||
/* lg(16/15) = */ 0x0000017d,
|
||||
/* lg(32/31) = */ 0x000000bc,
|
||||
/* lg(64/63) = */ 0x0000005d,
|
||||
/* lg(128/127) = */ 0x0000002e,
|
||||
/* lg(256/255) = */ 0x00000017,
|
||||
/* lg(512/511) = */ 0x0000000c,
|
||||
/* lg(1024/1023) = */ 0x00000006,
|
||||
/* lg(2048/2047) = */ 0x00000003,
|
||||
/* lg(4096/4095) = */ 0x00000001,
|
||||
/* lg(8192/8191) = */ 0x00000001,
|
||||
/* lg(16384/16383) = */ 0x00000000,
|
||||
/* lg(32768/32767) = */ 0x00000000
|
||||
},
|
||||
{
|
||||
/*
|
||||
* 16 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ 0x00010000,
|
||||
/* lg(4/3) = */ 0x00006a40,
|
||||
/* lg(8/7) = */ 0x00003151,
|
||||
/* lg(16/15) = */ 0x000017d6,
|
||||
/* lg(32/31) = */ 0x00000bba,
|
||||
/* lg(64/63) = */ 0x000005d1,
|
||||
/* lg(128/127) = */ 0x000002e6,
|
||||
/* lg(256/255) = */ 0x00000172,
|
||||
/* lg(512/511) = */ 0x000000b9,
|
||||
/* lg(1024/1023) = */ 0x0000005c,
|
||||
/* lg(2048/2047) = */ 0x0000002e,
|
||||
/* lg(4096/4095) = */ 0x00000017,
|
||||
/* lg(8192/8191) = */ 0x0000000c,
|
||||
/* lg(16384/16383) = */ 0x00000006,
|
||||
/* lg(32768/32767) = */ 0x00000003
|
||||
},
|
||||
{
|
||||
/*
|
||||
* 20 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ 0x00100000,
|
||||
/* lg(4/3) = */ 0x0006a3fe,
|
||||
/* lg(8/7) = */ 0x00031513,
|
||||
/* lg(16/15) = */ 0x00017d60,
|
||||
/* lg(32/31) = */ 0x0000bb9d,
|
||||
/* lg(64/63) = */ 0x00005d10,
|
||||
/* lg(128/127) = */ 0x00002e59,
|
||||
/* lg(256/255) = */ 0x00001721,
|
||||
/* lg(512/511) = */ 0x00000b8e,
|
||||
/* lg(1024/1023) = */ 0x000005c6,
|
||||
/* lg(2048/2047) = */ 0x000002e3,
|
||||
/* lg(4096/4095) = */ 0x00000171,
|
||||
/* lg(8192/8191) = */ 0x000000b9,
|
||||
/* lg(16384/16383) = */ 0x0000005c,
|
||||
/* lg(32768/32767) = */ 0x0000002e
|
||||
},
|
||||
{
|
||||
/*
|
||||
* 24 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ 0x01000000,
|
||||
/* lg(4/3) = */ 0x006a3fe6,
|
||||
/* lg(8/7) = */ 0x00315130,
|
||||
/* lg(16/15) = */ 0x0017d605,
|
||||
/* lg(32/31) = */ 0x000bb9ca,
|
||||
/* lg(64/63) = */ 0x0005d0fc,
|
||||
/* lg(128/127) = */ 0x0002e58f,
|
||||
/* lg(256/255) = */ 0x0001720e,
|
||||
/* lg(512/511) = */ 0x0000b8d8,
|
||||
/* lg(1024/1023) = */ 0x00005c61,
|
||||
/* lg(2048/2047) = */ 0x00002e2d,
|
||||
/* lg(4096/4095) = */ 0x00001716,
|
||||
/* lg(8192/8191) = */ 0x00000b8b,
|
||||
/* lg(16384/16383) = */ 0x000005c5,
|
||||
/* lg(32768/32767) = */ 0x000002e3
|
||||
},
|
||||
{
|
||||
/*
|
||||
* 28 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ 0x10000000,
|
||||
/* lg(4/3) = */ 0x06a3fe5c,
|
||||
/* lg(8/7) = */ 0x03151301,
|
||||
/* lg(16/15) = */ 0x017d6049,
|
||||
/* lg(32/31) = */ 0x00bb9ca6,
|
||||
/* lg(64/63) = */ 0x005d0fba,
|
||||
/* lg(128/127) = */ 0x002e58f7,
|
||||
/* lg(256/255) = */ 0x001720da,
|
||||
/* lg(512/511) = */ 0x000b8d87,
|
||||
/* lg(1024/1023) = */ 0x0005c60b,
|
||||
/* lg(2048/2047) = */ 0x0002e2d7,
|
||||
/* lg(4096/4095) = */ 0x00017160,
|
||||
/* lg(8192/8191) = */ 0x0000b8ad,
|
||||
/* lg(16384/16383) = */ 0x00005c56,
|
||||
/* lg(32768/32767) = */ 0x00002e2b
|
||||
}
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const FLAC__uint64 log2_lookup_wide[] = {
|
||||
{
|
||||
/*
|
||||
* 32 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ FLAC__U64L(0x100000000),
|
||||
/* lg(4/3) = */ FLAC__U64L(0x6a3fe5c6),
|
||||
/* lg(8/7) = */ FLAC__U64L(0x31513015),
|
||||
/* lg(16/15) = */ FLAC__U64L(0x17d60497),
|
||||
/* lg(32/31) = */ FLAC__U64L(0x0bb9ca65),
|
||||
/* lg(64/63) = */ FLAC__U64L(0x05d0fba2),
|
||||
/* lg(128/127) = */ FLAC__U64L(0x02e58f74),
|
||||
/* lg(256/255) = */ FLAC__U64L(0x01720d9c),
|
||||
/* lg(512/511) = */ FLAC__U64L(0x00b8d875),
|
||||
/* lg(1024/1023) = */ FLAC__U64L(0x005c60aa),
|
||||
/* lg(2048/2047) = */ FLAC__U64L(0x002e2d72),
|
||||
/* lg(4096/4095) = */ FLAC__U64L(0x00171600),
|
||||
/* lg(8192/8191) = */ FLAC__U64L(0x000b8ad2),
|
||||
/* lg(16384/16383) = */ FLAC__U64L(0x0005c55d),
|
||||
/* lg(32768/32767) = */ FLAC__U64L(0x0002e2ac)
|
||||
},
|
||||
{
|
||||
/*
|
||||
* 48 fraction bits
|
||||
*/
|
||||
/* undefined */ 0x00000000,
|
||||
/* lg(2/1) = */ FLAC__U64L(0x1000000000000),
|
||||
/* lg(4/3) = */ FLAC__U64L(0x6a3fe5c60429),
|
||||
/* lg(8/7) = */ FLAC__U64L(0x315130157f7a),
|
||||
/* lg(16/15) = */ FLAC__U64L(0x17d60496cfbb),
|
||||
/* lg(32/31) = */ FLAC__U64L(0xbb9ca64ecac),
|
||||
/* lg(64/63) = */ FLAC__U64L(0x5d0fba187cd),
|
||||
/* lg(128/127) = */ FLAC__U64L(0x2e58f7441ee),
|
||||
/* lg(256/255) = */ FLAC__U64L(0x1720d9c06a8),
|
||||
/* lg(512/511) = */ FLAC__U64L(0xb8d8752173),
|
||||
/* lg(1024/1023) = */ FLAC__U64L(0x5c60aa252e),
|
||||
/* lg(2048/2047) = */ FLAC__U64L(0x2e2d71b0d8),
|
||||
/* lg(4096/4095) = */ FLAC__U64L(0x1716001719),
|
||||
/* lg(8192/8191) = */ FLAC__U64L(0xb8ad1de1b),
|
||||
/* lg(16384/16383) = */ FLAC__U64L(0x5c55d640d),
|
||||
/* lg(32768/32767) = */ FLAC__U64L(0x2e2abcf52)
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, unsigned fracbits, unsigned precision)
|
||||
{
|
||||
const FLAC__uint32 ONE = (1u << fracbits);
|
||||
const FLAC__uint32 *table = log2_lookup[fracbits >> 2];
|
||||
|
||||
FLAC__ASSERT(fracbits < 32);
|
||||
FLAC__ASSERT((fracbits & 0x3) == 0);
|
||||
|
||||
if(x < ONE)
|
||||
return 0;
|
||||
|
||||
if(precision > LOG2_LOOKUP_PRECISION)
|
||||
precision = LOG2_LOOKUP_PRECISION;
|
||||
|
||||
/* Knuth's algorithm for computing logarithms, optimized for base-2 with lookup tables */
|
||||
{
|
||||
FLAC__uint32 y = 0;
|
||||
FLAC__uint32 z = x >> 1, k = 1;
|
||||
while (x > ONE && k < precision) {
|
||||
if (x - z >= ONE) {
|
||||
x -= z;
|
||||
z = x >> k;
|
||||
y += table[k];
|
||||
}
|
||||
else {
|
||||
z >>= 1;
|
||||
k++;
|
||||
}
|
||||
}
|
||||
return y;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* defined FLAC__INTEGER_ONLY_LIBRARY */
|
||||
603
flac/src/libFLAC/format.c
Normal file
603
flac/src/libFLAC/format.c
Normal file
@@ -0,0 +1,603 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> /* for qsort() */
|
||||
#include <string.h> /* for memset() */
|
||||
#include "FLAC/assert.h"
|
||||
#include "FLAC/format.h"
|
||||
#include "private/format.h"
|
||||
|
||||
#ifndef FLaC__INLINE
|
||||
#define FLaC__INLINE
|
||||
#endif
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
|
||||
/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */
|
||||
#ifdef _MSC_VER
|
||||
#define FLAC__U64L(x) x
|
||||
#else
|
||||
#define FLAC__U64L(x) x##LLU
|
||||
#endif
|
||||
|
||||
/* VERSION should come from configure */
|
||||
FLAC_API const char *FLAC__VERSION_STRING = VERSION;
|
||||
|
||||
#if defined _MSC_VER || defined __BORLANDC__ || defined __MINW32__
|
||||
/* yet one more hack because of MSVC6: */
|
||||
FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC 1.2.1 20070917";
|
||||
#else
|
||||
FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC " VERSION " 20070917";
|
||||
#endif
|
||||
|
||||
FLAC_API const FLAC__byte FLAC__STREAM_SYNC_STRING[4] = { 'f','L','a','C' };
|
||||
FLAC_API const unsigned FLAC__STREAM_SYNC = 0x664C6143;
|
||||
FLAC_API const unsigned FLAC__STREAM_SYNC_LEN = 32; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN = 16; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN = 16; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN = 24; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN = 24; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN = 20; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN = 3; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN = 5; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN = 36; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN = 128; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_APPLICATION_ID_LEN = 32; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN = 64; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN = 64; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN = 16; /* bits */
|
||||
|
||||
FLAC_API const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER = FLAC__U64L(0xffffffffffffffff);
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN = 32; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN = 32; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN = 64; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN = 8; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN = 3*8; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN = 64; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN = 8; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN = 12*8; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN = 1; /* bit */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN = 1; /* bit */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN = 6+13*8; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN = 8; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN = 128*8; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN = 64; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN = 1; /* bit */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN = 7+258*8; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN = 8; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_TYPE_LEN = 32; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN = 32; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN = 32; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN = 32; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN = 32; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN = 32; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_COLORS_LEN = 32; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN = 32; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN = 1; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_TYPE_LEN = 7; /* bits */
|
||||
FLAC_API const unsigned FLAC__STREAM_METADATA_LENGTH_LEN = 24; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC = 0x3ffe;
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC_LEN = 14; /* bits */
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_RESERVED_LEN = 1; /* bits */
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN = 1; /* bits */
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCK_SIZE_LEN = 4; /* bits */
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_SAMPLE_RATE_LEN = 4; /* bits */
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN = 4; /* bits */
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN = 3; /* bits */
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_ZERO_PAD_LEN = 1; /* bits */
|
||||
FLAC_API const unsigned FLAC__FRAME_HEADER_CRC_LEN = 8; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__FRAME_FOOTER_CRC_LEN = 16; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_TYPE_LEN = 2; /* bits */
|
||||
FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN = 4; /* bits */
|
||||
FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN = 4; /* bits */
|
||||
FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN = 5; /* bits */
|
||||
FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN = 5; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER = 15; /* == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1 */
|
||||
FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER = 31; /* == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN)-1 */
|
||||
|
||||
FLAC_API const char * const FLAC__EntropyCodingMethodTypeString[] = {
|
||||
"PARTITIONED_RICE",
|
||||
"PARTITIONED_RICE2"
|
||||
};
|
||||
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN = 4; /* bits */
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN = 5; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_ZERO_PAD_LEN = 1; /* bits */
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LEN = 6; /* bits */
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN = 1; /* bits */
|
||||
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK = 0x00;
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK = 0x02;
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK = 0x10;
|
||||
FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK = 0x40;
|
||||
|
||||
FLAC_API const char * const FLAC__SubframeTypeString[] = {
|
||||
"CONSTANT",
|
||||
"VERBATIM",
|
||||
"FIXED",
|
||||
"LPC"
|
||||
};
|
||||
|
||||
FLAC_API const char * const FLAC__ChannelAssignmentString[] = {
|
||||
"INDEPENDENT",
|
||||
"LEFT_SIDE",
|
||||
"RIGHT_SIDE",
|
||||
"MID_SIDE"
|
||||
};
|
||||
|
||||
FLAC_API const char * const FLAC__FrameNumberTypeString[] = {
|
||||
"FRAME_NUMBER_TYPE_FRAME_NUMBER",
|
||||
"FRAME_NUMBER_TYPE_SAMPLE_NUMBER"
|
||||
};
|
||||
|
||||
FLAC_API const char * const FLAC__MetadataTypeString[] = {
|
||||
"STREAMINFO",
|
||||
"PADDING",
|
||||
"APPLICATION",
|
||||
"SEEKTABLE",
|
||||
"VORBIS_COMMENT",
|
||||
"CUESHEET",
|
||||
"PICTURE"
|
||||
};
|
||||
|
||||
FLAC_API const char * const FLAC__StreamMetadata_Picture_TypeString[] = {
|
||||
"Other",
|
||||
"32x32 pixels 'file icon' (PNG only)",
|
||||
"Other file icon",
|
||||
"Cover (front)",
|
||||
"Cover (back)",
|
||||
"Leaflet page",
|
||||
"Media (e.g. label side of CD)",
|
||||
"Lead artist/lead performer/soloist",
|
||||
"Artist/performer",
|
||||
"Conductor",
|
||||
"Band/Orchestra",
|
||||
"Composer",
|
||||
"Lyricist/text writer",
|
||||
"Recording Location",
|
||||
"During recording",
|
||||
"During performance",
|
||||
"Movie/video screen capture",
|
||||
"A bright coloured fish",
|
||||
"Illustration",
|
||||
"Band/artist logotype",
|
||||
"Publisher/Studio logotype"
|
||||
};
|
||||
|
||||
FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(unsigned sample_rate)
|
||||
{
|
||||
if(sample_rate == 0 || sample_rate > FLAC__MAX_SAMPLE_RATE) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC_API FLAC__bool FLAC__format_blocksize_is_subset(unsigned blocksize, unsigned sample_rate)
|
||||
{
|
||||
if(blocksize > 16384)
|
||||
return false;
|
||||
else if(sample_rate <= 48000 && blocksize > 4608)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(unsigned sample_rate)
|
||||
{
|
||||
if(
|
||||
!FLAC__format_sample_rate_is_valid(sample_rate) ||
|
||||
(
|
||||
sample_rate >= (1u << 16) &&
|
||||
!(sample_rate % 1000 == 0 || sample_rate % 10 == 0)
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
|
||||
FLAC_API FLAC__bool FLAC__format_seektable_is_legal(const FLAC__StreamMetadata_SeekTable *seek_table)
|
||||
{
|
||||
unsigned i;
|
||||
FLAC__uint64 prev_sample_number = 0;
|
||||
FLAC__bool got_prev = false;
|
||||
|
||||
FLAC__ASSERT(0 != seek_table);
|
||||
|
||||
for(i = 0; i < seek_table->num_points; i++) {
|
||||
if(got_prev) {
|
||||
if(
|
||||
seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER &&
|
||||
seek_table->points[i].sample_number <= prev_sample_number
|
||||
)
|
||||
return false;
|
||||
}
|
||||
prev_sample_number = seek_table->points[i].sample_number;
|
||||
got_prev = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* used as the sort predicate for qsort() */
|
||||
static int seekpoint_compare_(const FLAC__StreamMetadata_SeekPoint *l, const FLAC__StreamMetadata_SeekPoint *r)
|
||||
{
|
||||
/* we don't just 'return l->sample_number - r->sample_number' since the result (FLAC__int64) might overflow an 'int' */
|
||||
if(l->sample_number == r->sample_number)
|
||||
return 0;
|
||||
else if(l->sample_number < r->sample_number)
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
|
||||
FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table)
|
||||
{
|
||||
unsigned i, j;
|
||||
FLAC__bool first;
|
||||
|
||||
FLAC__ASSERT(0 != seek_table);
|
||||
|
||||
/* sort the seekpoints */
|
||||
qsort(seek_table->points, seek_table->num_points, sizeof(FLAC__StreamMetadata_SeekPoint), (int (*)(const void *, const void *))seekpoint_compare_);
|
||||
|
||||
/* uniquify the seekpoints */
|
||||
first = true;
|
||||
for(i = j = 0; i < seek_table->num_points; i++) {
|
||||
if(seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER) {
|
||||
if(!first) {
|
||||
if(seek_table->points[i].sample_number == seek_table->points[j-1].sample_number)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
first = false;
|
||||
seek_table->points[j++] = seek_table->points[i];
|
||||
}
|
||||
|
||||
for(i = j; i < seek_table->num_points; i++) {
|
||||
seek_table->points[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
|
||||
seek_table->points[i].stream_offset = 0;
|
||||
seek_table->points[i].frame_samples = 0;
|
||||
}
|
||||
|
||||
return j;
|
||||
}
|
||||
|
||||
/*
|
||||
* also disallows non-shortest-form encodings, c.f.
|
||||
* http://www.unicode.org/versions/corrigendum1.html
|
||||
* and a more clear explanation at the end of this section:
|
||||
* http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
*/
|
||||
static FLaC__INLINE unsigned utf8len_(const FLAC__byte *utf8)
|
||||
{
|
||||
FLAC__ASSERT(0 != utf8);
|
||||
if ((utf8[0] & 0x80) == 0) {
|
||||
return 1;
|
||||
}
|
||||
else if ((utf8[0] & 0xE0) == 0xC0 && (utf8[1] & 0xC0) == 0x80) {
|
||||
if ((utf8[0] & 0xFE) == 0xC0) /* overlong sequence check */
|
||||
return 0;
|
||||
return 2;
|
||||
}
|
||||
else if ((utf8[0] & 0xF0) == 0xE0 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80) {
|
||||
if (utf8[0] == 0xE0 && (utf8[1] & 0xE0) == 0x80) /* overlong sequence check */
|
||||
return 0;
|
||||
/* illegal surrogates check (U+D800...U+DFFF and U+FFFE...U+FFFF) */
|
||||
if (utf8[0] == 0xED && (utf8[1] & 0xE0) == 0xA0) /* D800-DFFF */
|
||||
return 0;
|
||||
if (utf8[0] == 0xEF && utf8[1] == 0xBF && (utf8[2] & 0xFE) == 0xBE) /* FFFE-FFFF */
|
||||
return 0;
|
||||
return 3;
|
||||
}
|
||||
else if ((utf8[0] & 0xF8) == 0xF0 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80) {
|
||||
if (utf8[0] == 0xF0 && (utf8[1] & 0xF0) == 0x80) /* overlong sequence check */
|
||||
return 0;
|
||||
return 4;
|
||||
}
|
||||
else if ((utf8[0] & 0xFC) == 0xF8 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80 && (utf8[4] & 0xC0) == 0x80) {
|
||||
if (utf8[0] == 0xF8 && (utf8[1] & 0xF8) == 0x80) /* overlong sequence check */
|
||||
return 0;
|
||||
return 5;
|
||||
}
|
||||
else if ((utf8[0] & 0xFE) == 0xFC && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80 && (utf8[4] & 0xC0) == 0x80 && (utf8[5] & 0xC0) == 0x80) {
|
||||
if (utf8[0] == 0xFC && (utf8[1] & 0xFC) == 0x80) /* overlong sequence check */
|
||||
return 0;
|
||||
return 6;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_name_is_legal(const char *name)
|
||||
{
|
||||
char c;
|
||||
for(c = *name; c; c = *(++name))
|
||||
if(c < 0x20 || c == 0x3d || c > 0x7d)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, unsigned length)
|
||||
{
|
||||
if(length == (unsigned)(-1)) {
|
||||
while(*value) {
|
||||
unsigned n = utf8len_(value);
|
||||
if(n == 0)
|
||||
return false;
|
||||
value += n;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const FLAC__byte *end = value + length;
|
||||
while(value < end) {
|
||||
unsigned n = utf8len_(value);
|
||||
if(n == 0)
|
||||
return false;
|
||||
value += n;
|
||||
}
|
||||
if(value != end)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, unsigned length)
|
||||
{
|
||||
const FLAC__byte *s, *end;
|
||||
|
||||
for(s = entry, end = s + length; s < end && *s != '='; s++) {
|
||||
if(*s < 0x20 || *s > 0x7D)
|
||||
return false;
|
||||
}
|
||||
if(s == end)
|
||||
return false;
|
||||
|
||||
s++; /* skip '=' */
|
||||
|
||||
while(s < end) {
|
||||
unsigned n = utf8len_(s);
|
||||
if(n == 0)
|
||||
return false;
|
||||
s += n;
|
||||
}
|
||||
if(s != end)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
|
||||
FLAC_API FLAC__bool FLAC__format_cuesheet_is_legal(const FLAC__StreamMetadata_CueSheet *cue_sheet, FLAC__bool check_cd_da_subset, const char **violation)
|
||||
{
|
||||
unsigned i, j;
|
||||
|
||||
if(check_cd_da_subset) {
|
||||
if(cue_sheet->lead_in < 2 * 44100) {
|
||||
if(violation) *violation = "CD-DA cue sheet must have a lead-in length of at least 2 seconds";
|
||||
return false;
|
||||
}
|
||||
if(cue_sheet->lead_in % 588 != 0) {
|
||||
if(violation) *violation = "CD-DA cue sheet lead-in length must be evenly divisible by 588 samples";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(cue_sheet->num_tracks == 0) {
|
||||
if(violation) *violation = "cue sheet must have at least one track (the lead-out)";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(check_cd_da_subset && cue_sheet->tracks[cue_sheet->num_tracks-1].number != 170) {
|
||||
if(violation) *violation = "CD-DA cue sheet must have a lead-out track number 170 (0xAA)";
|
||||
return false;
|
||||
}
|
||||
|
||||
for(i = 0; i < cue_sheet->num_tracks; i++) {
|
||||
if(cue_sheet->tracks[i].number == 0) {
|
||||
if(violation) *violation = "cue sheet may not have a track number 0";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(check_cd_da_subset) {
|
||||
if(!((cue_sheet->tracks[i].number >= 1 && cue_sheet->tracks[i].number <= 99) || cue_sheet->tracks[i].number == 170)) {
|
||||
if(violation) *violation = "CD-DA cue sheet track number must be 1-99 or 170";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(check_cd_da_subset && cue_sheet->tracks[i].offset % 588 != 0) {
|
||||
if(violation) {
|
||||
if(i == cue_sheet->num_tracks-1) /* the lead-out track... */
|
||||
*violation = "CD-DA cue sheet lead-out offset must be evenly divisible by 588 samples";
|
||||
else
|
||||
*violation = "CD-DA cue sheet track offset must be evenly divisible by 588 samples";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(i < cue_sheet->num_tracks - 1) {
|
||||
if(cue_sheet->tracks[i].num_indices == 0) {
|
||||
if(violation) *violation = "cue sheet track must have at least one index point";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(cue_sheet->tracks[i].indices[0].number > 1) {
|
||||
if(violation) *violation = "cue sheet track's first index number must be 0 or 1";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(j = 0; j < cue_sheet->tracks[i].num_indices; j++) {
|
||||
if(check_cd_da_subset && cue_sheet->tracks[i].indices[j].offset % 588 != 0) {
|
||||
if(violation) *violation = "CD-DA cue sheet track index offset must be evenly divisible by 588 samples";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(j > 0) {
|
||||
if(cue_sheet->tracks[i].indices[j].number != cue_sheet->tracks[i].indices[j-1].number + 1) {
|
||||
if(violation) *violation = "cue sheet track index numbers must increase by 1";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
|
||||
FLAC_API FLAC__bool FLAC__format_picture_is_legal(const FLAC__StreamMetadata_Picture *picture, const char **violation)
|
||||
{
|
||||
char *p;
|
||||
FLAC__byte *b;
|
||||
|
||||
for(p = picture->mime_type; *p; p++) {
|
||||
if(*p < 0x20 || *p > 0x7e) {
|
||||
if(violation) *violation = "MIME type string must contain only printable ASCII characters (0x20-0x7e)";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(b = picture->description; *b; ) {
|
||||
unsigned n = utf8len_(b);
|
||||
if(n == 0) {
|
||||
if(violation) *violation = "description string must be valid UTF-8";
|
||||
return false;
|
||||
}
|
||||
b += n;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* These routines are private to libFLAC
|
||||
*/
|
||||
unsigned FLAC__format_get_max_rice_partition_order(unsigned blocksize, unsigned predictor_order)
|
||||
{
|
||||
return
|
||||
FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(
|
||||
FLAC__format_get_max_rice_partition_order_from_blocksize(blocksize),
|
||||
blocksize,
|
||||
predictor_order
|
||||
);
|
||||
}
|
||||
|
||||
unsigned FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned blocksize)
|
||||
{
|
||||
unsigned max_rice_partition_order = 0;
|
||||
while(!(blocksize & 1)) {
|
||||
max_rice_partition_order++;
|
||||
blocksize >>= 1;
|
||||
}
|
||||
return min(FLAC__MAX_RICE_PARTITION_ORDER, max_rice_partition_order);
|
||||
}
|
||||
|
||||
unsigned FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(unsigned limit, unsigned blocksize, unsigned predictor_order)
|
||||
{
|
||||
unsigned max_rice_partition_order = limit;
|
||||
|
||||
while(max_rice_partition_order > 0 && (blocksize >> max_rice_partition_order) <= predictor_order)
|
||||
max_rice_partition_order--;
|
||||
|
||||
FLAC__ASSERT(
|
||||
(max_rice_partition_order == 0 && blocksize >= predictor_order) ||
|
||||
(max_rice_partition_order > 0 && blocksize >> max_rice_partition_order > predictor_order)
|
||||
);
|
||||
|
||||
return max_rice_partition_order;
|
||||
}
|
||||
|
||||
void FLAC__format_entropy_coding_method_partitioned_rice_contents_init(FLAC__EntropyCodingMethod_PartitionedRiceContents *object)
|
||||
{
|
||||
FLAC__ASSERT(0 != object);
|
||||
|
||||
object->parameters = 0;
|
||||
object->raw_bits = 0;
|
||||
object->capacity_by_order = 0;
|
||||
}
|
||||
|
||||
void FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(FLAC__EntropyCodingMethod_PartitionedRiceContents *object)
|
||||
{
|
||||
FLAC__ASSERT(0 != object);
|
||||
|
||||
if(0 != object->parameters)
|
||||
free(object->parameters);
|
||||
if(0 != object->raw_bits)
|
||||
free(object->raw_bits);
|
||||
FLAC__format_entropy_coding_method_partitioned_rice_contents_init(object);
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, unsigned max_partition_order)
|
||||
{
|
||||
FLAC__ASSERT(0 != object);
|
||||
|
||||
FLAC__ASSERT(object->capacity_by_order > 0 || (0 == object->parameters && 0 == object->raw_bits));
|
||||
|
||||
if(object->capacity_by_order < max_partition_order) {
|
||||
if(0 == (object->parameters = (unsigned*)realloc(object->parameters, sizeof(unsigned)*(1 << max_partition_order))))
|
||||
return false;
|
||||
if(0 == (object->raw_bits = (unsigned*)realloc(object->raw_bits, sizeof(unsigned)*(1 << max_partition_order))))
|
||||
return false;
|
||||
memset(object->raw_bits, 0, sizeof(unsigned)*(1 << max_partition_order));
|
||||
object->capacity_by_order = max_partition_order;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
45
flac/src/libFLAC/ia32/Makefile.am
Normal file
45
flac/src/libFLAC/ia32/Makefile.am
Normal file
@@ -0,0 +1,45 @@
|
||||
# libFLAC - Free Lossless Audio Codec library
|
||||
# Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# - Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# - Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
SUFFIXES = .nasm .lo
|
||||
|
||||
STRIP_NON_ASM = sh $(top_srcdir)/strip_non_asm_libtool_args.sh
|
||||
|
||||
.nasm.lo:
|
||||
$(LIBTOOL) --tag=CC --mode=compile $(STRIP_NON_ASM) $(NASM) -f $(OBJ_FORMAT) -d OBJ_FORMAT_$(OBJ_FORMAT) -i$(srcdir)/ $< -o $@
|
||||
|
||||
noinst_LTLIBRARIES = libFLAC-asm.la
|
||||
libFLAC_asm_la_SOURCES = \
|
||||
bitreader_asm.nasm \
|
||||
cpu_asm.nasm \
|
||||
fixed_asm.nasm \
|
||||
lpc_asm.nasm \
|
||||
nasm.h \
|
||||
stream_encoder_asm.nasm
|
||||
568
flac/src/libFLAC/ia32/bitreader_asm.nasm
Normal file
568
flac/src/libFLAC/ia32/bitreader_asm.nasm
Normal file
@@ -0,0 +1,568 @@
|
||||
; vim:filetype=nasm ts=8
|
||||
|
||||
; libFLAC - Free Lossless Audio Codec library
|
||||
; Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions
|
||||
; are met:
|
||||
;
|
||||
; - Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
;
|
||||
; - Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
;
|
||||
; - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
; contributors may be used to endorse or promote products derived from
|
||||
; this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
%include "nasm.h"
|
||||
|
||||
data_section
|
||||
|
||||
cextern FLAC__crc16_table ; unsigned FLAC__crc16_table[256];
|
||||
cextern bitreader_read_from_client_ ; FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br);
|
||||
|
||||
cglobal FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap
|
||||
|
||||
code_section
|
||||
|
||||
|
||||
; **********************************************************************
|
||||
;
|
||||
; void FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter)
|
||||
;
|
||||
; Some details like assertions and other checking is performed by the caller.
|
||||
ALIGN 16
|
||||
cident FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap
|
||||
|
||||
;ASSERT(0 != br);
|
||||
;ASSERT(0 != br->buffer);
|
||||
; WATCHOUT: code only works if sizeof(brword)==32; we can make things much faster with this assertion
|
||||
;ASSERT(FLAC__BITS_PER_WORD == 32);
|
||||
;ASSERT(parameter < 32);
|
||||
; the above two asserts also guarantee that the binary part never straddles more than 2 words, so we don't have to loop to read it
|
||||
|
||||
;; peppered throughout the code at major checkpoints are keys like this as to where things are at that point in time
|
||||
;; [esp + 16] unsigned parameter
|
||||
;; [esp + 12] unsigned nvals
|
||||
;; [esp + 8] int vals[]
|
||||
;; [esp + 4] FLAC__BitReader *br
|
||||
mov eax, [esp + 12] ; if(nvals == 0)
|
||||
test eax, eax
|
||||
ja .nvals_gt_0
|
||||
mov eax, 1 ; return true;
|
||||
ret
|
||||
|
||||
.nvals_gt_0:
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
push edi
|
||||
sub esp, 4
|
||||
;; [esp + 36] unsigned parameter
|
||||
;; [esp + 32] unsigned nvals
|
||||
;; [esp + 28] int vals[]
|
||||
;; [esp + 24] FLAC__BitReader *br
|
||||
;; [esp] ucbits
|
||||
mov ebp, [esp + 24] ; ebp <- br == br->buffer
|
||||
mov esi, [ebp + 16] ; esi <- br->consumed_words (aka 'cwords' in the C version)
|
||||
mov ecx, [ebp + 20] ; ecx <- br->consumed_bits (aka 'cbits' in the C version)
|
||||
xor edi, edi ; edi <- 0 'uval'
|
||||
;; ecx cbits
|
||||
;; esi cwords
|
||||
;; edi uval
|
||||
;; ebp br
|
||||
;; [ebp] br->buffer
|
||||
;; [ebp + 8] br->words
|
||||
;; [ebp + 12] br->bytes
|
||||
;; [ebp + 16] br->consumed_words
|
||||
;; [ebp + 20] br->consumed_bits
|
||||
;; [ebp + 24] br->read_crc
|
||||
;; [ebp + 28] br->crc16_align
|
||||
|
||||
; ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits;
|
||||
mov eax, [ebp + 8] ; eax <- br->words
|
||||
sub eax, esi ; eax <- br->words-cwords
|
||||
shl eax, 2 ; eax <- (br->words-cwords)*FLAC__BYTES_PER_WORD
|
||||
add eax, [ebp + 12] ; eax <- (br->words-cwords)*FLAC__BYTES_PER_WORD + br->bytes
|
||||
shl eax, 3 ; eax <- (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8
|
||||
sub eax, ecx ; eax <- (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits
|
||||
mov [esp], eax ; ucbits <- eax
|
||||
|
||||
ALIGN 16
|
||||
.val_loop: ; while(1) {
|
||||
|
||||
;
|
||||
; read unary part
|
||||
;
|
||||
.unary_loop: ; while(1) {
|
||||
;; ecx cbits
|
||||
;; esi cwords
|
||||
;; edi uval
|
||||
;; ebp br
|
||||
cmp esi, [ebp + 8] ; while(cwords < br->words) /* if we've not consumed up to a partial tail word... */
|
||||
jae near .c1_next1
|
||||
.c1_loop: ; {
|
||||
mov ebx, [ebp]
|
||||
mov eax, [ebx + 4*esi] ; b = br->buffer[cwords]
|
||||
mov edx, eax ; edx = br->buffer[cwords] (saved for later use)
|
||||
shl eax, cl ; b = br->buffer[cwords] << cbits
|
||||
test eax, eax ; (still have to test since cbits may be 0, thus ZF not updated for shl eax,0)
|
||||
jz near .c1_next2 ; if(b) {
|
||||
bsr ebx, eax
|
||||
not ebx
|
||||
and ebx, 31 ; ebx = 'i' = # of leading 0 bits in 'b' (eax)
|
||||
add ecx, ebx ; cbits += i;
|
||||
add edi, ebx ; uval += i;
|
||||
add ecx, byte 1 ; cbits++; /* skip over stop bit */
|
||||
test ecx, ~31
|
||||
jz near .break1 ; if(cbits >= FLAC__BITS_PER_WORD) { /* faster way of testing if(cbits == FLAC__BITS_PER_WORD) */
|
||||
; crc16_update_word_(br, br->buffer[cwords]);
|
||||
push edi ; [need more registers]
|
||||
bswap edx ; edx = br->buffer[cwords] swapped; now we can CRC the bytes from LSByte to MSByte which makes things much easier
|
||||
mov ecx, [ebp + 28] ; ecx <- br->crc16_align
|
||||
mov eax, [ebp + 24] ; ax <- br->read_crc (a.k.a. crc)
|
||||
%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE
|
||||
mov edi, _FLAC__crc16_table
|
||||
%else
|
||||
mov edi, FLAC__crc16_table
|
||||
%endif
|
||||
;; eax (ax) crc a.k.a. br->read_crc
|
||||
;; ebx (bl) intermediate result index into FLAC__crc16_table[]
|
||||
;; ecx br->crc16_align
|
||||
;; edx byteswapped brword to CRC
|
||||
;; esi cwords
|
||||
;; edi unsigned FLAC__crc16_table[]
|
||||
;; ebp br
|
||||
test ecx, ecx ; switch(br->crc16_align) ...
|
||||
jnz .c0b4 ; [br->crc16_align is 0 the vast majority of the time so we optimize the common case]
|
||||
.c0b0: xor dl, ah ; dl <- (crc>>8)^(word>>24)
|
||||
movzx ebx, dl
|
||||
mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^(word>>24)]
|
||||
shl eax, 8 ; ax <- (crc<<8)
|
||||
xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^(word>>24)]
|
||||
.c0b1: xor dh, ah ; dh <- (crc>>8)^((word>>16)&0xff))
|
||||
movzx ebx, dh
|
||||
mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^((word>>16)&0xff))]
|
||||
shl eax, 8 ; ax <- (crc<<8)
|
||||
xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^((word>>16)&0xff))]
|
||||
shr edx, 16
|
||||
.c0b2: xor dl, ah ; dl <- (crc>>8)^((word>>8)&0xff))
|
||||
movzx ebx, dl
|
||||
mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^((word>>8)&0xff))]
|
||||
shl eax, 8 ; ax <- (crc<<8)
|
||||
xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^((word>>8)&0xff))]
|
||||
.c0b3: xor dh, ah ; dh <- (crc>>8)^(word&0xff)
|
||||
movzx ebx, dh
|
||||
mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^(word&0xff)]
|
||||
shl eax, 8 ; ax <- (crc<<8)
|
||||
xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^(word&0xff)]
|
||||
movzx eax, ax
|
||||
mov [ebp + 24], eax ; br->read_crc <- crc
|
||||
pop edi
|
||||
|
||||
add esi, byte 1 ; cwords++;
|
||||
xor ecx, ecx ; cbits = 0;
|
||||
; }
|
||||
jmp near .break1 ; goto break1;
|
||||
;; this section relocated out of the way for performance
|
||||
.c0b4:
|
||||
mov [ebp + 28], dword 0 ; br->crc16_align <- 0
|
||||
cmp ecx, 8
|
||||
je .c0b1
|
||||
shr edx, 16
|
||||
cmp ecx, 16
|
||||
je .c0b2
|
||||
jmp .c0b3
|
||||
|
||||
;; this section relocated out of the way for performance
|
||||
.c1b4:
|
||||
mov [ebp + 28], dword 0 ; br->crc16_align <- 0
|
||||
cmp ecx, 8
|
||||
je .c1b1
|
||||
shr edx, 16
|
||||
cmp ecx, 16
|
||||
je .c1b2
|
||||
jmp .c1b3
|
||||
|
||||
.c1_next2: ; } else {
|
||||
;; ecx cbits
|
||||
;; edx current brword 'b'
|
||||
;; esi cwords
|
||||
;; edi uval
|
||||
;; ebp br
|
||||
add edi, 32
|
||||
sub edi, ecx ; uval += FLAC__BITS_PER_WORD - cbits;
|
||||
; crc16_update_word_(br, br->buffer[cwords]);
|
||||
push edi ; [need more registers]
|
||||
bswap edx ; edx = br->buffer[cwords] swapped; now we can CRC the bytes from LSByte to MSByte which makes things much easier
|
||||
mov ecx, [ebp + 28] ; ecx <- br->crc16_align
|
||||
mov eax, [ebp + 24] ; ax <- br->read_crc (a.k.a. crc)
|
||||
%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE
|
||||
mov edi, _FLAC__crc16_table
|
||||
%else
|
||||
mov edi, FLAC__crc16_table
|
||||
%endif
|
||||
;; eax (ax) crc a.k.a. br->read_crc
|
||||
;; ebx (bl) intermediate result index into FLAC__crc16_table[]
|
||||
;; ecx br->crc16_align
|
||||
;; edx byteswapped brword to CRC
|
||||
;; esi cwords
|
||||
;; edi unsigned FLAC__crc16_table[]
|
||||
;; ebp br
|
||||
test ecx, ecx ; switch(br->crc16_align) ...
|
||||
jnz .c1b4 ; [br->crc16_align is 0 the vast majority of the time so we optimize the common case]
|
||||
.c1b0: xor dl, ah ; dl <- (crc>>8)^(word>>24)
|
||||
movzx ebx, dl
|
||||
mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^(word>>24)]
|
||||
shl eax, 8 ; ax <- (crc<<8)
|
||||
xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^(word>>24)]
|
||||
.c1b1: xor dh, ah ; dh <- (crc>>8)^((word>>16)&0xff))
|
||||
movzx ebx, dh
|
||||
mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^((word>>16)&0xff))]
|
||||
shl eax, 8 ; ax <- (crc<<8)
|
||||
xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^((word>>16)&0xff))]
|
||||
shr edx, 16
|
||||
.c1b2: xor dl, ah ; dl <- (crc>>8)^((word>>8)&0xff))
|
||||
movzx ebx, dl
|
||||
mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^((word>>8)&0xff))]
|
||||
shl eax, 8 ; ax <- (crc<<8)
|
||||
xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^((word>>8)&0xff))]
|
||||
.c1b3: xor dh, ah ; dh <- (crc>>8)^(word&0xff)
|
||||
movzx ebx, dh
|
||||
mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^(word&0xff)]
|
||||
shl eax, 8 ; ax <- (crc<<8)
|
||||
xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^(word&0xff)]
|
||||
movzx eax, ax
|
||||
mov [ebp + 24], eax ; br->read_crc <- crc
|
||||
pop edi
|
||||
|
||||
add esi, byte 1 ; cwords++;
|
||||
xor ecx, ecx ; cbits = 0;
|
||||
; /* didn't find stop bit yet, have to keep going... */
|
||||
; }
|
||||
|
||||
cmp esi, [ebp + 8] ; } while(cwords < br->words) /* if we've not consumed up to a partial tail word... */
|
||||
jb near .c1_loop
|
||||
|
||||
.c1_next1:
|
||||
; at this point we've eaten up all the whole words; have to try
|
||||
; reading through any tail bytes before calling the read callback.
|
||||
; this is a repeat of the above logic adjusted for the fact we
|
||||
; don't have a whole word. note though if the client is feeding
|
||||
; us data a byte at a time (unlikely), br->consumed_bits may not
|
||||
; be zero.
|
||||
;; ecx cbits
|
||||
;; esi cwords
|
||||
;; edi uval
|
||||
;; ebp br
|
||||
mov edx, [ebp + 12] ; edx <- br->bytes
|
||||
test edx, edx
|
||||
jz .read1 ; if(br->bytes) { [NOTE: this case is rare so it doesn't have to be all that fast ]
|
||||
mov ebx, [ebp]
|
||||
shl edx, 3 ; edx <- const unsigned end = br->bytes * 8;
|
||||
mov eax, [ebx + 4*esi] ; b = br->buffer[cwords]
|
||||
xchg edx, ecx ; [edx <- cbits , ecx <- end]
|
||||
mov ebx, 0xffffffff ; ebx <- FLAC__WORD_ALL_ONES
|
||||
shr ebx, cl ; ebx <- FLAC__WORD_ALL_ONES >> end
|
||||
not ebx ; ebx <- ~(FLAC__WORD_ALL_ONES >> end)
|
||||
xchg edx, ecx ; [edx <- end , ecx <- cbits]
|
||||
and eax, ebx ; b = (br->buffer[cwords] & ~(FLAC__WORD_ALL_ONES >> end));
|
||||
shl eax, cl ; b = (br->buffer[cwords] & ~(FLAC__WORD_ALL_ONES >> end)) << cbits;
|
||||
test eax, eax ; (still have to test since cbits may be 0, thus ZF not updated for shl eax,0)
|
||||
jz .c1_next3 ; if(b) {
|
||||
bsr ebx, eax
|
||||
not ebx
|
||||
and ebx, 31 ; ebx = 'i' = # of leading 0 bits in 'b' (eax)
|
||||
add ecx, ebx ; cbits += i;
|
||||
add edi, ebx ; uval += i;
|
||||
add ecx, byte 1 ; cbits++; /* skip over stop bit */
|
||||
jmp short .break1 ; goto break1;
|
||||
.c1_next3: ; } else {
|
||||
sub edi, ecx
|
||||
add edi, edx ; uval += end - cbits;
|
||||
add ecx, edx ; cbits += end
|
||||
; /* didn't find stop bit yet, have to keep going... */
|
||||
; }
|
||||
; }
|
||||
.read1:
|
||||
; flush registers and read; bitreader_read_from_client_() does
|
||||
; not touch br->consumed_bits at all but we still need to set
|
||||
; it in case it fails and we have to return false.
|
||||
;; ecx cbits
|
||||
;; esi cwords
|
||||
;; edi uval
|
||||
;; ebp br
|
||||
mov [ebp + 16], esi ; br->consumed_words = cwords;
|
||||
mov [ebp + 20], ecx ; br->consumed_bits = cbits;
|
||||
push ecx ; /* save */
|
||||
push ebp ; /* push br argument */
|
||||
%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE
|
||||
call _bitreader_read_from_client_
|
||||
%else
|
||||
call bitreader_read_from_client_
|
||||
%endif
|
||||
pop edx ; /* discard, unused */
|
||||
pop ecx ; /* restore */
|
||||
mov esi, [ebp + 16] ; cwords = br->consumed_words;
|
||||
; ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits;
|
||||
mov ebx, [ebp + 8] ; ebx <- br->words
|
||||
sub ebx, esi ; ebx <- br->words-cwords
|
||||
shl ebx, 2 ; ebx <- (br->words-cwords)*FLAC__BYTES_PER_WORD
|
||||
add ebx, [ebp + 12] ; ebx <- (br->words-cwords)*FLAC__BYTES_PER_WORD + br->bytes
|
||||
shl ebx, 3 ; ebx <- (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8
|
||||
sub ebx, ecx ; ebx <- (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits
|
||||
add ebx, edi ; ebx <- (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits + uval
|
||||
; + uval to offset our count by the # of unary bits already
|
||||
; consumed before the read, because we will add these back
|
||||
; in all at once at break1
|
||||
mov [esp], ebx ; ucbits <- ebx
|
||||
test eax, eax ; if(!bitreader_read_from_client_(br))
|
||||
jnz near .unary_loop
|
||||
jmp .end ; return false; /* eax (the return value) is already 0 */
|
||||
; } /* end while(1) unary part */
|
||||
|
||||
ALIGN 16
|
||||
.break1:
|
||||
;; ecx cbits
|
||||
;; esi cwords
|
||||
;; edi uval
|
||||
;; ebp br
|
||||
;; [esp] ucbits
|
||||
sub [esp], edi ; ucbits -= uval;
|
||||
sub dword [esp], byte 1 ; ucbits--; /* account for stop bit */
|
||||
|
||||
;
|
||||
; read binary part
|
||||
;
|
||||
mov ebx, [esp + 36] ; ebx <- parameter
|
||||
test ebx, ebx ; if(parameter) {
|
||||
jz near .break2
|
||||
.read2:
|
||||
cmp [esp], ebx ; while(ucbits < parameter) {
|
||||
jae .c2_next1
|
||||
; flush registers and read; bitreader_read_from_client_() does
|
||||
; not touch br->consumed_bits at all but we still need to set
|
||||
; it in case it fails and we have to return false.
|
||||
mov [ebp + 16], esi ; br->consumed_words = cwords;
|
||||
mov [ebp + 20], ecx ; br->consumed_bits = cbits;
|
||||
push ecx ; /* save */
|
||||
push ebp ; /* push br argument */
|
||||
%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE
|
||||
call _bitreader_read_from_client_
|
||||
%else
|
||||
call bitreader_read_from_client_
|
||||
%endif
|
||||
pop edx ; /* discard, unused */
|
||||
pop ecx ; /* restore */
|
||||
mov esi, [ebp + 16] ; cwords = br->consumed_words;
|
||||
; ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits;
|
||||
mov edx, [ebp + 8] ; edx <- br->words
|
||||
sub edx, esi ; edx <- br->words-cwords
|
||||
shl edx, 2 ; edx <- (br->words-cwords)*FLAC__BYTES_PER_WORD
|
||||
add edx, [ebp + 12] ; edx <- (br->words-cwords)*FLAC__BYTES_PER_WORD + br->bytes
|
||||
shl edx, 3 ; edx <- (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8
|
||||
sub edx, ecx ; edx <- (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits
|
||||
mov [esp], edx ; ucbits <- edx
|
||||
test eax, eax ; if(!bitreader_read_from_client_(br))
|
||||
jnz .read2
|
||||
jmp .end ; return false; /* eax (the return value) is already 0 */
|
||||
; }
|
||||
.c2_next1:
|
||||
;; ebx parameter
|
||||
;; ecx cbits
|
||||
;; esi cwords
|
||||
;; edi uval
|
||||
;; ebp br
|
||||
;; [esp] ucbits
|
||||
cmp esi, [ebp + 8] ; if(cwords < br->words) { /* if we've not consumed up to a partial tail word... */
|
||||
jae near .c2_next2
|
||||
test ecx, ecx ; if(cbits) {
|
||||
jz near .c2_next3 ; /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */
|
||||
mov eax, 32
|
||||
mov edx, [ebp]
|
||||
sub eax, ecx ; const unsigned n = FLAC__BITS_PER_WORD - cbits;
|
||||
mov edx, [edx + 4*esi] ; const brword word = br->buffer[cwords];
|
||||
cmp ebx, eax ; if(parameter < n) {
|
||||
jae .c2_next4
|
||||
; uval <<= parameter;
|
||||
; uval |= (word & (FLAC__WORD_ALL_ONES >> cbits)) >> (n-parameter);
|
||||
shl edx, cl
|
||||
xchg ebx, ecx
|
||||
shld edi, edx, cl
|
||||
add ebx, ecx ; cbits += parameter;
|
||||
xchg ebx, ecx ; ebx <- parameter, ecx <- cbits
|
||||
jmp .break2 ; goto break2;
|
||||
; }
|
||||
.c2_next4:
|
||||
; uval <<= n;
|
||||
; uval |= word & (FLAC__WORD_ALL_ONES >> cbits);
|
||||
%if 1
|
||||
rol edx, cl ; @@@@@@OPT: may be faster to use rol to save edx so we can restore it for CRC'ing
|
||||
; @@@@@@OPT: or put parameter in ch instead and free up ebx completely again
|
||||
%else
|
||||
shl edx, cl
|
||||
%endif
|
||||
xchg eax, ecx
|
||||
shld edi, edx, cl
|
||||
xchg eax, ecx
|
||||
%if 1
|
||||
ror edx, cl ; restored.
|
||||
%else
|
||||
mov edx, [ebp]
|
||||
mov edx, [edx + 4*esi]
|
||||
%endif
|
||||
; crc16_update_word_(br, br->buffer[cwords]);
|
||||
push edi ; [need more registers]
|
||||
push ebx ; [need more registers]
|
||||
push eax ; [need more registers]
|
||||
bswap edx ; edx = br->buffer[cwords] swapped; now we can CRC the bytes from LSByte to MSByte which makes things much easier
|
||||
mov ecx, [ebp + 28] ; ecx <- br->crc16_align
|
||||
mov eax, [ebp + 24] ; ax <- br->read_crc (a.k.a. crc)
|
||||
%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE
|
||||
mov edi, _FLAC__crc16_table
|
||||
%else
|
||||
mov edi, FLAC__crc16_table
|
||||
%endif
|
||||
;; eax (ax) crc a.k.a. br->read_crc
|
||||
;; ebx (bl) intermediate result index into FLAC__crc16_table[]
|
||||
;; ecx br->crc16_align
|
||||
;; edx byteswapped brword to CRC
|
||||
;; esi cwords
|
||||
;; edi unsigned FLAC__crc16_table[]
|
||||
;; ebp br
|
||||
test ecx, ecx ; switch(br->crc16_align) ...
|
||||
jnz .c2b4 ; [br->crc16_align is 0 the vast majority of the time so we optimize the common case]
|
||||
.c2b0: xor dl, ah ; dl <- (crc>>8)^(word>>24)
|
||||
movzx ebx, dl
|
||||
mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^(word>>24)]
|
||||
shl eax, 8 ; ax <- (crc<<8)
|
||||
xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^(word>>24)]
|
||||
.c2b1: xor dh, ah ; dh <- (crc>>8)^((word>>16)&0xff))
|
||||
movzx ebx, dh
|
||||
mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^((word>>16)&0xff))]
|
||||
shl eax, 8 ; ax <- (crc<<8)
|
||||
xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^((word>>16)&0xff))]
|
||||
shr edx, 16
|
||||
.c2b2: xor dl, ah ; dl <- (crc>>8)^((word>>8)&0xff))
|
||||
movzx ebx, dl
|
||||
mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^((word>>8)&0xff))]
|
||||
shl eax, 8 ; ax <- (crc<<8)
|
||||
xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^((word>>8)&0xff))]
|
||||
.c2b3: xor dh, ah ; dh <- (crc>>8)^(word&0xff)
|
||||
movzx ebx, dh
|
||||
mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^(word&0xff)]
|
||||
shl eax, 8 ; ax <- (crc<<8)
|
||||
xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^(word&0xff)]
|
||||
movzx eax, ax
|
||||
mov [ebp + 24], eax ; br->read_crc <- crc
|
||||
pop eax
|
||||
pop ebx
|
||||
pop edi
|
||||
add esi, byte 1 ; cwords++;
|
||||
mov ecx, ebx
|
||||
sub ecx, eax ; cbits = parameter - n;
|
||||
jz .break2 ; if(cbits) { /* parameter > n, i.e. if there are still bits left to read, there have to be less than 32 so they will all be in the next word */
|
||||
; uval <<= cbits;
|
||||
; uval |= (br->buffer[cwords] >> (FLAC__BITS_PER_WORD-cbits));
|
||||
mov eax, [ebp]
|
||||
mov eax, [eax + 4*esi]
|
||||
shld edi, eax, cl
|
||||
; }
|
||||
jmp .break2 ; goto break2;
|
||||
|
||||
;; this section relocated out of the way for performance
|
||||
.c2b4:
|
||||
mov [ebp + 28], dword 0 ; br->crc16_align <- 0
|
||||
cmp ecx, 8
|
||||
je .c2b1
|
||||
shr edx, 16
|
||||
cmp ecx, 16
|
||||
je .c2b2
|
||||
jmp .c2b3
|
||||
|
||||
.c2_next3: ; } else {
|
||||
mov ecx, ebx ; cbits = parameter;
|
||||
; uval <<= cbits;
|
||||
; uval |= (br->buffer[cwords] >> (FLAC__BITS_PER_WORD-cbits));
|
||||
mov eax, [ebp]
|
||||
mov eax, [eax + 4*esi]
|
||||
shld edi, eax, cl
|
||||
jmp .break2 ; goto break2;
|
||||
; }
|
||||
.c2_next2: ; } else {
|
||||
; in this case we're starting our read at a partial tail word;
|
||||
; the reader has guaranteed that we have at least 'parameter'
|
||||
; bits available to read, which makes this case simpler.
|
||||
; uval <<= parameter;
|
||||
; if(cbits) {
|
||||
; /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */
|
||||
; uval |= (br->buffer[cwords] & (FLAC__WORD_ALL_ONES >> cbits)) >> (FLAC__BITS_PER_WORD-cbits-parameter);
|
||||
; cbits += parameter;
|
||||
; goto break2;
|
||||
; } else {
|
||||
; cbits = parameter;
|
||||
; uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD-cbits);
|
||||
; goto break2;
|
||||
; }
|
||||
; the above is much shorter in assembly:
|
||||
mov eax, [ebp]
|
||||
mov eax, [eax + 4*esi] ; eax <- br->buffer[cwords]
|
||||
shl eax, cl ; eax <- br->buffer[cwords] << cbits
|
||||
add ecx, ebx ; cbits += parameter
|
||||
xchg ebx, ecx ; ebx <- cbits, ecx <- parameter
|
||||
shld edi, eax, cl ; uval <<= parameter <<< 'parameter' bits of tail word
|
||||
xchg ebx, ecx ; ebx <- parameter, ecx <- cbits
|
||||
; }
|
||||
; }
|
||||
.break2:
|
||||
sub [esp], ebx ; ucbits -= parameter;
|
||||
|
||||
;
|
||||
; compose the value
|
||||
;
|
||||
mov ebx, [esp + 28] ; ebx <- vals
|
||||
mov edx, edi ; edx <- uval
|
||||
and edi, 1 ; edi <- uval & 1
|
||||
shr edx, 1 ; edx <- uval >> 1
|
||||
neg edi ; edi <- -(int)(uval & 1)
|
||||
xor edx, edi ; edx <- (uval >> 1 ^ -(int)(uval & 1))
|
||||
mov [ebx], edx ; *vals <- edx
|
||||
sub dword [esp + 32], byte 1 ; --nvals;
|
||||
jz .finished ; if(nvals == 0) /* jump to finish */
|
||||
xor edi, edi ; uval = 0;
|
||||
add dword [esp + 28], 4 ; ++vals
|
||||
jmp .val_loop ; }
|
||||
|
||||
.finished:
|
||||
mov [ebp + 16], esi ; br->consumed_words = cwords;
|
||||
mov [ebp + 20], ecx ; br->consumed_bits = cbits;
|
||||
mov eax, 1
|
||||
.end:
|
||||
add esp, 4
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
end
|
||||
|
||||
%ifdef OBJ_FORMAT_elf
|
||||
section .note.GNU-stack noalloc
|
||||
%endif
|
||||
BIN
flac/src/libFLAC/ia32/bitreader_asm.obj
Normal file
BIN
flac/src/libFLAC/ia32/bitreader_asm.obj
Normal file
Binary file not shown.
121
flac/src/libFLAC/ia32/cpu_asm.nasm
Normal file
121
flac/src/libFLAC/ia32/cpu_asm.nasm
Normal file
@@ -0,0 +1,121 @@
|
||||
; vim:filetype=nasm ts=8
|
||||
|
||||
; libFLAC - Free Lossless Audio Codec library
|
||||
; Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions
|
||||
; are met:
|
||||
;
|
||||
; - Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
;
|
||||
; - Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
;
|
||||
; - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
; contributors may be used to endorse or promote products derived from
|
||||
; this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
%include "nasm.h"
|
||||
|
||||
data_section
|
||||
|
||||
cglobal FLAC__cpu_have_cpuid_asm_ia32
|
||||
cglobal FLAC__cpu_info_asm_ia32
|
||||
cglobal FLAC__cpu_info_extended_amd_asm_ia32
|
||||
|
||||
code_section
|
||||
|
||||
; **********************************************************************
|
||||
;
|
||||
; FLAC__uint32 FLAC__cpu_have_cpuid_asm_ia32()
|
||||
;
|
||||
|
||||
cident FLAC__cpu_have_cpuid_asm_ia32
|
||||
push ebx
|
||||
pushfd
|
||||
pop eax
|
||||
mov edx, eax
|
||||
xor eax, 0x00200000
|
||||
push eax
|
||||
popfd
|
||||
pushfd
|
||||
pop eax
|
||||
cmp eax, edx
|
||||
jz .no_cpuid
|
||||
mov eax, 1
|
||||
jmp .end
|
||||
.no_cpuid:
|
||||
xor eax, eax
|
||||
.end:
|
||||
pop ebx
|
||||
ret
|
||||
|
||||
; **********************************************************************
|
||||
;
|
||||
; void FLAC__cpu_info_asm_ia32(FLAC__uint32 *flags_edx, FLAC__uint32 *flags_ecx)
|
||||
;
|
||||
|
||||
cident FLAC__cpu_info_asm_ia32
|
||||
;[esp + 8] == flags_edx
|
||||
;[esp + 12] == flags_ecx
|
||||
|
||||
push ebx
|
||||
call FLAC__cpu_have_cpuid_asm_ia32
|
||||
test eax, eax
|
||||
jz .no_cpuid
|
||||
mov eax, 1
|
||||
cpuid
|
||||
mov ebx, [esp + 8]
|
||||
mov [ebx], edx
|
||||
mov ebx, [esp + 12]
|
||||
mov [ebx], ecx
|
||||
jmp .end
|
||||
.no_cpuid:
|
||||
xor eax, eax
|
||||
mov ebx, [esp + 8]
|
||||
mov [ebx], eax
|
||||
mov ebx, [esp + 12]
|
||||
mov [ebx], eax
|
||||
.end:
|
||||
pop ebx
|
||||
ret
|
||||
|
||||
cident FLAC__cpu_info_extended_amd_asm_ia32
|
||||
push ebx
|
||||
call FLAC__cpu_have_cpuid_asm_ia32
|
||||
test eax, eax
|
||||
jz .no_cpuid
|
||||
mov eax, 0x80000000
|
||||
cpuid
|
||||
cmp eax, 0x80000001
|
||||
jb .no_cpuid
|
||||
mov eax, 0x80000001
|
||||
cpuid
|
||||
mov eax, edx
|
||||
jmp .end
|
||||
.no_cpuid:
|
||||
xor eax, eax
|
||||
.end:
|
||||
pop ebx
|
||||
ret
|
||||
|
||||
end
|
||||
|
||||
%ifdef OBJ_FORMAT_elf
|
||||
section .note.GNU-stack noalloc
|
||||
%endif
|
||||
BIN
flac/src/libFLAC/ia32/cpu_asm.obj
Normal file
BIN
flac/src/libFLAC/ia32/cpu_asm.obj
Normal file
Binary file not shown.
312
flac/src/libFLAC/ia32/fixed_asm.nasm
Normal file
312
flac/src/libFLAC/ia32/fixed_asm.nasm
Normal file
@@ -0,0 +1,312 @@
|
||||
; vim:filetype=nasm ts=8
|
||||
|
||||
; libFLAC - Free Lossless Audio Codec library
|
||||
; Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions
|
||||
; are met:
|
||||
;
|
||||
; - Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
;
|
||||
; - Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
;
|
||||
; - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
; contributors may be used to endorse or promote products derived from
|
||||
; this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
%include "nasm.h"
|
||||
|
||||
data_section
|
||||
|
||||
cglobal FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov
|
||||
|
||||
code_section
|
||||
|
||||
; **********************************************************************
|
||||
;
|
||||
; unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 *data, unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
|
||||
; {
|
||||
; FLAC__int32 last_error_0 = data[-1];
|
||||
; FLAC__int32 last_error_1 = data[-1] - data[-2];
|
||||
; FLAC__int32 last_error_2 = last_error_1 - (data[-2] - data[-3]);
|
||||
; FLAC__int32 last_error_3 = last_error_2 - (data[-2] - 2*data[-3] + data[-4]);
|
||||
; FLAC__int32 error, save;
|
||||
; FLAC__uint32 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0;
|
||||
; unsigned i, order;
|
||||
;
|
||||
; for(i = 0; i < data_len; i++) {
|
||||
; error = data[i] ; total_error_0 += local_abs(error); save = error;
|
||||
; error -= last_error_0; total_error_1 += local_abs(error); last_error_0 = save; save = error;
|
||||
; error -= last_error_1; total_error_2 += local_abs(error); last_error_1 = save; save = error;
|
||||
; error -= last_error_2; total_error_3 += local_abs(error); last_error_2 = save; save = error;
|
||||
; error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save;
|
||||
; }
|
||||
;
|
||||
; if(total_error_0 < min(min(min(total_error_1, total_error_2), total_error_3), total_error_4))
|
||||
; order = 0;
|
||||
; else if(total_error_1 < min(min(total_error_2, total_error_3), total_error_4))
|
||||
; order = 1;
|
||||
; else if(total_error_2 < min(total_error_3, total_error_4))
|
||||
; order = 2;
|
||||
; else if(total_error_3 < total_error_4)
|
||||
; order = 3;
|
||||
; else
|
||||
; order = 4;
|
||||
;
|
||||
; residual_bits_per_sample[0] = (FLAC__float)((data_len > 0 && total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
; residual_bits_per_sample[1] = (FLAC__float)((data_len > 0 && total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
; residual_bits_per_sample[2] = (FLAC__float)((data_len > 0 && total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
; residual_bits_per_sample[3] = (FLAC__float)((data_len > 0 && total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
; residual_bits_per_sample[4] = (FLAC__float)((data_len > 0 && total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
;
|
||||
; return order;
|
||||
; }
|
||||
ALIGN 16
|
||||
cident FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov
|
||||
|
||||
; esp + 36 == data[]
|
||||
; esp + 40 == data_len
|
||||
; esp + 44 == residual_bits_per_sample[]
|
||||
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
push edi
|
||||
sub esp, byte 16
|
||||
; qword [esp] == temp space for loading FLAC__uint64s to FPU regs
|
||||
|
||||
; ebx == &data[i]
|
||||
; ecx == loop counter (i)
|
||||
; ebp == order
|
||||
; mm0 == total_error_1:total_error_0
|
||||
; mm1 == total_error_2:total_error_3
|
||||
; mm2 == :total_error_4
|
||||
; mm3 == last_error_1:last_error_0
|
||||
; mm4 == last_error_2:last_error_3
|
||||
|
||||
mov ecx, [esp + 40] ; ecx = data_len
|
||||
test ecx, ecx
|
||||
jz near .data_len_is_0
|
||||
|
||||
mov ebx, [esp + 36] ; ebx = data[]
|
||||
movd mm3, [ebx - 4] ; mm3 = 0:last_error_0
|
||||
movd mm2, [ebx - 8] ; mm2 = 0:data[-2]
|
||||
movd mm1, [ebx - 12] ; mm1 = 0:data[-3]
|
||||
movd mm0, [ebx - 16] ; mm0 = 0:data[-4]
|
||||
movq mm5, mm3 ; mm5 = 0:last_error_0
|
||||
psubd mm5, mm2 ; mm5 = 0:last_error_1
|
||||
punpckldq mm3, mm5 ; mm3 = last_error_1:last_error_0
|
||||
psubd mm2, mm1 ; mm2 = 0:data[-2] - data[-3]
|
||||
psubd mm5, mm2 ; mm5 = 0:last_error_2
|
||||
movq mm4, mm5 ; mm4 = 0:last_error_2
|
||||
psubd mm4, mm2 ; mm4 = 0:last_error_2 - (data[-2] - data[-3])
|
||||
paddd mm4, mm1 ; mm4 = 0:last_error_2 - (data[-2] - 2 * data[-3])
|
||||
psubd mm4, mm0 ; mm4 = 0:last_error_3
|
||||
punpckldq mm4, mm5 ; mm4 = last_error_2:last_error_3
|
||||
pxor mm0, mm0 ; mm0 = total_error_1:total_error_0
|
||||
pxor mm1, mm1 ; mm1 = total_error_2:total_error_3
|
||||
pxor mm2, mm2 ; mm2 = 0:total_error_4
|
||||
|
||||
ALIGN 16
|
||||
.loop:
|
||||
movd mm7, [ebx] ; mm7 = 0:error_0
|
||||
add ebx, byte 4
|
||||
movq mm6, mm7 ; mm6 = 0:error_0
|
||||
psubd mm7, mm3 ; mm7 = :error_1
|
||||
punpckldq mm6, mm7 ; mm6 = error_1:error_0
|
||||
movq mm5, mm6 ; mm5 = error_1:error_0
|
||||
movq mm7, mm6 ; mm7 = error_1:error_0
|
||||
psubd mm5, mm3 ; mm5 = error_2:
|
||||
movq mm3, mm6 ; mm3 = error_1:error_0
|
||||
psrad mm6, 31
|
||||
pxor mm7, mm6
|
||||
psubd mm7, mm6 ; mm7 = abs(error_1):abs(error_0)
|
||||
paddd mm0, mm7 ; mm0 = total_error_1:total_error_0
|
||||
movq mm6, mm5 ; mm6 = error_2:
|
||||
psubd mm5, mm4 ; mm5 = error_3:
|
||||
punpckhdq mm5, mm6 ; mm5 = error_2:error_3
|
||||
movq mm7, mm5 ; mm7 = error_2:error_3
|
||||
movq mm6, mm5 ; mm6 = error_2:error_3
|
||||
psubd mm5, mm4 ; mm5 = :error_4
|
||||
movq mm4, mm6 ; mm4 = error_2:error_3
|
||||
psrad mm6, 31
|
||||
pxor mm7, mm6
|
||||
psubd mm7, mm6 ; mm7 = abs(error_2):abs(error_3)
|
||||
paddd mm1, mm7 ; mm1 = total_error_2:total_error_3
|
||||
movq mm6, mm5 ; mm6 = :error_4
|
||||
psrad mm5, 31
|
||||
pxor mm6, mm5
|
||||
psubd mm6, mm5 ; mm6 = :abs(error_4)
|
||||
paddd mm2, mm6 ; mm2 = :total_error_4
|
||||
|
||||
dec ecx
|
||||
jnz short .loop
|
||||
|
||||
; if(total_error_0 < min(min(min(total_error_1, total_error_2), total_error_3), total_error_4))
|
||||
; order = 0;
|
||||
; else if(total_error_1 < min(min(total_error_2, total_error_3), total_error_4))
|
||||
; order = 1;
|
||||
; else if(total_error_2 < min(total_error_3, total_error_4))
|
||||
; order = 2;
|
||||
; else if(total_error_3 < total_error_4)
|
||||
; order = 3;
|
||||
; else
|
||||
; order = 4;
|
||||
movq mm3, mm0 ; mm3 = total_error_1:total_error_0
|
||||
movd edi, mm2 ; edi = total_error_4
|
||||
movd esi, mm1 ; esi = total_error_3
|
||||
movd eax, mm0 ; eax = total_error_0
|
||||
punpckhdq mm1, mm1 ; mm1 = total_error_2:total_error_2
|
||||
punpckhdq mm3, mm3 ; mm3 = total_error_1:total_error_1
|
||||
movd edx, mm1 ; edx = total_error_2
|
||||
movd ecx, mm3 ; ecx = total_error_1
|
||||
|
||||
xor ebx, ebx
|
||||
xor ebp, ebp
|
||||
inc ebx
|
||||
cmp ecx, eax
|
||||
cmovb eax, ecx ; eax = min(total_error_0, total_error_1)
|
||||
cmovbe ebp, ebx
|
||||
inc ebx
|
||||
cmp edx, eax
|
||||
cmovb eax, edx ; eax = min(total_error_0, total_error_1, total_error_2)
|
||||
cmovbe ebp, ebx
|
||||
inc ebx
|
||||
cmp esi, eax
|
||||
cmovb eax, esi ; eax = min(total_error_0, total_error_1, total_error_2, total_error_3)
|
||||
cmovbe ebp, ebx
|
||||
inc ebx
|
||||
cmp edi, eax
|
||||
cmovb eax, edi ; eax = min(total_error_0, total_error_1, total_error_2, total_error_3, total_error_4)
|
||||
cmovbe ebp, ebx
|
||||
movd ebx, mm0 ; ebx = total_error_0
|
||||
emms
|
||||
|
||||
; residual_bits_per_sample[0] = (FLAC__float)((data_len > 0 && total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
; residual_bits_per_sample[1] = (FLAC__float)((data_len > 0 && total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
; residual_bits_per_sample[2] = (FLAC__float)((data_len > 0 && total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
; residual_bits_per_sample[3] = (FLAC__float)((data_len > 0 && total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
; residual_bits_per_sample[4] = (FLAC__float)((data_len > 0 && total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0);
|
||||
xor eax, eax
|
||||
fild dword [esp + 40] ; ST = data_len (NOTE: assumes data_len is <2gigs)
|
||||
.rbps_0:
|
||||
test ebx, ebx
|
||||
jz .total_error_0_is_0
|
||||
fld1 ; ST = 1.0 data_len
|
||||
mov [esp], ebx
|
||||
mov [esp + 4], eax ; [esp] = (FLAC__uint64)total_error_0
|
||||
mov ebx, [esp + 44]
|
||||
fild qword [esp] ; ST = total_error_0 1.0 data_len
|
||||
fdiv st2 ; ST = total_error_0/data_len 1.0 data_len
|
||||
fldln2 ; ST = ln2 total_error_0/data_len 1.0 data_len
|
||||
fmulp st1 ; ST = ln2*total_error_0/data_len 1.0 data_len
|
||||
fyl2x ; ST = log2(ln2*total_error_0/data_len) data_len
|
||||
fstp dword [ebx] ; residual_bits_per_sample[0] = log2(ln2*total_error_0/data_len) ST = data_len
|
||||
jmp short .rbps_1
|
||||
.total_error_0_is_0:
|
||||
mov ebx, [esp + 44]
|
||||
mov [ebx], eax ; residual_bits_per_sample[0] = 0.0
|
||||
.rbps_1:
|
||||
test ecx, ecx
|
||||
jz .total_error_1_is_0
|
||||
fld1 ; ST = 1.0 data_len
|
||||
mov [esp], ecx
|
||||
mov [esp + 4], eax ; [esp] = (FLAC__uint64)total_error_1
|
||||
fild qword [esp] ; ST = total_error_1 1.0 data_len
|
||||
fdiv st2 ; ST = total_error_1/data_len 1.0 data_len
|
||||
fldln2 ; ST = ln2 total_error_1/data_len 1.0 data_len
|
||||
fmulp st1 ; ST = ln2*total_error_1/data_len 1.0 data_len
|
||||
fyl2x ; ST = log2(ln2*total_error_1/data_len) data_len
|
||||
fstp dword [ebx + 4] ; residual_bits_per_sample[1] = log2(ln2*total_error_1/data_len) ST = data_len
|
||||
jmp short .rbps_2
|
||||
.total_error_1_is_0:
|
||||
mov [ebx + 4], eax ; residual_bits_per_sample[1] = 0.0
|
||||
.rbps_2:
|
||||
test edx, edx
|
||||
jz .total_error_2_is_0
|
||||
fld1 ; ST = 1.0 data_len
|
||||
mov [esp], edx
|
||||
mov [esp + 4], eax ; [esp] = (FLAC__uint64)total_error_2
|
||||
fild qword [esp] ; ST = total_error_2 1.0 data_len
|
||||
fdiv st2 ; ST = total_error_2/data_len 1.0 data_len
|
||||
fldln2 ; ST = ln2 total_error_2/data_len 1.0 data_len
|
||||
fmulp st1 ; ST = ln2*total_error_2/data_len 1.0 data_len
|
||||
fyl2x ; ST = log2(ln2*total_error_2/data_len) data_len
|
||||
fstp dword [ebx + 8] ; residual_bits_per_sample[2] = log2(ln2*total_error_2/data_len) ST = data_len
|
||||
jmp short .rbps_3
|
||||
.total_error_2_is_0:
|
||||
mov [ebx + 8], eax ; residual_bits_per_sample[2] = 0.0
|
||||
.rbps_3:
|
||||
test esi, esi
|
||||
jz .total_error_3_is_0
|
||||
fld1 ; ST = 1.0 data_len
|
||||
mov [esp], esi
|
||||
mov [esp + 4], eax ; [esp] = (FLAC__uint64)total_error_3
|
||||
fild qword [esp] ; ST = total_error_3 1.0 data_len
|
||||
fdiv st2 ; ST = total_error_3/data_len 1.0 data_len
|
||||
fldln2 ; ST = ln2 total_error_3/data_len 1.0 data_len
|
||||
fmulp st1 ; ST = ln2*total_error_3/data_len 1.0 data_len
|
||||
fyl2x ; ST = log2(ln2*total_error_3/data_len) data_len
|
||||
fstp dword [ebx + 12] ; residual_bits_per_sample[3] = log2(ln2*total_error_3/data_len) ST = data_len
|
||||
jmp short .rbps_4
|
||||
.total_error_3_is_0:
|
||||
mov [ebx + 12], eax ; residual_bits_per_sample[3] = 0.0
|
||||
.rbps_4:
|
||||
test edi, edi
|
||||
jz .total_error_4_is_0
|
||||
fld1 ; ST = 1.0 data_len
|
||||
mov [esp], edi
|
||||
mov [esp + 4], eax ; [esp] = (FLAC__uint64)total_error_4
|
||||
fild qword [esp] ; ST = total_error_4 1.0 data_len
|
||||
fdiv st2 ; ST = total_error_4/data_len 1.0 data_len
|
||||
fldln2 ; ST = ln2 total_error_4/data_len 1.0 data_len
|
||||
fmulp st1 ; ST = ln2*total_error_4/data_len 1.0 data_len
|
||||
fyl2x ; ST = log2(ln2*total_error_4/data_len) data_len
|
||||
fstp dword [ebx + 16] ; residual_bits_per_sample[4] = log2(ln2*total_error_4/data_len) ST = data_len
|
||||
jmp short .rbps_end
|
||||
.total_error_4_is_0:
|
||||
mov [ebx + 16], eax ; residual_bits_per_sample[4] = 0.0
|
||||
.rbps_end:
|
||||
fstp st0 ; ST = [empty]
|
||||
jmp short .end
|
||||
.data_len_is_0:
|
||||
; data_len == 0, so residual_bits_per_sample[*] = 0.0
|
||||
xor ebp, ebp
|
||||
mov edi, [esp + 44]
|
||||
mov [edi], ebp
|
||||
mov [edi + 4], ebp
|
||||
mov [edi + 8], ebp
|
||||
mov [edi + 12], ebp
|
||||
mov [edi + 16], ebp
|
||||
add ebp, byte 4 ; order = 4
|
||||
|
||||
.end:
|
||||
mov eax, ebp ; return order
|
||||
add esp, byte 16
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
end
|
||||
|
||||
%ifdef OBJ_FORMAT_elf
|
||||
section .note.GNU-stack noalloc
|
||||
%endif
|
||||
BIN
flac/src/libFLAC/ia32/fixed_asm.obj
Normal file
BIN
flac/src/libFLAC/ia32/fixed_asm.obj
Normal file
Binary file not shown.
784
flac/src/libFLAC/ia32/lpc_asm-unrolled.nasm
Normal file
784
flac/src/libFLAC/ia32/lpc_asm-unrolled.nasm
Normal file
@@ -0,0 +1,784 @@
|
||||
; vim:filetype=nasm ts=8
|
||||
|
||||
; libFLAC - Free Lossless Audio Codec library
|
||||
; Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions
|
||||
; are met:
|
||||
;
|
||||
; - Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
;
|
||||
; - Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
;
|
||||
; - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
; contributors may be used to endorse or promote products derived from
|
||||
; this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
; [CR] is a note to flag that the instruction can be easily reordered
|
||||
|
||||
%include "nasm.h"
|
||||
|
||||
data_section
|
||||
|
||||
cglobal FLAC__lpc_compute_autocorrelation_asm
|
||||
|
||||
code_section
|
||||
|
||||
; **********************************************************************
|
||||
;
|
||||
; void FLAC__lpc_compute_autocorrelation_asm(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[])
|
||||
; {
|
||||
; FLAC__real d;
|
||||
; unsigned sample, coeff;
|
||||
; const unsigned limit = data_len - lag;
|
||||
;
|
||||
; assert(lag > 0);
|
||||
; assert(lag <= data_len);
|
||||
;
|
||||
; for(coeff = 0; coeff < lag; coeff++)
|
||||
; autoc[coeff] = 0.0;
|
||||
; for(sample = 0; sample <= limit; sample++){
|
||||
; d = data[sample];
|
||||
; for(coeff = 0; coeff < lag; coeff++)
|
||||
; autoc[coeff] += d * data[sample+coeff];
|
||||
; }
|
||||
; for(; sample < data_len; sample++){
|
||||
; d = data[sample];
|
||||
; for(coeff = 0; coeff < data_len - sample; coeff++)
|
||||
; autoc[coeff] += d * data[sample+coeff];
|
||||
; }
|
||||
; }
|
||||
;
|
||||
FLAC__lpc_compute_autocorrelation_asm:
|
||||
|
||||
push ebp
|
||||
lea ebp, [esp + 8]
|
||||
push ebx
|
||||
push esi
|
||||
push edi
|
||||
|
||||
mov edx, [ebp + 8] ; edx == lag
|
||||
mov ecx, [ebp + 4] ; ecx == data_len
|
||||
mov esi, [ebp] ; esi == data
|
||||
mov edi, [ebp + 12] ; edi == autoc
|
||||
|
||||
cmp edx, 1
|
||||
ja short .lag_above_1
|
||||
.lag_eq_1:
|
||||
fldz ; will accumulate autoc[0]
|
||||
ALIGN 16
|
||||
.lag_1_loop:
|
||||
fld dword [esi]
|
||||
add esi, byte 4 ; sample++
|
||||
fmul st0, st0
|
||||
faddp st1, st0
|
||||
dec ecx
|
||||
jnz .lag_1_loop
|
||||
fstp dword [edi]
|
||||
jmp .end
|
||||
|
||||
.lag_above_1:
|
||||
cmp edx, 2
|
||||
ja short .lag_above_2
|
||||
.lag_eq_2:
|
||||
fldz ; will accumulate autoc[1]
|
||||
dec ecx
|
||||
fldz ; will accumulate autoc[0]
|
||||
fld dword [esi]
|
||||
ALIGN 16
|
||||
.lag_2_loop:
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
fld st0
|
||||
fmul st0, st0
|
||||
faddp st2, st0 ; add to autoc[0]
|
||||
fld dword [esi]
|
||||
fmul st1, st0
|
||||
fxch
|
||||
faddp st3, st0 ; add to autoc[1]
|
||||
dec ecx
|
||||
jnz .lag_2_loop
|
||||
; clean up the leftovers
|
||||
fmul st0, st0
|
||||
faddp st1, st0 ; add to autoc[0]
|
||||
fstp dword [edi]
|
||||
fstp dword [edi + 4]
|
||||
jmp .end
|
||||
|
||||
.lag_above_2:
|
||||
cmp edx, 3
|
||||
ja short .lag_above_3
|
||||
.lag_eq_3:
|
||||
fldz ; will accumulate autoc[2]
|
||||
dec ecx
|
||||
fldz ; will accumulate autoc[1]
|
||||
dec ecx
|
||||
fldz ; will accumulate autoc[0]
|
||||
ALIGN 16
|
||||
.lag_3_loop:
|
||||
fld dword [esi]
|
||||
fld st0
|
||||
fmul st0, st0
|
||||
faddp st2, st0 ; add to autoc[0]
|
||||
fld dword [esi + 4]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[1]
|
||||
fld dword [esi + 8]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st3, st0 ; add to autoc[2]
|
||||
dec ecx
|
||||
jnz .lag_3_loop
|
||||
; clean up the leftovers
|
||||
fld dword [esi]
|
||||
fld st0
|
||||
fmul st0, st0
|
||||
faddp st2, st0 ; add to autoc[0]
|
||||
fld dword [esi + 4]
|
||||
fmul st1, st0
|
||||
fxch
|
||||
faddp st3, st0 ; add to autoc[1]
|
||||
fmul st0, st0
|
||||
faddp st1, st0 ; add to autoc[0]
|
||||
fstp dword [edi]
|
||||
fstp dword [edi + 4]
|
||||
fstp dword [edi + 8]
|
||||
jmp .end
|
||||
|
||||
.lag_above_3:
|
||||
cmp edx, 4
|
||||
ja near .lag_above_4
|
||||
.lag_eq_4:
|
||||
fldz ; will accumulate autoc[3]
|
||||
dec ecx
|
||||
fldz ; will accumulate autoc[2]
|
||||
dec ecx
|
||||
fldz ; will accumulate autoc[1]
|
||||
dec ecx
|
||||
fldz ; will accumulate autoc[0]
|
||||
ALIGN 16
|
||||
.lag_4_loop:
|
||||
fld dword [esi]
|
||||
fld st0
|
||||
fmul st0, st0
|
||||
faddp st2, st0 ; add to autoc[0]
|
||||
fld dword [esi + 4]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[1]
|
||||
fld dword [esi + 8]
|
||||
fmul st0, st1
|
||||
faddp st4, st0 ; add to autoc[2]
|
||||
fld dword [esi + 12]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st4, st0 ; add to autoc[3]
|
||||
dec ecx
|
||||
jnz .lag_4_loop
|
||||
; clean up the leftovers
|
||||
fld dword [esi]
|
||||
fld st0
|
||||
fmul st0, st0
|
||||
faddp st2, st0 ; add to autoc[0]
|
||||
fld dword [esi + 4]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[1]
|
||||
fld dword [esi + 8]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st3, st0 ; add to autoc[2]
|
||||
fld dword [esi]
|
||||
fld st0
|
||||
fmul st0, st0
|
||||
faddp st2, st0 ; add to autoc[0]
|
||||
fld dword [esi + 4]
|
||||
fmul st1, st0
|
||||
fxch
|
||||
faddp st3, st0 ; add to autoc[1]
|
||||
fmul st0, st0
|
||||
faddp st1, st0 ; add to autoc[0]
|
||||
fstp dword [edi]
|
||||
fstp dword [edi + 4]
|
||||
fstp dword [edi + 8]
|
||||
fstp dword [edi + 12]
|
||||
jmp .end
|
||||
|
||||
.lag_above_4:
|
||||
cmp edx, 5
|
||||
ja near .lag_above_5
|
||||
.lag_eq_5:
|
||||
fldz ; will accumulate autoc[4]
|
||||
fldz ; will accumulate autoc[3]
|
||||
fldz ; will accumulate autoc[2]
|
||||
fldz ; will accumulate autoc[1]
|
||||
fldz ; will accumulate autoc[0]
|
||||
sub ecx, byte 4
|
||||
ALIGN 16
|
||||
.lag_5_loop:
|
||||
fld dword [esi]
|
||||
fld st0
|
||||
fmul st0, st0
|
||||
faddp st2, st0 ; add to autoc[0]
|
||||
fld dword [esi + 4]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[1]
|
||||
fld dword [esi + 8]
|
||||
fmul st0, st1
|
||||
faddp st4, st0 ; add to autoc[2]
|
||||
fld dword [esi + 12]
|
||||
fmul st0, st1
|
||||
faddp st5, st0 ; add to autoc[3]
|
||||
fld dword [esi + 16]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st5, st0 ; add to autoc[4]
|
||||
dec ecx
|
||||
jnz .lag_5_loop
|
||||
; clean up the leftovers
|
||||
fld dword [esi]
|
||||
fld st0
|
||||
fmul st0, st0
|
||||
faddp st2, st0 ; add to autoc[0]
|
||||
fld dword [esi + 4]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[1]
|
||||
fld dword [esi + 8]
|
||||
fmul st0, st1
|
||||
faddp st4, st0 ; add to autoc[2]
|
||||
fld dword [esi + 12]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st4, st0 ; add to autoc[3]
|
||||
fld dword [esi]
|
||||
fld st0
|
||||
fmul st0, st0
|
||||
faddp st2, st0 ; add to autoc[0]
|
||||
fld dword [esi + 4]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[1]
|
||||
fld dword [esi + 8]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st3, st0 ; add to autoc[2]
|
||||
fld dword [esi]
|
||||
fld st0
|
||||
fmul st0, st0
|
||||
faddp st2, st0 ; add to autoc[0]
|
||||
fld dword [esi + 4]
|
||||
fmul st1, st0
|
||||
fxch
|
||||
faddp st3, st0 ; add to autoc[1]
|
||||
fmul st0, st0
|
||||
faddp st1, st0 ; add to autoc[0]
|
||||
fstp dword [edi]
|
||||
fstp dword [edi + 4]
|
||||
fstp dword [edi + 8]
|
||||
fstp dword [edi + 12]
|
||||
fstp dword [edi + 16]
|
||||
jmp .end
|
||||
|
||||
.lag_above_5:
|
||||
cmp edx, 6
|
||||
ja .lag_above_6
|
||||
.lag_eq_6:
|
||||
fldz ; will accumulate autoc[5]
|
||||
fldz ; will accumulate autoc[4]
|
||||
fldz ; will accumulate autoc[3]
|
||||
fldz ; will accumulate autoc[2]
|
||||
fldz ; will accumulate autoc[1]
|
||||
fldz ; will accumulate autoc[0]
|
||||
sub ecx, byte 5
|
||||
ALIGN 16
|
||||
.lag_6_loop:
|
||||
fld dword [esi]
|
||||
fld st0
|
||||
fmul st0, st0
|
||||
faddp st2, st0 ; add to autoc[0]
|
||||
fld dword [esi + 4]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[1]
|
||||
fld dword [esi + 8]
|
||||
fmul st0, st1
|
||||
faddp st4, st0 ; add to autoc[2]
|
||||
fld dword [esi + 12]
|
||||
fmul st0, st1
|
||||
faddp st5, st0 ; add to autoc[3]
|
||||
fld dword [esi + 16]
|
||||
fmul st0, st1
|
||||
faddp st6, st0 ; add to autoc[4]
|
||||
fld dword [esi + 20]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st6, st0 ; add to autoc[5]
|
||||
dec ecx
|
||||
jnz .lag_6_loop
|
||||
; clean up the leftovers
|
||||
fld dword [esi]
|
||||
fld st0
|
||||
fmul st0, st0
|
||||
faddp st2, st0 ; add to autoc[0]
|
||||
fld dword [esi + 4]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[1]
|
||||
fld dword [esi + 8]
|
||||
fmul st0, st1
|
||||
faddp st4, st0 ; add to autoc[2]
|
||||
fld dword [esi + 12]
|
||||
fmul st0, st1
|
||||
faddp st5, st0 ; add to autoc[3]
|
||||
fld dword [esi + 16]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st5, st0 ; add to autoc[4]
|
||||
fld dword [esi]
|
||||
fld st0
|
||||
fmul st0, st0
|
||||
faddp st2, st0 ; add to autoc[0]
|
||||
fld dword [esi + 4]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[1]
|
||||
fld dword [esi + 8]
|
||||
fmul st0, st1
|
||||
faddp st4, st0 ; add to autoc[2]
|
||||
fld dword [esi + 12]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st4, st0 ; add to autoc[3]
|
||||
fld dword [esi]
|
||||
fld st0
|
||||
fmul st0, st0
|
||||
faddp st2, st0 ; add to autoc[0]
|
||||
fld dword [esi + 4]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[1]
|
||||
fld dword [esi + 8]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st3, st0 ; add to autoc[2]
|
||||
fld dword [esi]
|
||||
fld st0
|
||||
fmul st0, st0
|
||||
faddp st2, st0 ; add to autoc[0]
|
||||
fld dword [esi + 4]
|
||||
fmul st1, st0
|
||||
fxch
|
||||
faddp st3, st0 ; add to autoc[1]
|
||||
fmul st0, st0
|
||||
faddp st1, st0 ; add to autoc[0]
|
||||
fstp dword [edi]
|
||||
fstp dword [edi + 4]
|
||||
fstp dword [edi + 8]
|
||||
fstp dword [edi + 12]
|
||||
fstp dword [edi + 16]
|
||||
fstp dword [edi + 20]
|
||||
jmp .end
|
||||
|
||||
.lag_above_6:
|
||||
; for(coeff = 0; coeff < lag; coeff++)
|
||||
; autoc[coeff] = 0.0;
|
||||
lea ecx, [edx * 2] ; ecx = # of dwords of 0 to write
|
||||
xor eax, eax
|
||||
rep stosd
|
||||
mov ecx, [ebp + 4] ; ecx == data_len
|
||||
mov edi, [ebp + 12] ; edi == autoc
|
||||
; const unsigned limit = data_len - lag;
|
||||
sub ecx, edx
|
||||
inc ecx ; we are looping <= limit so we add one to the counter
|
||||
; for(sample = 0; sample <= limit; sample++){
|
||||
; d = data[sample];
|
||||
; for(coeff = 0; coeff < lag; coeff++)
|
||||
; autoc[coeff] += d * data[sample+coeff];
|
||||
; }
|
||||
xor eax, eax ; eax == sample <- 0
|
||||
ALIGN 16
|
||||
.outer_loop:
|
||||
push eax ; save sample
|
||||
fld dword [esi + eax * 4] ; ST = d <- data[sample]
|
||||
mov ebx, eax ; ebx == sample+coeff <- sample
|
||||
mov edx, [ebp + 8] ; edx <- lag
|
||||
xor eax, eax ; eax == coeff <- 0
|
||||
ALIGN 16
|
||||
.inner_loop:
|
||||
fld st0 ; ST = d d
|
||||
fmul dword [esi + ebx * 4] ; ST = d*data[sample+coeff] d
|
||||
fadd dword [edi + eax * 4] ; ST = autoc[coeff]+d*data[sample+coeff] d
|
||||
fstp dword [edi + eax * 4] ; autoc[coeff]+=d*data[sample+coeff] ST = d
|
||||
inc ebx ; (sample+coeff)++
|
||||
inc eax ; coeff++
|
||||
dec edx
|
||||
jnz .inner_loop
|
||||
pop eax ; restore sample
|
||||
fstp st0 ; pop d, ST = empty
|
||||
inc eax ; sample++
|
||||
loop .outer_loop
|
||||
; for(; sample < data_len; sample++){
|
||||
; d = data[sample];
|
||||
; for(coeff = 0; coeff < data_len - sample; coeff++)
|
||||
; autoc[coeff] += d * data[sample+coeff];
|
||||
; }
|
||||
mov ecx, [ebp + 8] ; ecx <- lag
|
||||
dec ecx ; ecx <- lag - 1
|
||||
jz .outer_end ; skip loop if 0
|
||||
.outer_loop2:
|
||||
push eax ; save sample
|
||||
fld dword [esi + eax * 4] ; ST = d <- data[sample]
|
||||
mov ebx, eax ; ebx == sample+coeff <- sample
|
||||
mov edx, [ebp + 4] ; edx <- data_len
|
||||
sub edx, eax ; edx <- data_len-sample
|
||||
xor eax, eax ; eax == coeff <- 0
|
||||
.inner_loop2:
|
||||
fld st0 ; ST = d d
|
||||
fmul dword [esi + ebx * 4] ; ST = d*data[sample+coeff] d
|
||||
fadd dword [edi + eax * 4] ; ST = autoc[coeff]+d*data[sample+coeff] d
|
||||
fstp dword [edi + eax * 4] ; autoc[coeff]+=d*data[sample+coeff] ST = d
|
||||
inc ebx ; (sample+coeff)++
|
||||
inc eax ; coeff++
|
||||
dec edx
|
||||
jnz .inner_loop2
|
||||
pop eax ; restore sample
|
||||
fstp st0 ; pop d, ST = empty
|
||||
inc eax ; sample++
|
||||
loop .outer_loop2
|
||||
.outer_end:
|
||||
jmp .end
|
||||
|
||||
.lag_eq_6_plus_1:
|
||||
mov ecx, [ebp + 4] ; ecx == data_len
|
||||
mov esi, [ebp] ; esi == data
|
||||
mov edi, [ebp + 12] ; edi == autoc
|
||||
fldz ; will accumulate autoc[6]
|
||||
sub ecx, byte 6
|
||||
ALIGN 16
|
||||
.lag_6_1_loop:
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st1, st0 ; add to autoc[6]
|
||||
dec ecx
|
||||
jnz .lag_6_1_loop
|
||||
fstp dword [edi + 24]
|
||||
jmp .end
|
||||
|
||||
.lag_eq_6_plus_2:
|
||||
mov ecx, [ebp + 4] ; ecx == data_len
|
||||
mov esi, [ebp] ; esi == data
|
||||
mov edi, [ebp + 12] ; edi == autoc
|
||||
fldz ; will accumulate autoc[7]
|
||||
fldz ; will accumulate autoc[6]
|
||||
sub ecx, byte 7
|
||||
ALIGN 16
|
||||
.lag_6_2_loop:
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmul st0, st1
|
||||
faddp st2, st0 ; add to autoc[6]
|
||||
fld dword [esi + 28]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st2, st0 ; add to autoc[7]
|
||||
dec ecx
|
||||
jnz .lag_6_2_loop
|
||||
; clean up the leftovers
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmulp st1, st0
|
||||
faddp st1, st0 ; add to autoc[6]
|
||||
fstp dword [edi + 24]
|
||||
fstp dword [edi + 28]
|
||||
jmp .end
|
||||
|
||||
.lag_eq_6_plus_3:
|
||||
mov ecx, [ebp + 4] ; ecx == data_len
|
||||
mov esi, [ebp] ; esi == data
|
||||
mov edi, [ebp + 12] ; edi == autoc
|
||||
fldz ; will accumulate autoc[8]
|
||||
fldz ; will accumulate autoc[7]
|
||||
fldz ; will accumulate autoc[6]
|
||||
sub ecx, byte 8
|
||||
ALIGN 16
|
||||
.lag_6_3_loop:
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmul st0, st1
|
||||
faddp st2, st0 ; add to autoc[6]
|
||||
fld dword [esi + 28]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[7]
|
||||
fld dword [esi + 32]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st3, st0 ; add to autoc[8]
|
||||
dec ecx
|
||||
jnz .lag_6_3_loop
|
||||
; clean up the leftovers
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmul st0, st1
|
||||
faddp st2, st0 ; add to autoc[6]
|
||||
fld dword [esi + 28]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st2, st0 ; add to autoc[7]
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmulp st1, st0
|
||||
faddp st1, st0 ; add to autoc[6]
|
||||
fstp dword [edi + 24]
|
||||
fstp dword [edi + 28]
|
||||
fstp dword [edi + 32]
|
||||
jmp .end
|
||||
|
||||
.lag_eq_6_plus_4:
|
||||
mov ecx, [ebp + 4] ; ecx == data_len
|
||||
mov esi, [ebp] ; esi == data
|
||||
mov edi, [ebp + 12] ; edi == autoc
|
||||
fldz ; will accumulate autoc[9]
|
||||
fldz ; will accumulate autoc[8]
|
||||
fldz ; will accumulate autoc[7]
|
||||
fldz ; will accumulate autoc[6]
|
||||
sub ecx, byte 9
|
||||
ALIGN 16
|
||||
.lag_6_4_loop:
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmul st0, st1
|
||||
faddp st2, st0 ; add to autoc[6]
|
||||
fld dword [esi + 28]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[7]
|
||||
fld dword [esi + 32]
|
||||
fmul st0, st1
|
||||
faddp st4, st0 ; add to autoc[8]
|
||||
fld dword [esi + 36]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st4, st0 ; add to autoc[9]
|
||||
dec ecx
|
||||
jnz .lag_6_4_loop
|
||||
; clean up the leftovers
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmul st0, st1
|
||||
faddp st2, st0 ; add to autoc[6]
|
||||
fld dword [esi + 28]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[7]
|
||||
fld dword [esi + 32]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st3, st0 ; add to autoc[8]
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmul st0, st1
|
||||
faddp st2, st0 ; add to autoc[6]
|
||||
fld dword [esi + 28]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st2, st0 ; add to autoc[7]
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmulp st1, st0
|
||||
faddp st1, st0 ; add to autoc[6]
|
||||
fstp dword [edi + 24]
|
||||
fstp dword [edi + 28]
|
||||
fstp dword [edi + 32]
|
||||
fstp dword [edi + 36]
|
||||
jmp .end
|
||||
|
||||
.lag_eq_6_plus_5:
|
||||
mov ecx, [ebp + 4] ; ecx == data_len
|
||||
mov esi, [ebp] ; esi == data
|
||||
mov edi, [ebp + 12] ; edi == autoc
|
||||
fldz ; will accumulate autoc[10]
|
||||
fldz ; will accumulate autoc[9]
|
||||
fldz ; will accumulate autoc[8]
|
||||
fldz ; will accumulate autoc[7]
|
||||
fldz ; will accumulate autoc[6]
|
||||
sub ecx, byte 10
|
||||
ALIGN 16
|
||||
.lag_6_5_loop:
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmul st0, st1
|
||||
faddp st2, st0 ; add to autoc[6]
|
||||
fld dword [esi + 28]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[7]
|
||||
fld dword [esi + 32]
|
||||
fmul st0, st1
|
||||
faddp st4, st0 ; add to autoc[8]
|
||||
fld dword [esi + 36]
|
||||
fmul st0, st1
|
||||
faddp st5, st0 ; add to autoc[9]
|
||||
fld dword [esi + 40]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st5, st0 ; add to autoc[10]
|
||||
dec ecx
|
||||
jnz .lag_6_5_loop
|
||||
; clean up the leftovers
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmul st0, st1
|
||||
faddp st2, st0 ; add to autoc[6]
|
||||
fld dword [esi + 28]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[7]
|
||||
fld dword [esi + 32]
|
||||
fmul st0, st1
|
||||
faddp st4, st0 ; add to autoc[8]
|
||||
fld dword [esi + 36]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st4, st0 ; add to autoc[9]
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmul st0, st1
|
||||
faddp st2, st0 ; add to autoc[6]
|
||||
fld dword [esi + 28]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[7]
|
||||
fld dword [esi + 32]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st3, st0 ; add to autoc[8]
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmul st0, st1
|
||||
faddp st2, st0 ; add to autoc[6]
|
||||
fld dword [esi + 28]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st2, st0 ; add to autoc[7]
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmulp st1, st0
|
||||
faddp st1, st0 ; add to autoc[6]
|
||||
fstp dword [edi + 24]
|
||||
fstp dword [edi + 28]
|
||||
fstp dword [edi + 32]
|
||||
fstp dword [edi + 36]
|
||||
fstp dword [edi + 40]
|
||||
jmp .end
|
||||
|
||||
.lag_eq_6_plus_6:
|
||||
mov ecx, [ebp + 4] ; ecx == data_len
|
||||
mov esi, [ebp] ; esi == data
|
||||
mov edi, [ebp + 12] ; edi == autoc
|
||||
fldz ; will accumulate autoc[11]
|
||||
fldz ; will accumulate autoc[10]
|
||||
fldz ; will accumulate autoc[9]
|
||||
fldz ; will accumulate autoc[8]
|
||||
fldz ; will accumulate autoc[7]
|
||||
fldz ; will accumulate autoc[6]
|
||||
sub ecx, byte 11
|
||||
ALIGN 16
|
||||
.lag_6_6_loop:
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmul st0, st1
|
||||
faddp st2, st0 ; add to autoc[6]
|
||||
fld dword [esi + 28]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[7]
|
||||
fld dword [esi + 32]
|
||||
fmul st0, st1
|
||||
faddp st4, st0 ; add to autoc[8]
|
||||
fld dword [esi + 36]
|
||||
fmul st0, st1
|
||||
faddp st5, st0 ; add to autoc[9]
|
||||
fld dword [esi + 40]
|
||||
fmul st0, st1
|
||||
faddp st6, st0 ; add to autoc[10]
|
||||
fld dword [esi + 44]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st6, st0 ; add to autoc[11]
|
||||
dec ecx
|
||||
jnz .lag_6_6_loop
|
||||
; clean up the leftovers
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmul st0, st1
|
||||
faddp st2, st0 ; add to autoc[6]
|
||||
fld dword [esi + 28]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[7]
|
||||
fld dword [esi + 32]
|
||||
fmul st0, st1
|
||||
faddp st4, st0 ; add to autoc[8]
|
||||
fld dword [esi + 36]
|
||||
fmul st0, st1
|
||||
faddp st5, st0 ; add to autoc[9]
|
||||
fld dword [esi + 40]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st5, st0 ; add to autoc[10]
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmul st0, st1
|
||||
faddp st2, st0 ; add to autoc[6]
|
||||
fld dword [esi + 28]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[7]
|
||||
fld dword [esi + 32]
|
||||
fmul st0, st1
|
||||
faddp st4, st0 ; add to autoc[8]
|
||||
fld dword [esi + 36]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st4, st0 ; add to autoc[9]
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmul st0, st1
|
||||
faddp st2, st0 ; add to autoc[6]
|
||||
fld dword [esi + 28]
|
||||
fmul st0, st1
|
||||
faddp st3, st0 ; add to autoc[7]
|
||||
fld dword [esi + 32]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st3, st0 ; add to autoc[8]
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmul st0, st1
|
||||
faddp st2, st0 ; add to autoc[6]
|
||||
fld dword [esi + 28]
|
||||
fmulp st1, st0
|
||||
add esi, byte 4 ; [CR] sample++
|
||||
faddp st2, st0 ; add to autoc[7]
|
||||
fld dword [esi]
|
||||
fld dword [esi + 24]
|
||||
fmulp st1, st0
|
||||
faddp st1, st0 ; add to autoc[6]
|
||||
fstp dword [edi + 24]
|
||||
fstp dword [edi + 28]
|
||||
fstp dword [edi + 32]
|
||||
fstp dword [edi + 36]
|
||||
fstp dword [edi + 40]
|
||||
fstp dword [edi + 44]
|
||||
jmp .end
|
||||
|
||||
.end:
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
end
|
||||
1511
flac/src/libFLAC/ia32/lpc_asm.nasm
Normal file
1511
flac/src/libFLAC/ia32/lpc_asm.nasm
Normal file
File diff suppressed because it is too large
Load Diff
BIN
flac/src/libFLAC/ia32/lpc_asm.obj
Normal file
BIN
flac/src/libFLAC/ia32/lpc_asm.obj
Normal file
Binary file not shown.
75
flac/src/libFLAC/ia32/nasm.h
Normal file
75
flac/src/libFLAC/ia32/nasm.h
Normal file
@@ -0,0 +1,75 @@
|
||||
; libFLAC - Free Lossless Audio Codec library
|
||||
; Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions
|
||||
; are met:
|
||||
;
|
||||
; - Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
;
|
||||
; - Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
;
|
||||
; - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
; contributors may be used to endorse or promote products derived from
|
||||
; this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
bits 32
|
||||
|
||||
%ifdef OBJ_FORMAT_win32
|
||||
%define FLAC__PUBLIC_NEEDS_UNDERSCORE
|
||||
%idefine code_section section .text align=16 class=CODE use32
|
||||
%idefine data_section section .data align=32 class=DATA use32
|
||||
%idefine bss_section section .bss align=32 class=DATA use32
|
||||
%elifdef OBJ_FORMAT_aout
|
||||
%define FLAC__PUBLIC_NEEDS_UNDERSCORE
|
||||
%idefine code_section section .text
|
||||
%idefine data_section section .data
|
||||
%idefine bss_section section .bss
|
||||
%elifdef OBJ_FORMAT_aoutb
|
||||
%define FLAC__PUBLIC_NEEDS_UNDERSCORE
|
||||
%idefine code_section section .text
|
||||
%idefine data_section section .data
|
||||
%idefine bss_section section .bss
|
||||
%elifdef OBJ_FORMAT_elf
|
||||
%idefine code_section section .text align=16
|
||||
%idefine data_section section .data align=32
|
||||
%idefine bss_section section .bss align=32
|
||||
%else
|
||||
%error unsupported object format!
|
||||
%endif
|
||||
|
||||
%imacro cglobal 1
|
||||
%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE
|
||||
global _%1
|
||||
%else
|
||||
global %1
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%imacro cextern 1
|
||||
%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE
|
||||
extern _%1
|
||||
%else
|
||||
extern %1
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%imacro cident 1
|
||||
_%1:
|
||||
%1:
|
||||
%endmacro
|
||||
159
flac/src/libFLAC/ia32/stream_encoder_asm.nasm
Normal file
159
flac/src/libFLAC/ia32/stream_encoder_asm.nasm
Normal file
@@ -0,0 +1,159 @@
|
||||
; vim:filetype=nasm ts=8
|
||||
|
||||
; libFLAC - Free Lossless Audio Codec library
|
||||
; Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions
|
||||
; are met:
|
||||
;
|
||||
; - Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
;
|
||||
; - Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
;
|
||||
; - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
; contributors may be used to endorse or promote products derived from
|
||||
; this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
%include "nasm.h"
|
||||
|
||||
data_section
|
||||
|
||||
cglobal precompute_partition_info_sums_32bit_asm_ia32_
|
||||
|
||||
code_section
|
||||
|
||||
|
||||
; **********************************************************************
|
||||
;
|
||||
; void FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter)
|
||||
; void precompute_partition_info_sums_32bit_(
|
||||
; const FLAC__int32 residual[],
|
||||
; FLAC__uint64 abs_residual_partition_sums[],
|
||||
; unsigned blocksize,
|
||||
; unsigned predictor_order,
|
||||
; unsigned min_partition_order,
|
||||
; unsigned max_partition_order
|
||||
; )
|
||||
;
|
||||
ALIGN 16
|
||||
cident precompute_partition_info_sums_32bit_asm_ia32_
|
||||
|
||||
;; peppered throughout the code at major checkpoints are keys like this as to where things are at that point in time
|
||||
;; [esp + 4] const FLAC__int32 residual[]
|
||||
;; [esp + 8] FLAC__uint64 abs_residual_partition_sums[]
|
||||
;; [esp + 12] unsigned blocksize
|
||||
;; [esp + 16] unsigned predictor_order
|
||||
;; [esp + 20] unsigned min_partition_order
|
||||
;; [esp + 24] unsigned max_partition_order
|
||||
push ebp
|
||||
push ebx
|
||||
push esi
|
||||
push edi
|
||||
sub esp, 8
|
||||
;; [esp + 28] const FLAC__int32 residual[]
|
||||
;; [esp + 32] FLAC__uint64 abs_residual_partition_sums[]
|
||||
;; [esp + 36] unsigned blocksize
|
||||
;; [esp + 40] unsigned predictor_order
|
||||
;; [esp + 44] unsigned min_partition_order
|
||||
;; [esp + 48] unsigned max_partition_order
|
||||
;; [esp] partitions
|
||||
;; [esp + 4] default_partition_samples
|
||||
|
||||
mov ecx, [esp + 48]
|
||||
mov eax, 1
|
||||
shl eax, cl
|
||||
mov [esp], eax ; [esp] <- partitions = 1u << max_partition_order;
|
||||
mov eax, [esp + 36]
|
||||
shr eax, cl
|
||||
mov [esp + 4], eax ; [esp + 4] <- default_partition_samples = blocksize >> max_partition_order;
|
||||
|
||||
;
|
||||
; first do max_partition_order
|
||||
;
|
||||
mov edi, [esp + 4]
|
||||
sub edi, [esp + 40] ; edi <- end = (unsigned)(-(int)predictor_order) + default_partition_samples
|
||||
xor esi, esi ; esi <- residual_sample = 0
|
||||
xor ecx, ecx ; ecx <- partition = 0
|
||||
mov ebp, [esp + 28] ; ebp <- residual[]
|
||||
xor ebx, ebx ; ebx <- abs_residual_partition_sum = 0;
|
||||
; note we put the updates to 'end' and 'abs_residual_partition_sum' at the end of loop0 and in the initialization above so we could align loop0 and loop1
|
||||
ALIGN 16
|
||||
.loop0: ; for(partition = residual_sample = 0; partition < partitions; partition++) {
|
||||
.loop1: ; for( ; residual_sample < end; residual_sample++)
|
||||
mov eax, [ebp + esi * 4]
|
||||
cdq
|
||||
xor eax, edx
|
||||
sub eax, edx
|
||||
add ebx, eax ; abs_residual_partition_sum += abs(residual[residual_sample]);
|
||||
;@@@@@@ check overflow flag and abort here?
|
||||
add esi, byte 1
|
||||
cmp esi, edi ; /* since the loop will always run at least once, we can put the loop check down here */
|
||||
jb .loop1
|
||||
.next1:
|
||||
add edi, [esp + 4] ; end += default_partition_samples;
|
||||
mov eax, [esp + 32]
|
||||
mov [eax + ecx * 8], ebx ; abs_residual_partition_sums[partition] = abs_residual_partition_sum;
|
||||
mov [eax + ecx * 8 + 4], dword 0
|
||||
xor ebx, ebx ; abs_residual_partition_sum = 0;
|
||||
add ecx, byte 1
|
||||
cmp ecx, [esp] ; /* since the loop will always run at least once, we can put the loop check down here */
|
||||
jb .loop0
|
||||
.next0: ; }
|
||||
;
|
||||
; now merge partitions for lower orders
|
||||
;
|
||||
mov esi, [esp + 32] ; esi <- abs_residual_partition_sums[from_partition==0];
|
||||
mov eax, [esp]
|
||||
lea edi, [esi + eax * 8] ; edi <- abs_residual_partition_sums[to_partition==partitions];
|
||||
mov ecx, [esp + 48]
|
||||
sub ecx, byte 1 ; ecx <- partition_order = (int)max_partition_order - 1;
|
||||
ALIGN 16
|
||||
.loop2: ; for(; partition_order >= (int)min_partition_order; partition_order--) {
|
||||
cmp ecx, [esp + 44]
|
||||
jl .next2
|
||||
mov edx, 1
|
||||
shl edx, cl ; const unsigned partitions = 1u << partition_order;
|
||||
ALIGN 16
|
||||
.loop3: ; for(i = 0; i < partitions; i++) {
|
||||
mov eax, [esi]
|
||||
mov ebx, [esi + 4]
|
||||
add eax, [esi + 8]
|
||||
adc ebx, [esi + 12]
|
||||
mov [edi], eax
|
||||
mov [edi + 4], ebx ; a_r_p_s[to_partition] = a_r_p_s[from_partition] + a_r_p_s[from_partition+1];
|
||||
add esi, byte 16
|
||||
add edi, byte 8
|
||||
sub edx, byte 1
|
||||
jnz .loop3 ; }
|
||||
sub ecx, byte 1
|
||||
jmp .loop2 ; }
|
||||
.next2:
|
||||
|
||||
add esp, 8
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
end
|
||||
|
||||
%ifdef OBJ_FORMAT_elf
|
||||
section .note.GNU-stack noalloc
|
||||
%endif
|
||||
BIN
flac/src/libFLAC/ia32/stream_encoder_asm.obj
Normal file
BIN
flac/src/libFLAC/ia32/stream_encoder_asm.obj
Normal file
Binary file not shown.
31
flac/src/libFLAC/include/Makefile.am
Normal file
31
flac/src/libFLAC/include/Makefile.am
Normal file
@@ -0,0 +1,31 @@
|
||||
# libFLAC - Free Lossless Audio Codec library
|
||||
# Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# - Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# - Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
SUBDIRS = private protected
|
||||
50
flac/src/libFLAC/include/private/Makefile.am
Normal file
50
flac/src/libFLAC/include/private/Makefile.am
Normal file
@@ -0,0 +1,50 @@
|
||||
# libFLAC - Free Lossless Audio Codec library
|
||||
# Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# - Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# - Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
noinst_HEADERS = \
|
||||
all.h \
|
||||
bitmath.h \
|
||||
bitreader.h \
|
||||
bitwriter.h \
|
||||
cpu.h \
|
||||
crc.h \
|
||||
fixed.h \
|
||||
float.h \
|
||||
format.h \
|
||||
lpc.h \
|
||||
md5.h \
|
||||
memory.h \
|
||||
metadata.h \
|
||||
ogg_decoder_aspect.h \
|
||||
ogg_encoder_aspect.h \
|
||||
ogg_helper.h \
|
||||
ogg_mapping.h \
|
||||
stream_encoder_framing.h \
|
||||
window.h
|
||||
49
flac/src/libFLAC/include/private/all.h
Normal file
49
flac/src/libFLAC/include/private/all.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__ALL_H
|
||||
#define FLAC__PRIVATE__ALL_H
|
||||
|
||||
#include "bitmath.h"
|
||||
#include "bitreader.h"
|
||||
#include "bitwriter.h"
|
||||
#include "cpu.h"
|
||||
#include "crc.h"
|
||||
#include "fixed.h"
|
||||
#include "float.h"
|
||||
#include "format.h"
|
||||
#include "lpc.h"
|
||||
#include "md5.h"
|
||||
#include "memory.h"
|
||||
#include "metadata.h"
|
||||
#include "stream_encoder_framing.h"
|
||||
|
||||
#endif
|
||||
42
flac/src/libFLAC/include/private/bitmath.h
Normal file
42
flac/src/libFLAC/include/private/bitmath.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__BITMATH_H
|
||||
#define FLAC__PRIVATE__BITMATH_H
|
||||
|
||||
#include "FLAC/ordinals.h"
|
||||
|
||||
unsigned FLAC__bitmath_ilog2(FLAC__uint32 v);
|
||||
unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v);
|
||||
unsigned FLAC__bitmath_silog2(int v);
|
||||
unsigned FLAC__bitmath_silog2_wide(FLAC__int64 v);
|
||||
|
||||
#endif
|
||||
99
flac/src/libFLAC/include/private/bitreader.h
Normal file
99
flac/src/libFLAC/include/private/bitreader.h
Normal file
@@ -0,0 +1,99 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__BITREADER_H
|
||||
#define FLAC__PRIVATE__BITREADER_H
|
||||
|
||||
#include <stdio.h> /* for FILE */
|
||||
#include "FLAC/ordinals.h"
|
||||
#include "cpu.h"
|
||||
|
||||
/*
|
||||
* opaque structure definition
|
||||
*/
|
||||
struct FLAC__BitReader;
|
||||
typedef struct FLAC__BitReader FLAC__BitReader;
|
||||
|
||||
typedef FLAC__bool (*FLAC__BitReaderReadCallback)(FLAC__byte buffer[], size_t *bytes, void *client_data);
|
||||
|
||||
/*
|
||||
* construction, deletion, initialization, etc functions
|
||||
*/
|
||||
FLAC__BitReader *FLAC__bitreader_new(void);
|
||||
void FLAC__bitreader_delete(FLAC__BitReader *br);
|
||||
FLAC__bool FLAC__bitreader_init(FLAC__BitReader *br, FLAC__CPUInfo cpu, FLAC__BitReaderReadCallback rcb, void *cd);
|
||||
void FLAC__bitreader_free(FLAC__BitReader *br); /* does not 'free(br)' */
|
||||
FLAC__bool FLAC__bitreader_clear(FLAC__BitReader *br);
|
||||
void FLAC__bitreader_dump(const FLAC__BitReader *br, FILE *out);
|
||||
|
||||
/*
|
||||
* CRC functions
|
||||
*/
|
||||
void FLAC__bitreader_reset_read_crc16(FLAC__BitReader *br, FLAC__uint16 seed);
|
||||
FLAC__uint16 FLAC__bitreader_get_read_crc16(FLAC__BitReader *br);
|
||||
|
||||
/*
|
||||
* info functions
|
||||
*/
|
||||
FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br);
|
||||
unsigned FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br);
|
||||
unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br);
|
||||
|
||||
/*
|
||||
* read functions
|
||||
*/
|
||||
|
||||
FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *val, unsigned bits);
|
||||
FLAC__bool FLAC__bitreader_read_raw_int32(FLAC__BitReader *br, FLAC__int32 *val, unsigned bits);
|
||||
FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *val, unsigned bits);
|
||||
FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val); /*only for bits=32*/
|
||||
FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, unsigned bits); /* WATCHOUT: does not CRC the skipped data! */ /*@@@@ add to unit tests */
|
||||
FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, unsigned nvals); /* WATCHOUT: does not CRC the read data! */
|
||||
FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, FLAC__byte *val, unsigned nvals); /* WATCHOUT: does not CRC the read data! */
|
||||
FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, unsigned *val);
|
||||
FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, unsigned parameter);
|
||||
FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter);
|
||||
#ifndef FLAC__NO_ASM
|
||||
# ifdef FLAC__CPU_IA32
|
||||
# ifdef FLAC__HAS_NASM
|
||||
FLAC__bool FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter);
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#if 0 /* UNUSED */
|
||||
FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, unsigned parameter);
|
||||
FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, unsigned *val, unsigned parameter);
|
||||
#endif
|
||||
FLAC__bool FLAC__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *val, FLAC__byte *raw, unsigned *rawlen);
|
||||
FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *val, FLAC__byte *raw, unsigned *rawlen);
|
||||
|
||||
FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br);
|
||||
#endif
|
||||
103
flac/src/libFLAC/include/private/bitwriter.h
Normal file
103
flac/src/libFLAC/include/private/bitwriter.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__BITWRITER_H
|
||||
#define FLAC__PRIVATE__BITWRITER_H
|
||||
|
||||
#include <stdio.h> /* for FILE */
|
||||
#include "FLAC/ordinals.h"
|
||||
|
||||
/*
|
||||
* opaque structure definition
|
||||
*/
|
||||
struct FLAC__BitWriter;
|
||||
typedef struct FLAC__BitWriter FLAC__BitWriter;
|
||||
|
||||
/*
|
||||
* construction, deletion, initialization, etc functions
|
||||
*/
|
||||
FLAC__BitWriter *FLAC__bitwriter_new(void);
|
||||
void FLAC__bitwriter_delete(FLAC__BitWriter *bw);
|
||||
FLAC__bool FLAC__bitwriter_init(FLAC__BitWriter *bw);
|
||||
void FLAC__bitwriter_free(FLAC__BitWriter *bw); /* does not 'free(buffer)' */
|
||||
void FLAC__bitwriter_clear(FLAC__BitWriter *bw);
|
||||
void FLAC__bitwriter_dump(const FLAC__BitWriter *bw, FILE *out);
|
||||
|
||||
/*
|
||||
* CRC functions
|
||||
*
|
||||
* non-const *bw because they have to cal FLAC__bitwriter_get_buffer()
|
||||
*/
|
||||
FLAC__bool FLAC__bitwriter_get_write_crc16(FLAC__BitWriter *bw, FLAC__uint16 *crc);
|
||||
FLAC__bool FLAC__bitwriter_get_write_crc8(FLAC__BitWriter *bw, FLAC__byte *crc);
|
||||
|
||||
/*
|
||||
* info functions
|
||||
*/
|
||||
FLAC__bool FLAC__bitwriter_is_byte_aligned(const FLAC__BitWriter *bw);
|
||||
unsigned FLAC__bitwriter_get_input_bits_unconsumed(const FLAC__BitWriter *bw); /* can be called anytime, returns total # of bits unconsumed */
|
||||
|
||||
/*
|
||||
* direct buffer access
|
||||
*
|
||||
* there may be no calls on the bitwriter between get and release.
|
||||
* the bitwriter continues to own the returned buffer.
|
||||
* before get, bitwriter MUST be byte aligned: check with FLAC__bitwriter_is_byte_aligned()
|
||||
*/
|
||||
FLAC__bool FLAC__bitwriter_get_buffer(FLAC__BitWriter *bw, const FLAC__byte **buffer, size_t *bytes);
|
||||
void FLAC__bitwriter_release_buffer(FLAC__BitWriter *bw);
|
||||
|
||||
/*
|
||||
* write functions
|
||||
*/
|
||||
FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsigned bits);
|
||||
FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, unsigned bits);
|
||||
FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, unsigned bits);
|
||||
FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, unsigned bits);
|
||||
FLAC__bool FLAC__bitwriter_write_raw_uint32_little_endian(FLAC__BitWriter *bw, FLAC__uint32 val); /*only for bits=32*/
|
||||
FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], unsigned nvals);
|
||||
FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, unsigned val);
|
||||
unsigned FLAC__bitwriter_rice_bits(FLAC__int32 val, unsigned parameter);
|
||||
#if 0 /* UNUSED */
|
||||
unsigned FLAC__bitwriter_golomb_bits_signed(int val, unsigned parameter);
|
||||
unsigned FLAC__bitwriter_golomb_bits_unsigned(unsigned val, unsigned parameter);
|
||||
#endif
|
||||
FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 val, unsigned parameter);
|
||||
FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FLAC__int32 *vals, unsigned nvals, unsigned parameter);
|
||||
#if 0 /* UNUSED */
|
||||
FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, unsigned parameter);
|
||||
FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, unsigned val, unsigned parameter);
|
||||
#endif
|
||||
FLAC__bool FLAC__bitwriter_write_utf8_uint32(FLAC__BitWriter *bw, FLAC__uint32 val);
|
||||
FLAC__bool FLAC__bitwriter_write_utf8_uint64(FLAC__BitWriter *bw, FLAC__uint64 val);
|
||||
FLAC__bool FLAC__bitwriter_zero_pad_to_byte_boundary(FLAC__BitWriter *bw);
|
||||
|
||||
#endif
|
||||
88
flac/src/libFLAC/include/private/cpu.h
Normal file
88
flac/src/libFLAC/include/private/cpu.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__CPU_H
|
||||
#define FLAC__PRIVATE__CPU_H
|
||||
|
||||
#include "FLAC/ordinals.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
FLAC__CPUINFO_TYPE_IA32,
|
||||
FLAC__CPUINFO_TYPE_PPC,
|
||||
FLAC__CPUINFO_TYPE_UNKNOWN
|
||||
} FLAC__CPUInfo_Type;
|
||||
|
||||
typedef struct {
|
||||
FLAC__bool cpuid;
|
||||
FLAC__bool bswap;
|
||||
FLAC__bool cmov;
|
||||
FLAC__bool mmx;
|
||||
FLAC__bool fxsr;
|
||||
FLAC__bool sse;
|
||||
FLAC__bool sse2;
|
||||
FLAC__bool sse3;
|
||||
FLAC__bool ssse3;
|
||||
FLAC__bool _3dnow;
|
||||
FLAC__bool ext3dnow;
|
||||
FLAC__bool extmmx;
|
||||
} FLAC__CPUInfo_IA32;
|
||||
|
||||
typedef struct {
|
||||
FLAC__bool altivec;
|
||||
FLAC__bool ppc64;
|
||||
} FLAC__CPUInfo_PPC;
|
||||
|
||||
typedef struct {
|
||||
FLAC__bool use_asm;
|
||||
FLAC__CPUInfo_Type type;
|
||||
union {
|
||||
FLAC__CPUInfo_IA32 ia32;
|
||||
FLAC__CPUInfo_PPC ppc;
|
||||
} data;
|
||||
} FLAC__CPUInfo;
|
||||
|
||||
void FLAC__cpu_info(FLAC__CPUInfo *info);
|
||||
|
||||
#ifndef FLAC__NO_ASM
|
||||
#ifdef FLAC__CPU_IA32
|
||||
#ifdef FLAC__HAS_NASM
|
||||
FLAC__uint32 FLAC__cpu_have_cpuid_asm_ia32(void);
|
||||
void FLAC__cpu_info_asm_ia32(FLAC__uint32 *flags_edx, FLAC__uint32 *flags_ecx);
|
||||
FLAC__uint32 FLAC__cpu_info_extended_amd_asm_ia32(void);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
61
flac/src/libFLAC/include/private/crc.h
Normal file
61
flac/src/libFLAC/include/private/crc.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__CRC_H
|
||||
#define FLAC__PRIVATE__CRC_H
|
||||
|
||||
#include "FLAC/ordinals.h"
|
||||
|
||||
/* 8 bit CRC generator, MSB shifted first
|
||||
** polynomial = x^8 + x^2 + x^1 + x^0
|
||||
** init = 0
|
||||
*/
|
||||
extern FLAC__byte const FLAC__crc8_table[256];
|
||||
#define FLAC__CRC8_UPDATE(data, crc) (crc) = FLAC__crc8_table[(crc) ^ (data)];
|
||||
void FLAC__crc8_update(const FLAC__byte data, FLAC__uint8 *crc);
|
||||
void FLAC__crc8_update_block(const FLAC__byte *data, unsigned len, FLAC__uint8 *crc);
|
||||
FLAC__uint8 FLAC__crc8(const FLAC__byte *data, unsigned len);
|
||||
|
||||
/* 16 bit CRC generator, MSB shifted first
|
||||
** polynomial = x^16 + x^15 + x^2 + x^0
|
||||
** init = 0
|
||||
*/
|
||||
extern unsigned const FLAC__crc16_table[256];
|
||||
|
||||
#define FLAC__CRC16_UPDATE(data, crc) (((((crc)<<8) & 0xffff) ^ FLAC__crc16_table[((crc)>>8) ^ (data)]))
|
||||
/* this alternate may be faster on some systems/compilers */
|
||||
#if 0
|
||||
#define FLAC__CRC16_UPDATE(data, crc) ((((crc)<<8) ^ FLAC__crc16_table[((crc)>>8) ^ (data)]) & 0xffff)
|
||||
#endif
|
||||
|
||||
unsigned FLAC__crc16(const FLAC__byte *data, unsigned len);
|
||||
|
||||
#endif
|
||||
97
flac/src/libFLAC/include/private/fixed.h
Normal file
97
flac/src/libFLAC/include/private/fixed.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__FIXED_H
|
||||
#define FLAC__PRIVATE__FIXED_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "private/float.h"
|
||||
#include "FLAC/format.h"
|
||||
|
||||
/*
|
||||
* FLAC__fixed_compute_best_predictor()
|
||||
* --------------------------------------------------------------------
|
||||
* Compute the best fixed predictor and the expected bits-per-sample
|
||||
* of the residual signal for each order. The _wide() version uses
|
||||
* 64-bit integers which is statistically necessary when bits-per-
|
||||
* sample + log2(blocksize) > 30
|
||||
*
|
||||
* IN data[0,data_len-1]
|
||||
* IN data_len
|
||||
* OUT residual_bits_per_sample[0,FLAC__MAX_FIXED_ORDER]
|
||||
*/
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
|
||||
# ifndef FLAC__NO_ASM
|
||||
# ifdef FLAC__CPU_IA32
|
||||
# ifdef FLAC__HAS_NASM
|
||||
unsigned FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
|
||||
#else
|
||||
unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
|
||||
unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* FLAC__fixed_compute_residual()
|
||||
* --------------------------------------------------------------------
|
||||
* Compute the residual signal obtained from sutracting the predicted
|
||||
* signal from the original.
|
||||
*
|
||||
* IN data[-order,data_len-1] original signal (NOTE THE INDICES!)
|
||||
* IN data_len length of original signal
|
||||
* IN order <= FLAC__MAX_FIXED_ORDER fixed-predictor order
|
||||
* OUT residual[0,data_len-1] residual signal
|
||||
*/
|
||||
void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, unsigned order, FLAC__int32 residual[]);
|
||||
|
||||
/*
|
||||
* FLAC__fixed_restore_signal()
|
||||
* --------------------------------------------------------------------
|
||||
* Restore the original signal by summing the residual and the
|
||||
* predictor.
|
||||
*
|
||||
* IN residual[0,data_len-1] residual signal
|
||||
* IN data_len length of original signal
|
||||
* IN order <= FLAC__MAX_FIXED_ORDER fixed-predictor order
|
||||
* *** IMPORTANT: the caller must pass in the historical samples:
|
||||
* IN data[-order,-1] previously-reconstructed historical samples
|
||||
* OUT data[0,data_len-1] original signal
|
||||
*/
|
||||
void FLAC__fixed_restore_signal(const FLAC__int32 residual[], unsigned data_len, unsigned order, FLAC__int32 data[]);
|
||||
|
||||
#endif
|
||||
97
flac/src/libFLAC/include/private/float.h
Normal file
97
flac/src/libFLAC/include/private/float.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__FLOAT_H
|
||||
#define FLAC__PRIVATE__FLOAT_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "FLAC/ordinals.h"
|
||||
|
||||
/*
|
||||
* These typedefs make it easier to ensure that integer versions of
|
||||
* the library really only contain integer operations. All the code
|
||||
* in libFLAC should use FLAC__float and FLAC__double in place of
|
||||
* float and double, and be protected by checks of the macro
|
||||
* FLAC__INTEGER_ONLY_LIBRARY.
|
||||
*
|
||||
* FLAC__real is the basic floating point type used in LPC analysis.
|
||||
*/
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
typedef double FLAC__double;
|
||||
typedef float FLAC__float;
|
||||
/*
|
||||
* WATCHOUT: changing FLAC__real will change the signatures of many
|
||||
* functions that have assembly language equivalents and break them.
|
||||
*/
|
||||
typedef float FLAC__real;
|
||||
#else
|
||||
/*
|
||||
* The convention for FLAC__fixedpoint is to use the upper 16 bits
|
||||
* for the integer part and lower 16 bits for the fractional part.
|
||||
*/
|
||||
typedef FLAC__int32 FLAC__fixedpoint;
|
||||
extern const FLAC__fixedpoint FLAC__FP_ZERO;
|
||||
extern const FLAC__fixedpoint FLAC__FP_ONE_HALF;
|
||||
extern const FLAC__fixedpoint FLAC__FP_ONE;
|
||||
extern const FLAC__fixedpoint FLAC__FP_LN2;
|
||||
extern const FLAC__fixedpoint FLAC__FP_E;
|
||||
|
||||
#define FLAC__fixedpoint_trunc(x) ((x)>>16)
|
||||
|
||||
#define FLAC__fixedpoint_mul(x, y) ( (FLAC__fixedpoint) ( ((FLAC__int64)(x)*(FLAC__int64)(y)) >> 16 ) )
|
||||
|
||||
#define FLAC__fixedpoint_div(x, y) ( (FLAC__fixedpoint) ( ( ((FLAC__int64)(x)<<32) / (FLAC__int64)(y) ) >> 16 ) )
|
||||
|
||||
/*
|
||||
* FLAC__fixedpoint_log2()
|
||||
* --------------------------------------------------------------------
|
||||
* Returns the base-2 logarithm of the fixed-point number 'x' using an
|
||||
* algorithm by Knuth for x >= 1.0
|
||||
*
|
||||
* 'fracbits' is the number of fractional bits of 'x'. 'fracbits' must
|
||||
* be < 32 and evenly divisible by 4 (0 is OK but not very precise).
|
||||
*
|
||||
* 'precision' roughly limits the number of iterations that are done;
|
||||
* use (unsigned)(-1) for maximum precision.
|
||||
*
|
||||
* If 'x' is less than one -- that is, x < (1<<fracbits) -- then this
|
||||
* function will punt and return 0.
|
||||
*
|
||||
* The return value will also have 'fracbits' fractional bits.
|
||||
*/
|
||||
FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, unsigned fracbits, unsigned precision);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
44
flac/src/libFLAC/include/private/format.h
Normal file
44
flac/src/libFLAC/include/private/format.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__FORMAT_H
|
||||
#define FLAC__PRIVATE__FORMAT_H
|
||||
|
||||
#include "FLAC/format.h"
|
||||
|
||||
unsigned FLAC__format_get_max_rice_partition_order(unsigned blocksize, unsigned predictor_order);
|
||||
unsigned FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned blocksize);
|
||||
unsigned FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(unsigned limit, unsigned blocksize, unsigned predictor_order);
|
||||
void FLAC__format_entropy_coding_method_partitioned_rice_contents_init(FLAC__EntropyCodingMethod_PartitionedRiceContents *object);
|
||||
void FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(FLAC__EntropyCodingMethod_PartitionedRiceContents *object);
|
||||
FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, unsigned max_partition_order);
|
||||
|
||||
#endif
|
||||
214
flac/src/libFLAC/include/private/lpc.h
Normal file
214
flac/src/libFLAC/include/private/lpc.h
Normal file
@@ -0,0 +1,214 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__LPC_H
|
||||
#define FLAC__PRIVATE__LPC_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "private/float.h"
|
||||
#include "FLAC/format.h"
|
||||
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
|
||||
/*
|
||||
* FLAC__lpc_window_data()
|
||||
* --------------------------------------------------------------------
|
||||
* Applies the given window to the data.
|
||||
* OPT: asm implementation
|
||||
*
|
||||
* 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__int32 in[], const FLAC__real window[], FLAC__real out[], unsigned data_len);
|
||||
|
||||
/*
|
||||
* FLAC__lpc_compute_autocorrelation()
|
||||
* --------------------------------------------------------------------
|
||||
* Compute the autocorrelation for lags between 0 and lag-1.
|
||||
* Assumes data[] outside of [0,data_len-1] == 0.
|
||||
* Asserts that lag > 0.
|
||||
*
|
||||
* IN data[0,data_len-1]
|
||||
* IN data_len
|
||||
* IN 0 < lag <= data_len
|
||||
* OUT autoc[0,lag-1]
|
||||
*/
|
||||
void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
#ifndef FLAC__NO_ASM
|
||||
# ifdef FLAC__CPU_IA32
|
||||
# ifdef FLAC__HAS_NASM
|
||||
void FLAC__lpc_compute_autocorrelation_asm_ia32(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
void FLAC__lpc_compute_autocorrelation_asm_ia32_3dnow(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* FLAC__lpc_compute_lp_coefficients()
|
||||
* --------------------------------------------------------------------
|
||||
* Computes LP coefficients for orders 1..max_order.
|
||||
* Do not call if autoc[0] == 0.0. This means the signal is zero
|
||||
* and there is no point in calculating a predictor.
|
||||
*
|
||||
* IN autoc[0,max_order] autocorrelation values
|
||||
* IN 0 < max_order <= FLAC__MAX_LPC_ORDER max LP order to compute
|
||||
* OUT lp_coeff[0,max_order-1][0,max_order-1] LP coefficients for each order
|
||||
* *** IMPORTANT:
|
||||
* *** lp_coeff[0,max_order-1][max_order,FLAC__MAX_LPC_ORDER-1] are untouched
|
||||
* OUT error[0,max_order-1] error for each order (more
|
||||
* specifically, the variance of
|
||||
* the error signal times # of
|
||||
* samples in the signal)
|
||||
*
|
||||
* Example: if max_order is 9, the LP coefficients for order 9 will be
|
||||
* in lp_coeff[8][0,8], the LP coefficients for order 8 will be
|
||||
* in lp_coeff[7][0,7], etc.
|
||||
*/
|
||||
void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], FLAC__double error[]);
|
||||
|
||||
/*
|
||||
* FLAC__lpc_quantize_coefficients()
|
||||
* --------------------------------------------------------------------
|
||||
* Quantizes the LP coefficients. NOTE: precision + bits_per_sample
|
||||
* must be less than 32 (sizeof(FLAC__int32)*8).
|
||||
*
|
||||
* IN lp_coeff[0,order-1] LP coefficients
|
||||
* IN order LP order
|
||||
* IN FLAC__MIN_QLP_COEFF_PRECISION < precision
|
||||
* desired precision (in bits, including sign
|
||||
* bit) of largest coefficient
|
||||
* OUT qlp_coeff[0,order-1] quantized coefficients
|
||||
* OUT shift # of bits to shift right to get approximated
|
||||
* LP coefficients. NOTE: could be negative.
|
||||
* RETURN 0 => quantization OK
|
||||
* 1 => coefficients require too much shifting for *shift to
|
||||
* fit in the LPC subframe header. 'shift' is unset.
|
||||
* 2 => coefficients are all zero, which is bad. 'shift' is
|
||||
* unset.
|
||||
*/
|
||||
int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order, unsigned precision, FLAC__int32 qlp_coeff[], int *shift);
|
||||
|
||||
/*
|
||||
* FLAC__lpc_compute_residual_from_qlp_coefficients()
|
||||
* --------------------------------------------------------------------
|
||||
* Compute the residual signal obtained from sutracting the predicted
|
||||
* signal from the original.
|
||||
*
|
||||
* IN data[-order,data_len-1] original signal (NOTE THE INDICES!)
|
||||
* IN data_len length of original signal
|
||||
* IN qlp_coeff[0,order-1] quantized LP coefficients
|
||||
* IN order > 0 LP order
|
||||
* IN lp_quantization quantization of LP coefficients in bits
|
||||
* OUT residual[0,data_len-1] residual signal
|
||||
*/
|
||||
void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
|
||||
void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
|
||||
#ifndef FLAC__NO_ASM
|
||||
# ifdef FLAC__CPU_IA32
|
||||
# ifdef FLAC__HAS_NASM
|
||||
void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
|
||||
void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */
|
||||
|
||||
/*
|
||||
* FLAC__lpc_restore_signal()
|
||||
* --------------------------------------------------------------------
|
||||
* Restore the original signal by summing the residual and the
|
||||
* predictor.
|
||||
*
|
||||
* IN residual[0,data_len-1] residual signal
|
||||
* IN data_len length of original signal
|
||||
* IN qlp_coeff[0,order-1] quantized LP coefficients
|
||||
* IN order > 0 LP order
|
||||
* IN lp_quantization quantization of LP coefficients in bits
|
||||
* *** IMPORTANT: the caller must pass in the historical samples:
|
||||
* IN data[-order,-1] previously-reconstructed historical samples
|
||||
* OUT data[0,data_len-1] original signal
|
||||
*/
|
||||
void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
|
||||
void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
|
||||
#ifndef FLAC__NO_ASM
|
||||
# ifdef FLAC__CPU_IA32
|
||||
# ifdef FLAC__HAS_NASM
|
||||
void FLAC__lpc_restore_signal_asm_ia32(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
|
||||
void FLAC__lpc_restore_signal_asm_ia32_mmx(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
|
||||
# endif /* FLAC__HAS_NASM */
|
||||
# elif defined FLAC__CPU_PPC
|
||||
void FLAC__lpc_restore_signal_asm_ppc_altivec_16(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
|
||||
void FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
|
||||
# endif/* FLAC__CPU_IA32 || FLAC__CPU_PPC */
|
||||
#endif /* FLAC__NO_ASM */
|
||||
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
|
||||
/*
|
||||
* FLAC__lpc_compute_expected_bits_per_residual_sample()
|
||||
* --------------------------------------------------------------------
|
||||
* Compute the expected number of bits per residual signal sample
|
||||
* based on the LP error (which is related to the residual variance).
|
||||
*
|
||||
* IN lpc_error >= 0.0 error returned from calculating LP coefficients
|
||||
* IN total_samples > 0 # of samples in residual signal
|
||||
* RETURN expected bits per sample
|
||||
*/
|
||||
FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample(FLAC__double lpc_error, unsigned total_samples);
|
||||
FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(FLAC__double lpc_error, FLAC__double error_scale);
|
||||
|
||||
/*
|
||||
* FLAC__lpc_compute_best_order()
|
||||
* --------------------------------------------------------------------
|
||||
* Compute the best order from the array of signal errors returned
|
||||
* during coefficient computation.
|
||||
*
|
||||
* IN lpc_error[0,max_order-1] >= 0.0 error returned from calculating LP coefficients
|
||||
* IN max_order > 0 max LP order
|
||||
* IN total_samples > 0 # of samples in residual signal
|
||||
* IN overhead_bits_per_order # of bits overhead for each increased LP order
|
||||
* (includes warmup sample size and quantized LP coefficient)
|
||||
* RETURN [1,max_order] best order
|
||||
*/
|
||||
unsigned FLAC__lpc_compute_best_order(const FLAC__double lpc_error[], unsigned max_order, unsigned total_samples, unsigned overhead_bits_per_order);
|
||||
|
||||
#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */
|
||||
|
||||
#endif
|
||||
44
flac/src/libFLAC/include/private/md5.h
Normal file
44
flac/src/libFLAC/include/private/md5.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef FLAC__PRIVATE__MD5_H
|
||||
#define FLAC__PRIVATE__MD5_H
|
||||
|
||||
/*
|
||||
* This is the header file for the MD5 message-digest algorithm.
|
||||
* The algorithm is due to Ron Rivest. This code was
|
||||
* written by Colin Plumb in 1993, no copyright is claimed.
|
||||
* This code is in the public domain; do with it what you wish.
|
||||
*
|
||||
* Equivalent code is available from RSA Data Security, Inc.
|
||||
* This code has been tested against that, and is equivalent,
|
||||
* except that you don't need to include two pages of legalese
|
||||
* with every copy.
|
||||
*
|
||||
* To compute the message digest of a chunk of bytes, declare an
|
||||
* MD5Context structure, pass it to MD5Init, call MD5Update as
|
||||
* needed on buffers full of bytes, and then call MD5Final, which
|
||||
* will fill a supplied 16-byte array with the digest.
|
||||
*
|
||||
* Changed so as no longer to depend on Colin Plumb's `usual.h'
|
||||
* header definitions; now uses stuff from dpkg's config.h
|
||||
* - Ian Jackson <ijackson@nyx.cs.du.edu>.
|
||||
* Still in the public domain.
|
||||
*
|
||||
* Josh Coalson: made some changes to integrate with libFLAC.
|
||||
* Still in the public domain, with no warranty.
|
||||
*/
|
||||
|
||||
#include "FLAC/ordinals.h"
|
||||
|
||||
typedef struct {
|
||||
FLAC__uint32 in[16];
|
||||
FLAC__uint32 buf[4];
|
||||
FLAC__uint32 bytes[2];
|
||||
FLAC__byte *internal_buf;
|
||||
size_t capacity;
|
||||
} FLAC__MD5Context;
|
||||
|
||||
void FLAC__MD5Init(FLAC__MD5Context *context);
|
||||
void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *context);
|
||||
|
||||
FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample);
|
||||
|
||||
#endif
|
||||
56
flac/src/libFLAC/include/private/memory.h
Normal file
56
flac/src/libFLAC/include/private/memory.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__MEMORY_H
|
||||
#define FLAC__PRIVATE__MEMORY_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h> /* for size_t */
|
||||
|
||||
#include "private/float.h"
|
||||
#include "FLAC/ordinals.h" /* for FLAC__bool */
|
||||
|
||||
/* Returns the unaligned address returned by malloc.
|
||||
* Use free() on this address to deallocate.
|
||||
*/
|
||||
void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address);
|
||||
FLAC__bool FLAC__memory_alloc_aligned_int32_array(unsigned elements, FLAC__int32 **unaligned_pointer, FLAC__int32 **aligned_pointer);
|
||||
FLAC__bool FLAC__memory_alloc_aligned_uint32_array(unsigned elements, FLAC__uint32 **unaligned_pointer, FLAC__uint32 **aligned_pointer);
|
||||
FLAC__bool FLAC__memory_alloc_aligned_uint64_array(unsigned elements, FLAC__uint64 **unaligned_pointer, FLAC__uint64 **aligned_pointer);
|
||||
FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(unsigned elements, unsigned **unaligned_pointer, unsigned **aligned_pointer);
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
FLAC__bool FLAC__memory_alloc_aligned_real_array(unsigned elements, FLAC__real **unaligned_pointer, FLAC__real **aligned_pointer);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
45
flac/src/libFLAC/include/private/metadata.h
Normal file
45
flac/src/libFLAC/include/private/metadata.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__METADATA_H
|
||||
#define FLAC__PRIVATE__METADATA_H
|
||||
|
||||
#include "FLAC/metadata.h"
|
||||
|
||||
/* WATCHOUT: all malloc()ed data in the block is free()ed; this may not
|
||||
* be a consistent state (e.g. PICTURE) or equivalent to the initial
|
||||
* state after FLAC__metadata_object_new()
|
||||
*/
|
||||
void FLAC__metadata_object_delete_data(FLAC__StreamMetadata *object);
|
||||
|
||||
void FLAC__metadata_object_cuesheet_track_delete_data(FLAC__StreamMetadata_CueSheet_Track *object);
|
||||
|
||||
#endif
|
||||
79
flac/src/libFLAC/include/private/ogg_decoder_aspect.h
Normal file
79
flac/src/libFLAC/include/private/ogg_decoder_aspect.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/* libFLAC - Free Lossless Audio Codec
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__OGG_DECODER_ASPECT_H
|
||||
#define FLAC__PRIVATE__OGG_DECODER_ASPECT_H
|
||||
|
||||
#include <ogg/ogg.h>
|
||||
|
||||
#include "FLAC/ordinals.h"
|
||||
#include "FLAC/stream_decoder.h" /* for FLAC__StreamDecoderReadStatus */
|
||||
|
||||
typedef struct FLAC__OggDecoderAspect {
|
||||
/* these are storage for values that can be set through the API */
|
||||
FLAC__bool use_first_serial_number;
|
||||
long serial_number;
|
||||
|
||||
/* these are for internal state related to Ogg decoding */
|
||||
ogg_stream_state stream_state;
|
||||
ogg_sync_state sync_state;
|
||||
unsigned version_major, version_minor;
|
||||
FLAC__bool need_serial_number;
|
||||
FLAC__bool end_of_stream;
|
||||
FLAC__bool have_working_page; /* only if true will the following vars be valid */
|
||||
ogg_page working_page;
|
||||
FLAC__bool have_working_packet; /* only if true will the following vars be valid */
|
||||
ogg_packet working_packet; /* as we work through the packet we will move working_packet.packet forward and working_packet.bytes down */
|
||||
} FLAC__OggDecoderAspect;
|
||||
|
||||
void FLAC__ogg_decoder_aspect_set_serial_number(FLAC__OggDecoderAspect *aspect, long value);
|
||||
void FLAC__ogg_decoder_aspect_set_defaults(FLAC__OggDecoderAspect *aspect);
|
||||
FLAC__bool FLAC__ogg_decoder_aspect_init(FLAC__OggDecoderAspect *aspect);
|
||||
void FLAC__ogg_decoder_aspect_finish(FLAC__OggDecoderAspect *aspect);
|
||||
void FLAC__ogg_decoder_aspect_flush(FLAC__OggDecoderAspect *aspect);
|
||||
void FLAC__ogg_decoder_aspect_reset(FLAC__OggDecoderAspect *aspect);
|
||||
|
||||
typedef enum {
|
||||
FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK = 0,
|
||||
FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM,
|
||||
FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC,
|
||||
FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC,
|
||||
FLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION,
|
||||
FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT,
|
||||
FLAC__OGG_DECODER_ASPECT_READ_STATUS_ERROR,
|
||||
FLAC__OGG_DECODER_ASPECT_READ_STATUS_MEMORY_ALLOCATION_ERROR
|
||||
} FLAC__OggDecoderAspectReadStatus;
|
||||
|
||||
typedef FLAC__OggDecoderAspectReadStatus (*FLAC__OggDecoderAspectReadCallbackProxy)(const void *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
|
||||
|
||||
FLAC__OggDecoderAspectReadStatus FLAC__ogg_decoder_aspect_read_callback_wrapper(FLAC__OggDecoderAspect *aspect, FLAC__byte buffer[], size_t *bytes, FLAC__OggDecoderAspectReadCallbackProxy read_callback, const FLAC__StreamDecoder *decoder, void *client_data);
|
||||
|
||||
#endif
|
||||
62
flac/src/libFLAC/include/private/ogg_encoder_aspect.h
Normal file
62
flac/src/libFLAC/include/private/ogg_encoder_aspect.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* libFLAC - Free Lossless Audio Codec
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__OGG_ENCODER_ASPECT_H
|
||||
#define FLAC__PRIVATE__OGG_ENCODER_ASPECT_H
|
||||
|
||||
#include <ogg/ogg.h>
|
||||
|
||||
#include "FLAC/ordinals.h"
|
||||
#include "FLAC/stream_encoder.h" /* for FLAC__StreamEncoderWriteStatus */
|
||||
|
||||
typedef struct FLAC__OggEncoderAspect {
|
||||
/* these are storage for values that can be set through the API */
|
||||
long serial_number;
|
||||
unsigned num_metadata;
|
||||
|
||||
/* these are for internal state related to Ogg encoding */
|
||||
ogg_stream_state stream_state;
|
||||
ogg_page page;
|
||||
FLAC__bool seen_magic; /* true if we've seen the fLaC magic in the write callback yet */
|
||||
FLAC__bool is_first_packet;
|
||||
FLAC__uint64 samples_written;
|
||||
} FLAC__OggEncoderAspect;
|
||||
|
||||
void FLAC__ogg_encoder_aspect_set_serial_number(FLAC__OggEncoderAspect *aspect, long value);
|
||||
FLAC__bool FLAC__ogg_encoder_aspect_set_num_metadata(FLAC__OggEncoderAspect *aspect, unsigned value);
|
||||
void FLAC__ogg_encoder_aspect_set_defaults(FLAC__OggEncoderAspect *aspect);
|
||||
FLAC__bool FLAC__ogg_encoder_aspect_init(FLAC__OggEncoderAspect *aspect);
|
||||
void FLAC__ogg_encoder_aspect_finish(FLAC__OggEncoderAspect *aspect);
|
||||
|
||||
typedef FLAC__StreamEncoderWriteStatus (*FLAC__OggEncoderAspectWriteCallbackProxy)(const void *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data);
|
||||
|
||||
FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data);
|
||||
#endif
|
||||
43
flac/src/libFLAC/include/private/ogg_helper.h
Normal file
43
flac/src/libFLAC/include/private/ogg_helper.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* libFLAC - Free Lossless Audio Codec
|
||||
* Copyright (C) 2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__OGG_HELPER_H
|
||||
#define FLAC__PRIVATE__OGG_HELPER_H
|
||||
|
||||
#include <ogg/ogg.h>
|
||||
#include "FLAC/stream_encoder.h" /* for FLAC__StreamEncoder */
|
||||
|
||||
void simple_ogg_page__init(ogg_page *page);
|
||||
void simple_ogg_page__clear(ogg_page *page);
|
||||
FLAC__bool simple_ogg_page__get_at(FLAC__StreamEncoder *encoder, FLAC__uint64 position, ogg_page *page, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderReadCallback read_callback, void *client_data);
|
||||
FLAC__bool simple_ogg_page__set_at(FLAC__StreamEncoder *encoder, FLAC__uint64 position, ogg_page *page, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderWriteCallback write_callback, void *client_data);
|
||||
|
||||
#endif
|
||||
63
flac/src/libFLAC/include/private/ogg_mapping.h
Normal file
63
flac/src/libFLAC/include/private/ogg_mapping.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/* libFLAC - Free Lossless Audio Codec
|
||||
* Copyright (C) 2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__OGG_MAPPING_H
|
||||
#define FLAC__PRIVATE__OGG_MAPPING_H
|
||||
|
||||
#include "FLAC/ordinals.h"
|
||||
|
||||
/** The length of the 'FLAC' magic in bytes. */
|
||||
#define FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH (1u)
|
||||
|
||||
extern const unsigned FLAC__OGG_MAPPING_PACKET_TYPE_LEN; /* = 8 bits */
|
||||
|
||||
extern const FLAC__byte FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE; /* = 0x7f */
|
||||
|
||||
/** The length of the 'FLAC' magic in bytes. */
|
||||
#define FLAC__OGG_MAPPING_MAGIC_LENGTH (4u)
|
||||
|
||||
extern const FLAC__byte * const FLAC__OGG_MAPPING_MAGIC; /* = "FLAC" */
|
||||
|
||||
extern const unsigned FLAC__OGG_MAPPING_VERSION_MAJOR_LEN; /* = 8 bits */
|
||||
extern const unsigned FLAC__OGG_MAPPING_VERSION_MINOR_LEN; /* = 8 bits */
|
||||
|
||||
/** The length of the Ogg FLAC mapping major version number in bytes. */
|
||||
#define FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH (1u)
|
||||
|
||||
/** The length of the Ogg FLAC mapping minor version number in bytes. */
|
||||
#define FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH (1u)
|
||||
|
||||
extern const unsigned FLAC__OGG_MAPPING_NUM_HEADERS_LEN; /* = 16 bits */
|
||||
|
||||
/** The length of the #-of-header-packets number bytes. */
|
||||
#define FLAC__OGG_MAPPING_NUM_HEADERS_LENGTH (2u)
|
||||
|
||||
#endif
|
||||
45
flac/src/libFLAC/include/private/stream_encoder_framing.h
Normal file
45
flac/src/libFLAC/include/private/stream_encoder_framing.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__STREAM_ENCODER_FRAMING_H
|
||||
#define FLAC__PRIVATE__STREAM_ENCODER_FRAMING_H
|
||||
|
||||
#include "FLAC/format.h"
|
||||
#include "bitwriter.h"
|
||||
|
||||
FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__BitWriter *bw);
|
||||
FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__BitWriter *bw);
|
||||
FLAC__bool FLAC__subframe_add_constant(const FLAC__Subframe_Constant *subframe, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw);
|
||||
FLAC__bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw);
|
||||
FLAC__bool FLAC__subframe_add_lpc(const FLAC__Subframe_LPC *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw);
|
||||
FLAC__bool FLAC__subframe_add_verbatim(const FLAC__Subframe_Verbatim *subframe, unsigned samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw);
|
||||
|
||||
#endif
|
||||
71
flac/src/libFLAC/include/private/window.h
Normal file
71
flac/src/libFLAC/include/private/window.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PRIVATE__WINDOW_H
|
||||
#define FLAC__PRIVATE__WINDOW_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "private/float.h"
|
||||
#include "FLAC/format.h"
|
||||
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
|
||||
/*
|
||||
* FLAC__window_*()
|
||||
* --------------------------------------------------------------------
|
||||
* Calculates window coefficients according to different apodization
|
||||
* functions.
|
||||
*
|
||||
* OUT window[0,L-1]
|
||||
* IN L (number of points in window)
|
||||
*/
|
||||
void FLAC__window_bartlett(FLAC__real *window, const FLAC__int32 L);
|
||||
void FLAC__window_bartlett_hann(FLAC__real *window, const FLAC__int32 L);
|
||||
void FLAC__window_blackman(FLAC__real *window, const FLAC__int32 L);
|
||||
void FLAC__window_blackman_harris_4term_92db_sidelobe(FLAC__real *window, const FLAC__int32 L);
|
||||
void FLAC__window_connes(FLAC__real *window, const FLAC__int32 L);
|
||||
void FLAC__window_flattop(FLAC__real *window, const FLAC__int32 L);
|
||||
void FLAC__window_gauss(FLAC__real *window, const FLAC__int32 L, const FLAC__real stddev); /* 0.0 < stddev <= 0.5 */
|
||||
void FLAC__window_hamming(FLAC__real *window, const FLAC__int32 L);
|
||||
void FLAC__window_hann(FLAC__real *window, const FLAC__int32 L);
|
||||
void FLAC__window_kaiser_bessel(FLAC__real *window, const FLAC__int32 L);
|
||||
void FLAC__window_nuttall(FLAC__real *window, const FLAC__int32 L);
|
||||
void FLAC__window_rectangle(FLAC__real *window, const FLAC__int32 L);
|
||||
void FLAC__window_triangle(FLAC__real *window, const FLAC__int32 L);
|
||||
void FLAC__window_tukey(FLAC__real *window, const FLAC__int32 L, const FLAC__real p);
|
||||
void FLAC__window_welch(FLAC__real *window, const FLAC__int32 L);
|
||||
|
||||
#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */
|
||||
|
||||
#endif
|
||||
34
flac/src/libFLAC/include/protected/Makefile.am
Normal file
34
flac/src/libFLAC/include/protected/Makefile.am
Normal file
@@ -0,0 +1,34 @@
|
||||
# libFLAC - Free Lossless Audio Codec library
|
||||
# Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# - Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# - Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
noinst_HEADERS = \
|
||||
all.h \
|
||||
stream_decoder.h \
|
||||
stream_encoder.h
|
||||
38
flac/src/libFLAC/include/protected/all.h
Normal file
38
flac/src/libFLAC/include/protected/all.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PROTECTED__ALL_H
|
||||
#define FLAC__PROTECTED__ALL_H
|
||||
|
||||
#include "stream_decoder.h"
|
||||
#include "stream_encoder.h"
|
||||
|
||||
#endif
|
||||
58
flac/src/libFLAC/include/protected/stream_decoder.h
Normal file
58
flac/src/libFLAC/include/protected/stream_decoder.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PROTECTED__STREAM_DECODER_H
|
||||
#define FLAC__PROTECTED__STREAM_DECODER_H
|
||||
|
||||
#include "FLAC/stream_decoder.h"
|
||||
#if FLAC__HAS_OGG
|
||||
#include "private/ogg_decoder_aspect.h"
|
||||
#endif
|
||||
|
||||
typedef struct FLAC__StreamDecoderProtected {
|
||||
FLAC__StreamDecoderState state;
|
||||
unsigned channels;
|
||||
FLAC__ChannelAssignment channel_assignment;
|
||||
unsigned bits_per_sample;
|
||||
unsigned sample_rate; /* in Hz */
|
||||
unsigned blocksize; /* in samples (per channel) */
|
||||
FLAC__bool md5_checking; /* if true, generate MD5 signature of decoded data and compare against signature in the STREAMINFO metadata block */
|
||||
#if FLAC__HAS_OGG
|
||||
FLAC__OggDecoderAspect ogg_decoder_aspect;
|
||||
#endif
|
||||
} FLAC__StreamDecoderProtected;
|
||||
|
||||
/*
|
||||
* return the number of input bytes consumed
|
||||
*/
|
||||
unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder);
|
||||
|
||||
#endif
|
||||
110
flac/src/libFLAC/include/protected/stream_encoder.h
Normal file
110
flac/src/libFLAC/include/protected/stream_encoder.h
Normal file
@@ -0,0 +1,110 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__PROTECTED__STREAM_ENCODER_H
|
||||
#define FLAC__PROTECTED__STREAM_ENCODER_H
|
||||
|
||||
#include "FLAC/stream_encoder.h"
|
||||
#if FLAC__HAS_OGG
|
||||
#include "private/ogg_encoder_aspect.h"
|
||||
#endif
|
||||
|
||||
#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;
|
||||
FLAC__bool streamable_subset;
|
||||
FLAC__bool do_md5;
|
||||
FLAC__bool do_mid_side_stereo;
|
||||
FLAC__bool loose_mid_side_stereo;
|
||||
unsigned channels;
|
||||
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;
|
||||
FLAC__bool do_exhaustive_model_search;
|
||||
FLAC__bool do_escape_coding;
|
||||
unsigned min_residual_partition_order;
|
||||
unsigned max_residual_partition_order;
|
||||
unsigned rice_parameter_search_dist;
|
||||
FLAC__uint64 total_samples_estimate;
|
||||
FLAC__StreamMetadata **metadata;
|
||||
unsigned num_metadata_blocks;
|
||||
FLAC__uint64 streaminfo_offset, seektable_offset, audio_offset;
|
||||
#if FLAC__HAS_OGG
|
||||
FLAC__OggEncoderAspect ogg_encoder_aspect;
|
||||
#endif
|
||||
} FLAC__StreamEncoderProtected;
|
||||
|
||||
#endif
|
||||
114
flac/src/libFLAC/libFLAC.m4
Normal file
114
flac/src/libFLAC/libFLAC.m4
Normal file
@@ -0,0 +1,114 @@
|
||||
# Configure paths for libFLAC
|
||||
# "Inspired" by ogg.m4
|
||||
|
||||
dnl AM_PATH_LIBFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for libFLAC, and define LIBFLAC_CFLAGS, LIBFLAC_LIBS, LIBFLAC_LIBDIR
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_LIBFLAC],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries
|
||||
dnl
|
||||
AC_ARG_WITH(libFLAC,[ --with-libFLAC=PFX Prefix where libFLAC is installed (optional)], libFLAC_prefix="$withval", libFLAC_prefix="")
|
||||
AC_ARG_WITH(libFLAC-libraries,[ --with-libFLAC-libraries=DIR Directory where libFLAC library is installed (optional)], libFLAC_libraries="$withval", libFLAC_libraries="")
|
||||
AC_ARG_WITH(libFLAC-includes,[ --with-libFLAC-includes=DIR Directory where libFLAC header files are installed (optional)], libFLAC_includes="$withval", libFLAC_includes="")
|
||||
AC_ARG_ENABLE(libFLACtest, [ --disable-libFLACtest Do not try to compile and run a test libFLAC program],, enable_libFLACtest=yes)
|
||||
|
||||
if test "x$libFLAC_libraries" != "x" ; then
|
||||
LIBFLAC_LIBDIR="$libFLAC_libraries"
|
||||
elif test "x$libFLAC_prefix" != "x" ; then
|
||||
LIBFLAC_LIBDIR="$libFLAC_prefix/lib"
|
||||
elif test "x$prefix" != "xNONE" ; then
|
||||
LIBFLAC_LIBDIR="$libdir"
|
||||
fi
|
||||
|
||||
LIBFLAC_LIBS="-L$LIBFLAC_LIBDIR -lFLAC $OGG_LIBS -lm"
|
||||
|
||||
if test "x$libFLAC_includes" != "x" ; then
|
||||
LIBFLAC_CFLAGS="-I$libFLAC_includes"
|
||||
elif test "x$libFLAC_prefix" != "x" ; then
|
||||
LIBFLAC_CFLAGS="-I$libFLAC_prefix/include"
|
||||
elif test "$prefix" != "xNONE"; then
|
||||
LIBFLAC_CFLAGS=""
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for libFLAC)
|
||||
no_libFLAC=""
|
||||
|
||||
|
||||
if test "x$enable_libFLACtest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
ac_save_LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
|
||||
CFLAGS="$CFLAGS $LIBFLAC_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $LIBFLAC_CFLAGS"
|
||||
LIBS="$LIBS $LIBFLAC_LIBS"
|
||||
LD_LIBRARY_PATH="$LIBFLAC_LIBDIR:$LD_LIBRARY_PATH"
|
||||
dnl
|
||||
dnl Now check if the installed libFLAC is sufficiently new.
|
||||
dnl
|
||||
rm -f conf.libFLACtest
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <FLAC/format.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
system("touch conf.libFLACtest");
|
||||
return 0;
|
||||
}
|
||||
|
||||
],, no_libFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
LD_LIBRARY_PATH="$ac_save_LD_LIBRARY_PATH"
|
||||
fi
|
||||
|
||||
if test "x$no_libFLAC" = "x" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test -f conf.libFLACtest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run libFLAC test program, checking why..."
|
||||
CFLAGS="$CFLAGS $LIBFLAC_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $LIBFLAC_CFLAGS"
|
||||
LIBS="$LIBS $LIBFLAC_LIBS"
|
||||
LD_LIBRARY_PATH="$LIBFLAC_LIBDIR:$LD_LIBRARY_PATH"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include <FLAC/format.h>
|
||||
], [ return 0; ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding libFLAC or finding the wrong"
|
||||
echo "*** version of libFLAC. If it is not finding libFLAC, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means libFLAC was incorrectly installed"
|
||||
echo "*** or that you have moved libFLAC since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the libFLAC-config script: $LIBFLAC_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
LD_LIBRARY_PATH="$ac_save_LD_LIBRARY_PATH"
|
||||
fi
|
||||
LIBFLAC_CFLAGS=""
|
||||
LIBFLAC_LIBDIR=""
|
||||
LIBFLAC_LIBS=""
|
||||
ifelse([$2], , :, [$2])
|
||||
fi
|
||||
AC_SUBST(LIBFLAC_CFLAGS)
|
||||
AC_SUBST(LIBFLAC_LIBDIR)
|
||||
AC_SUBST(LIBFLAC_LIBS)
|
||||
rm -f conf.libFLACtest
|
||||
])
|
||||
464
flac/src/libFLAC/libFLAC_dynamic.dsp
Normal file
464
flac/src/libFLAC/libFLAC_dynamic.dsp
Normal file
@@ -0,0 +1,464 @@
|
||||
# Microsoft Developer Studio Project File - Name="libFLAC_dynamic" - Package Owner=<4>
|
||||
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
|
||||
|
||||
CFG=libFLAC_dynamic - Win32 Debug
|
||||
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE NMAKE /f "libFLAC_dynamic.mak".
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE NMAKE /f "libFLAC_dynamic.mak" CFG="libFLAC_dynamic - Win32 Debug"
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE "libFLAC_dynamic - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
|
||||
!MESSAGE "libFLAC_dynamic - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
|
||||
!MESSAGE
|
||||
|
||||
|
||||
|
||||
# Begin Project
|
||||
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
|
||||
# PROP Scc_ProjName "libFLAC"
|
||||
|
||||
# PROP Scc_LocalPath "..\.."
|
||||
|
||||
CPP=cl.exe
|
||||
|
||||
MTL=midl.exe
|
||||
|
||||
RSC=rc.exe
|
||||
|
||||
|
||||
|
||||
!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release"
|
||||
|
||||
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
|
||||
# PROP BASE Output_Dir "Release"
|
||||
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
|
||||
# PROP BASE Target_Dir ""
|
||||
|
||||
# PROP Use_MFC 0
|
||||
|
||||
# PROP Use_Debug_Libraries 0
|
||||
|
||||
# PROP Output_Dir "..\..\obj\release\lib"
|
||||
|
||||
# PROP Intermediate_Dir "Release_dynamic"
|
||||
|
||||
# PROP Ignore_Export_Lib 0
|
||||
|
||||
# PROP Target_Dir ""
|
||||
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".\include" /I "..\..\include" /D "NDEBUG" /D "FLAC_API_EXPORTS" /D "FLAC__HAS_OGG" /D VERSION=\"1.2.1\" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D "_WINDOWS" /D "_WINDLL" /D "WIN32" /D "_USRDLL" /FR /FD /c
|
||||
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
|
||||
# ADD RSC /l 0x409 /d "NDEBUG" /d "_USRDLL"
|
||||
|
||||
BSC32=bscmake.exe
|
||||
|
||||
# ADD BASE BSC32 /nologo
|
||||
|
||||
# ADD BSC32 /nologo
|
||||
|
||||
LINK32=link.exe
|
||||
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
||||
|
||||
# ADD LINK32 ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:windows /dll /machine:I386 /out:"..\..\obj\release\bin/libFLAC.dll"
|
||||
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug"
|
||||
|
||||
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
|
||||
# PROP BASE Target_Dir ""
|
||||
|
||||
# PROP Use_MFC 0
|
||||
|
||||
# PROP Use_Debug_Libraries 1
|
||||
|
||||
# PROP Output_Dir "..\..\obj\debug\lib"
|
||||
|
||||
# PROP Intermediate_Dir "Debug_dynamic"
|
||||
|
||||
# PROP Ignore_Export_Lib 0
|
||||
|
||||
# PROP Target_Dir ""
|
||||
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I ".\include" /I "..\..\include" /D "_DEBUG" /D "DEBUG" /D "FLAC__OVERFLOW_DETECT" /D "FLAC_API_EXPORTS" /D "FLAC__HAS_OGG" /D VERSION=\"1.2.1\" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D "_WINDOWS" /D "_WINDLL" /D "WIN32" /D "_USRDLL" /FR /FD /c
|
||||
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
|
||||
# ADD RSC /l 0x409 /d "_DEBUG" /d "_USRDLL"
|
||||
|
||||
BSC32=bscmake.exe
|
||||
|
||||
# ADD BASE BSC32 /nologo
|
||||
|
||||
# ADD BSC32 /nologo
|
||||
|
||||
LINK32=link.exe
|
||||
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
# ADD LINK32 ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"..\..\obj\debug\bin/libFLAC.dll" /pdbtype:sept
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
|
||||
# Begin Target
|
||||
|
||||
|
||||
|
||||
# Name "libFLAC_dynamic - Win32 Release"
|
||||
|
||||
# Name "libFLAC_dynamic - Win32 Debug"
|
||||
|
||||
# Begin Group "Source Files"
|
||||
|
||||
|
||||
|
||||
# PROP Default_Filter "c"
|
||||
|
||||
# Begin Group "Assembly Files (ia32)"
|
||||
|
||||
|
||||
|
||||
# PROP Default_Filter ""
|
||||
|
||||
# Begin Source File
|
||||
|
||||
|
||||
|
||||
SOURCE=.\ia32\bitreader_asm.nasm
|
||||
|
||||
|
||||
|
||||
!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release"
|
||||
|
||||
|
||||
|
||||
USERDEP__CPU_A="ia32/bitreader_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\bitreader_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/bitreader_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug"
|
||||
|
||||
|
||||
|
||||
USERDEP__CPU_A="ia32/bitreader_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\bitreader_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/bitreader_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
|
||||
# End Source File
|
||||
|
||||
# Begin Source File
|
||||
|
||||
|
||||
|
||||
SOURCE=.\ia32\cpu_asm.nasm
|
||||
|
||||
|
||||
|
||||
!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release"
|
||||
|
||||
|
||||
|
||||
USERDEP__CPU_A="ia32/cpu_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\cpu_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/cpu_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug"
|
||||
|
||||
|
||||
|
||||
USERDEP__CPU_A="ia32/cpu_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\cpu_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/cpu_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
|
||||
# End Source File
|
||||
|
||||
# Begin Source File
|
||||
|
||||
|
||||
|
||||
SOURCE=.\ia32\fixed_asm.nasm
|
||||
|
||||
|
||||
|
||||
!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release"
|
||||
|
||||
|
||||
|
||||
USERDEP__FIXED="ia32/fixed_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\fixed_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/fixed_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug"
|
||||
|
||||
|
||||
|
||||
USERDEP__FIXED="ia32/fixed_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\fixed_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/fixed_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
|
||||
# End Source File
|
||||
|
||||
# Begin Source File
|
||||
|
||||
|
||||
|
||||
SOURCE=.\ia32\lpc_asm.nasm
|
||||
|
||||
|
||||
|
||||
!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release"
|
||||
|
||||
|
||||
|
||||
USERDEP__LPC_A="ia32/lpc_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\lpc_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/lpc_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug"
|
||||
|
||||
|
||||
|
||||
USERDEP__LPC_A="ia32/lpc_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\lpc_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/lpc_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
|
||||
# End Source File
|
||||
|
||||
# Begin Source File
|
||||
|
||||
|
||||
|
||||
SOURCE=.\ia32\stream_encoder_asm.nasm
|
||||
|
||||
|
||||
|
||||
!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release"
|
||||
|
||||
|
||||
|
||||
USERDEP__CPU_A="ia32/stream_encoder_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\stream_encoder_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/stream_encoder_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug"
|
||||
|
||||
|
||||
|
||||
USERDEP__CPU_A="ia32/stream_encoder_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\stream_encoder_asm.nasm
|
||||
|
||||
|
||||
|
||||
836
flac/src/libFLAC/libFLAC_dynamic.vcproj
Normal file
836
flac/src/libFLAC/libFLAC_dynamic.vcproj
Normal file
@@ -0,0 +1,836 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="libFLAC_dynamic"
|
||||
ProjectGUID="{4cefbc83-c215-11db-8314-0800200c9a66}"
|
||||
RootNamespace="libFLAC_dynamic"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\..\obj\debug\lib"
|
||||
IntermediateDirectory="Debug_dynamic"
|
||||
ConfigurationType="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FLAC_API_EXPORTS;FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\";DEBUG;FLAC__OVERFLOW_DETECT"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib"
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="uuid.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\..\obj\release\lib"
|
||||
IntermediateDirectory="Release_dynamic"
|
||||
ConfigurationType="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories=".\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLAC_API_EXPORTS;FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\""
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib"
|
||||
LinkIncremental="1"
|
||||
IgnoreDefaultLibraryNames="uuid.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
LinkTimeCodeGeneration="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FLAC_API_EXPORTS;FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\";DEBUG;FLAC__OVERFLOW_DETECT"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib"
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="uuid.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories=".\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLAC_API_EXPORTS;_FLAC__HAS_OGG;FLAC__CPU_IA32;_FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\""
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
IgnoreDefaultLibraryNames="uuid.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
LinkTimeCodeGeneration="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\include\protected\all.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\all.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\bitmath.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\bitreader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\bitwriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\cpu.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\crc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\fixed.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\float.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\format.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\lpc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\md5.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\memory.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\metadata.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ia32\nasm.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\ogg_decoder_aspect.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\ogg_encoder_aspect.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\ogg_helper.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\ogg_mapping.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\protected\stream_decoder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\protected\stream_encoder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\stream_encoder_framing.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\window.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\bitmath.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\bitreader.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\bitwriter.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\cpu.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\crc.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\fixed.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\float.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\format.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\lpc.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\md5.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\memory.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\metadata_iterators.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\metadata_object.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ogg_decoder_aspect.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ogg_encoder_aspect.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ogg_helper.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ogg_mapping.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stream_decoder.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stream_encoder.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stream_encoder_framing.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\window.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Public Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\all.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\assert.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\callback.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\export.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\format.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\metadata.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\ordinals.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\stream_decoder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\stream_encoder.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\ia32\bitreader_asm.nasm"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj
"
|
||||
AdditionalDependencies="ia32/bitreader_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/bitreader_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj
"
|
||||
AdditionalDependencies="ia32/bitreader_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/bitreader_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj
"
|
||||
AdditionalDependencies="ia32/bitreader_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/bitreader_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj
"
|
||||
AdditionalDependencies="ia32/bitreader_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/bitreader_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\release_static\BuildLog.htm"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ia32\cpu_asm.nasm"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj
"
|
||||
AdditionalDependencies="ia32/cpu_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/cpu_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj
"
|
||||
AdditionalDependencies="ia32/cpu_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/cpu_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj
"
|
||||
AdditionalDependencies="ia32/cpu_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/cpu_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj
"
|
||||
AdditionalDependencies="ia32/cpu_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/cpu_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ia32\fixed_asm.nasm"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj
"
|
||||
AdditionalDependencies="ia32/fixed_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/fixed_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj
"
|
||||
AdditionalDependencies="ia32/fixed_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/fixed_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj
"
|
||||
AdditionalDependencies="ia32/fixed_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/fixed_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj
"
|
||||
AdditionalDependencies="ia32/fixed_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/fixed_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ia32\lpc_asm.nasm"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj
"
|
||||
AdditionalDependencies="ia32/lpc_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/lpc_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj
"
|
||||
AdditionalDependencies="ia32/lpc_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/lpc_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj
"
|
||||
AdditionalDependencies="ia32/lpc_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/lpc_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj
"
|
||||
AdditionalDependencies="ia32/lpc_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/lpc_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ia32\stream_encoder_asm.nasm"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj
"
|
||||
AdditionalDependencies="ia32/stream_encoder_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/stream_encoder_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj
"
|
||||
AdditionalDependencies="ia32/stream_encoder_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/stream_encoder_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj
"
|
||||
AdditionalDependencies="ia32/stream_encoder_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/stream_encoder_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj
"
|
||||
AdditionalDependencies="ia32/stream_encoder_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/stream_encoder_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
457
flac/src/libFLAC/libFLAC_static.dsp
Normal file
457
flac/src/libFLAC/libFLAC_static.dsp
Normal file
@@ -0,0 +1,457 @@
|
||||
# Microsoft Developer Studio Project File - Name="libFLAC_static" - Package Owner=<4>
|
||||
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
|
||||
|
||||
CFG=libFLAC_static - Win32 Debug
|
||||
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE NMAKE /f "libFLAC_static.mak".
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE NMAKE /f "libFLAC_static.mak" CFG="libFLAC_static - Win32 Debug"
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
|
||||
!MESSAGE
|
||||
|
||||
!MESSAGE "libFLAC_static - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
|
||||
!MESSAGE "libFLAC_static - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
|
||||
!MESSAGE
|
||||
|
||||
|
||||
|
||||
# Begin Project
|
||||
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
|
||||
# PROP Scc_ProjName "libFLAC"
|
||||
|
||||
# PROP Scc_LocalPath "..\.."
|
||||
|
||||
CPP=cl.exe
|
||||
|
||||
RSC=rc.exe
|
||||
|
||||
|
||||
|
||||
!IF "$(CFG)" == "libFLAC_static - Win32 Release"
|
||||
|
||||
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
|
||||
# PROP BASE Output_Dir "Release"
|
||||
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
|
||||
# PROP BASE Target_Dir ""
|
||||
|
||||
# PROP Use_MFC 0
|
||||
|
||||
# PROP Use_Debug_Libraries 0
|
||||
|
||||
# PROP Output_Dir "..\..\obj\release\lib"
|
||||
|
||||
# PROP Intermediate_Dir "Release_static"
|
||||
|
||||
# PROP Target_Dir ""
|
||||
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /Op /I ".\include" /I "..\..\include" /D VERSION=\"1.2.1\" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
|
||||
BSC32=bscmake.exe
|
||||
|
||||
# ADD BASE BSC32 /nologo
|
||||
|
||||
# ADD BSC32 /nologo
|
||||
|
||||
LIB32=link.exe -lib
|
||||
|
||||
# ADD BASE LIB32 /nologo
|
||||
|
||||
# ADD LIB32 /nologo /nodefaultlib
|
||||
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug"
|
||||
|
||||
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
|
||||
# PROP BASE Target_Dir ""
|
||||
|
||||
# PROP Use_MFC 0
|
||||
|
||||
# PROP Use_Debug_Libraries 1
|
||||
|
||||
# PROP Output_Dir "..\..\obj\debug\lib"
|
||||
|
||||
# PROP Intermediate_Dir "Debug_static"
|
||||
|
||||
# PROP Target_Dir ""
|
||||
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\include" /D VERSION=\"1.2.1\" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "FLAC__OVERFLOW_DETECT" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
|
||||
BSC32=bscmake.exe
|
||||
|
||||
# ADD BASE BSC32 /nologo
|
||||
|
||||
# ADD BSC32 /nologo
|
||||
|
||||
LIB32=link.exe -lib
|
||||
|
||||
# ADD BASE LIB32 /nologo
|
||||
|
||||
# ADD LIB32 /nologo /nodefaultlib
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
|
||||
# Begin Target
|
||||
|
||||
|
||||
|
||||
# Name "libFLAC_static - Win32 Release"
|
||||
|
||||
# Name "libFLAC_static - Win32 Debug"
|
||||
|
||||
# Begin Group "Source Files"
|
||||
|
||||
|
||||
|
||||
# PROP Default_Filter "c"
|
||||
|
||||
# Begin Group "Assembly Files (ia32)"
|
||||
|
||||
|
||||
|
||||
# PROP Default_Filter ""
|
||||
|
||||
# Begin Source File
|
||||
|
||||
|
||||
|
||||
SOURCE=.\ia32\bitreader_asm.nasm
|
||||
|
||||
|
||||
|
||||
!IF "$(CFG)" == "libFLAC_static - Win32 Release"
|
||||
|
||||
|
||||
|
||||
USERDEP__CPU_A="ia32/bitreader_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\bitreader_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/bitreader_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug"
|
||||
|
||||
|
||||
|
||||
USERDEP__CPU_A="ia32/bitreader_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\bitreader_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/bitreader_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
|
||||
# End Source File
|
||||
|
||||
# Begin Source File
|
||||
|
||||
|
||||
|
||||
SOURCE=.\ia32\cpu_asm.nasm
|
||||
|
||||
|
||||
|
||||
!IF "$(CFG)" == "libFLAC_static - Win32 Release"
|
||||
|
||||
|
||||
|
||||
USERDEP__CPU_A="ia32/cpu_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\cpu_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/cpu_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug"
|
||||
|
||||
|
||||
|
||||
USERDEP__CPU_A="ia32/cpu_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\cpu_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/cpu_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
|
||||
# End Source File
|
||||
|
||||
# Begin Source File
|
||||
|
||||
|
||||
|
||||
SOURCE=.\ia32\fixed_asm.nasm
|
||||
|
||||
|
||||
|
||||
!IF "$(CFG)" == "libFLAC_static - Win32 Release"
|
||||
|
||||
|
||||
|
||||
USERDEP__FIXED="ia32/fixed_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\fixed_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/fixed_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug"
|
||||
|
||||
|
||||
|
||||
USERDEP__FIXED="ia32/fixed_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\fixed_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/fixed_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
|
||||
# End Source File
|
||||
|
||||
# Begin Source File
|
||||
|
||||
|
||||
|
||||
SOURCE=.\ia32\lpc_asm.nasm
|
||||
|
||||
|
||||
|
||||
!IF "$(CFG)" == "libFLAC_static - Win32 Release"
|
||||
|
||||
|
||||
|
||||
USERDEP__LPC_A="ia32/lpc_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\lpc_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/lpc_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug"
|
||||
|
||||
|
||||
|
||||
USERDEP__LPC_A="ia32/lpc_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\lpc_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/lpc_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
|
||||
# End Source File
|
||||
|
||||
# Begin Source File
|
||||
|
||||
|
||||
|
||||
SOURCE=.\ia32\stream_encoder_asm.nasm
|
||||
|
||||
|
||||
|
||||
!IF "$(CFG)" == "libFLAC_static - Win32 Release"
|
||||
|
||||
|
||||
|
||||
USERDEP__CPU_A="ia32/stream_encoder_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\stream_encoder_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/stream_encoder_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug"
|
||||
|
||||
|
||||
|
||||
USERDEP__CPU_A="ia32/stream_encoder_asm.nasm"
|
||||
|
||||
# Begin Custom Build
|
||||
|
||||
InputPath=.\ia32\stream_encoder_asm.nasm
|
||||
|
||||
|
||||
|
||||
"ia32/stream_encoder_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj
|
||||
|
||||
|
||||
|
||||
# End Custom Build
|
||||
839
flac/src/libFLAC/libFLAC_static.vcproj
Normal file
839
flac/src/libFLAC/libFLAC_static.vcproj
Normal file
@@ -0,0 +1,839 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="libFLAC_static"
|
||||
ProjectGUID="{4CEFBC84-C215-11DB-8314-0800200C9A66}"
|
||||
RootNamespace="libFLAC_static"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)..\bin\$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(SolutionDir)..\obj\$(ProjectName)\$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\";FLAC__NO_DLL;DEBUG;FLAC__OVERFLOW_DETECT"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)..\bin\$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(SolutionDir)..\obj\$(ProjectName)\$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLAC__CPU_IA64;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\";FLAC__NO_DLL;DEBUG;FLAC__OVERFLOW_DETECT"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)..\bin\$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(SolutionDir)..\obj\$(ProjectName)\$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories=".\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\";FLAC__NO_DLL"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)..\bin\$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(SolutionDir)..\obj\$(ProjectName)\$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories=".\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__CPU_IA64;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\";FLAC__NO_DLL"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4267;4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\include\protected\all.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\all.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\bitmath.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\bitreader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\bitwriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\cpu.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\crc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\fixed.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\float.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\format.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\lpc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\md5.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\memory.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\metadata.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ia32\nasm.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\ogg_decoder_aspect.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\ogg_encoder_aspect.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\ogg_helper.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\ogg_mapping.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\protected\stream_decoder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\protected\stream_encoder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\stream_encoder_framing.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\private\window.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Public Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\all.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\assert.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\callback.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\export.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\format.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\metadata.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\ordinals.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\stream_decoder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\FLAC\stream_encoder.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\bitmath.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\bitreader.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\bitwriter.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\cpu.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\crc.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\fixed.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\float.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\format.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\lpc.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\md5.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\memory.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\metadata_iterators.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\metadata_object.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ogg_decoder_aspect.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ogg_encoder_aspect.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ogg_helper.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ogg_mapping.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stream_decoder.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stream_encoder.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stream_encoder_framing.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\window.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\ia32\bitreader_asm.nasm"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj
"
|
||||
AdditionalDependencies="ia32/bitreader_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/bitreader_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj
"
|
||||
AdditionalDependencies="ia32/bitreader_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/bitreader_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj
"
|
||||
AdditionalDependencies="ia32/bitreader_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/bitreader_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj
"
|
||||
AdditionalDependencies="ia32/bitreader_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/bitreader_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ia32\cpu_asm.nasm"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj
"
|
||||
AdditionalDependencies="ia32/cpu_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/cpu_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj
"
|
||||
AdditionalDependencies="ia32/cpu_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/cpu_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj
"
|
||||
AdditionalDependencies="ia32/cpu_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/cpu_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj
"
|
||||
AdditionalDependencies="ia32/cpu_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/cpu_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ia32\fixed_asm.nasm"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj
"
|
||||
AdditionalDependencies="ia32/fixed_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/fixed_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj
"
|
||||
AdditionalDependencies="ia32/fixed_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/fixed_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj
"
|
||||
AdditionalDependencies="ia32/fixed_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/fixed_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj
"
|
||||
AdditionalDependencies="ia32/fixed_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/fixed_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ia32\lpc_asm.nasm"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj
"
|
||||
AdditionalDependencies="ia32/lpc_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/lpc_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj
"
|
||||
AdditionalDependencies="ia32/lpc_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/lpc_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj
"
|
||||
AdditionalDependencies="ia32/lpc_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/lpc_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj
"
|
||||
AdditionalDependencies="ia32/lpc_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/lpc_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ia32\stream_encoder_asm.nasm"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj
"
|
||||
AdditionalDependencies="ia32/stream_encoder_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/stream_encoder_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj
"
|
||||
AdditionalDependencies="ia32/stream_encoder_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/stream_encoder_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj
"
|
||||
AdditionalDependencies="ia32/stream_encoder_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/stream_encoder_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj
"
|
||||
AdditionalDependencies="ia32/stream_encoder_asm.nasm;ia32/nasm.h"
|
||||
Outputs="ia32/stream_encoder_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
1377
flac/src/libFLAC/lpc.c
Normal file
1377
flac/src/libFLAC/lpc.c
Normal file
File diff suppressed because it is too large
Load Diff
424
flac/src/libFLAC/md5.c
Normal file
424
flac/src/libFLAC/md5.c
Normal file
@@ -0,0 +1,424 @@
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h> /* for malloc() */
|
||||
#include <string.h> /* for memcpy() */
|
||||
|
||||
#include "private/md5.h"
|
||||
#include "share/alloc.h"
|
||||
|
||||
#ifndef FLaC__INLINE
|
||||
#define FLaC__INLINE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This code implements the MD5 message-digest algorithm.
|
||||
* The algorithm is due to Ron Rivest. This code was
|
||||
* written by Colin Plumb in 1993, no copyright is claimed.
|
||||
* This code is in the public domain; do with it what you wish.
|
||||
*
|
||||
* Equivalent code is available from RSA Data Security, Inc.
|
||||
* This code has been tested against that, and is equivalent,
|
||||
* except that you don't need to include two pages of legalese
|
||||
* with every copy.
|
||||
*
|
||||
* To compute the message digest of a chunk of bytes, declare an
|
||||
* MD5Context structure, pass it to MD5Init, call MD5Update as
|
||||
* needed on buffers full of bytes, and then call MD5Final, which
|
||||
* will fill a supplied 16-byte array with the digest.
|
||||
*
|
||||
* Changed so as no longer to depend on Colin Plumb's `usual.h' header
|
||||
* definitions; now uses stuff from dpkg's config.h.
|
||||
* - Ian Jackson <ijackson@nyx.cs.du.edu>.
|
||||
* Still in the public domain.
|
||||
*
|
||||
* Josh Coalson: made some changes to integrate with libFLAC.
|
||||
* Still in the public domain.
|
||||
*/
|
||||
|
||||
/* The four core functions - F1 is optimized somewhat */
|
||||
|
||||
/* #define F1(x, y, z) (x & y | ~x & z) */
|
||||
#define F1(x, y, z) (z ^ (x & (y ^ z)))
|
||||
#define F2(x, y, z) F1(z, x, y)
|
||||
#define F3(x, y, z) (x ^ y ^ z)
|
||||
#define F4(x, y, z) (y ^ (x | ~z))
|
||||
|
||||
/* This is the central step in the MD5 algorithm. */
|
||||
#define MD5STEP(f,w,x,y,z,in,s) \
|
||||
(w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
|
||||
|
||||
/*
|
||||
* The core of the MD5 algorithm, this alters an existing MD5 hash to
|
||||
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
||||
* the data and converts bytes into longwords for this routine.
|
||||
*/
|
||||
static void FLAC__MD5Transform(FLAC__uint32 buf[4], FLAC__uint32 const in[16])
|
||||
{
|
||||
register FLAC__uint32 a, b, c, d;
|
||||
|
||||
a = buf[0];
|
||||
b = buf[1];
|
||||
c = buf[2];
|
||||
d = buf[3];
|
||||
|
||||
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
|
||||
|
||||
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
|
||||
|
||||
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
|
||||
|
||||
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
|
||||
|
||||
buf[0] += a;
|
||||
buf[1] += b;
|
||||
buf[2] += c;
|
||||
buf[3] += d;
|
||||
}
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
//@@@@@@ OPT: use bswap/intrinsics
|
||||
static void byteSwap(FLAC__uint32 *buf, unsigned words)
|
||||
{
|
||||
register FLAC__uint32 x;
|
||||
do {
|
||||
x = *buf;
|
||||
x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
|
||||
*buf++ = (x >> 16) | (x << 16);
|
||||
} while (--words);
|
||||
}
|
||||
static void byteSwapX16(FLAC__uint32 *buf)
|
||||
{
|
||||
register FLAC__uint32 x;
|
||||
|
||||
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
|
||||
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
|
||||
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
|
||||
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
|
||||
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
|
||||
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
|
||||
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
|
||||
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
|
||||
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
|
||||
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
|
||||
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
|
||||
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
|
||||
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
|
||||
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
|
||||
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
|
||||
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf = (x >> 16) | (x << 16);
|
||||
}
|
||||
#else
|
||||
#define byteSwap(buf, words)
|
||||
#define byteSwapX16(buf)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Update context to reflect the concatenation of another buffer full
|
||||
* of bytes.
|
||||
*/
|
||||
static void FLAC__MD5Update(FLAC__MD5Context *ctx, FLAC__byte const *buf, unsigned len)
|
||||
{
|
||||
FLAC__uint32 t;
|
||||
|
||||
/* Update byte count */
|
||||
|
||||
t = ctx->bytes[0];
|
||||
if ((ctx->bytes[0] = t + len) < t)
|
||||
ctx->bytes[1]++; /* Carry from low to high */
|
||||
|
||||
t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
|
||||
if (t > len) {
|
||||
memcpy((FLAC__byte *)ctx->in + 64 - t, buf, len);
|
||||
return;
|
||||
}
|
||||
/* First chunk is an odd size */
|
||||
memcpy((FLAC__byte *)ctx->in + 64 - t, buf, t);
|
||||
byteSwapX16(ctx->in);
|
||||
FLAC__MD5Transform(ctx->buf, ctx->in);
|
||||
buf += t;
|
||||
len -= t;
|
||||
|
||||
/* Process data in 64-byte chunks */
|
||||
while (len >= 64) {
|
||||
memcpy(ctx->in, buf, 64);
|
||||
byteSwapX16(ctx->in);
|
||||
FLAC__MD5Transform(ctx->buf, ctx->in);
|
||||
buf += 64;
|
||||
len -= 64;
|
||||
}
|
||||
|
||||
/* Handle any remaining bytes of data. */
|
||||
memcpy(ctx->in, buf, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
|
||||
* initialization constants.
|
||||
*/
|
||||
void FLAC__MD5Init(FLAC__MD5Context *ctx)
|
||||
{
|
||||
ctx->buf[0] = 0x67452301;
|
||||
ctx->buf[1] = 0xefcdab89;
|
||||
ctx->buf[2] = 0x98badcfe;
|
||||
ctx->buf[3] = 0x10325476;
|
||||
|
||||
ctx->bytes[0] = 0;
|
||||
ctx->bytes[1] = 0;
|
||||
|
||||
ctx->internal_buf = 0;
|
||||
ctx->capacity = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
||||
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||
*/
|
||||
void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *ctx)
|
||||
{
|
||||
int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */
|
||||
FLAC__byte *p = (FLAC__byte *)ctx->in + count;
|
||||
|
||||
/* Set the first char of padding to 0x80. There is always room. */
|
||||
*p++ = 0x80;
|
||||
|
||||
/* Bytes of padding needed to make 56 bytes (-8..55) */
|
||||
count = 56 - 1 - count;
|
||||
|
||||
if (count < 0) { /* Padding forces an extra block */
|
||||
memset(p, 0, count + 8);
|
||||
byteSwapX16(ctx->in);
|
||||
FLAC__MD5Transform(ctx->buf, ctx->in);
|
||||
p = (FLAC__byte *)ctx->in;
|
||||
count = 56;
|
||||
}
|
||||
memset(p, 0, count);
|
||||
byteSwap(ctx->in, 14);
|
||||
|
||||
/* Append length in bits and transform */
|
||||
ctx->in[14] = ctx->bytes[0] << 3;
|
||||
ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29;
|
||||
FLAC__MD5Transform(ctx->buf, ctx->in);
|
||||
|
||||
byteSwap(ctx->buf, 4);
|
||||
memcpy(digest, ctx->buf, 16);
|
||||
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
|
||||
if(0 != ctx->internal_buf) {
|
||||
free(ctx->internal_buf);
|
||||
ctx->internal_buf = 0;
|
||||
ctx->capacity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert the incoming audio signal to a byte stream
|
||||
*/
|
||||
static void format_input_(FLAC__byte *buf, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample)
|
||||
{
|
||||
unsigned channel, sample;
|
||||
register FLAC__int32 a_word;
|
||||
register FLAC__byte *buf_ = buf;
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
#else
|
||||
if(channels == 2 && bytes_per_sample == 2) {
|
||||
FLAC__int16 *buf1_ = ((FLAC__int16*)buf_) + 1;
|
||||
memcpy(buf_, signal[0], sizeof(FLAC__int32) * samples);
|
||||
for(sample = 0; sample < samples; sample++, buf1_+=2)
|
||||
*buf1_ = (FLAC__int16)signal[1][sample];
|
||||
}
|
||||
else if(channels == 1 && bytes_per_sample == 2) {
|
||||
FLAC__int16 *buf1_ = (FLAC__int16*)buf_;
|
||||
for(sample = 0; sample < samples; sample++)
|
||||
*buf1_++ = (FLAC__int16)signal[0][sample];
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if(bytes_per_sample == 2) {
|
||||
if(channels == 2) {
|
||||
for(sample = 0; sample < samples; sample++) {
|
||||
a_word = signal[0][sample];
|
||||
*buf_++ = (FLAC__byte)a_word; a_word >>= 8;
|
||||
*buf_++ = (FLAC__byte)a_word;
|
||||
a_word = signal[1][sample];
|
||||
*buf_++ = (FLAC__byte)a_word; a_word >>= 8;
|
||||
*buf_++ = (FLAC__byte)a_word;
|
||||
}
|
||||
}
|
||||
else if(channels == 1) {
|
||||
for(sample = 0; sample < samples; sample++) {
|
||||
a_word = signal[0][sample];
|
||||
*buf_++ = (FLAC__byte)a_word; a_word >>= 8;
|
||||
*buf_++ = (FLAC__byte)a_word;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(sample = 0; sample < samples; sample++) {
|
||||
for(channel = 0; channel < channels; channel++) {
|
||||
a_word = signal[channel][sample];
|
||||
*buf_++ = (FLAC__byte)a_word; a_word >>= 8;
|
||||
*buf_++ = (FLAC__byte)a_word;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(bytes_per_sample == 3) {
|
||||
if(channels == 2) {
|
||||
for(sample = 0; sample < samples; sample++) {
|
||||
a_word = signal[0][sample];
|
||||
*buf_++ = (FLAC__byte)a_word; a_word >>= 8;
|
||||
*buf_++ = (FLAC__byte)a_word; a_word >>= 8;
|
||||
*buf_++ = (FLAC__byte)a_word;
|
||||
a_word = signal[1][sample];
|
||||
*buf_++ = (FLAC__byte)a_word; a_word >>= 8;
|
||||
*buf_++ = (FLAC__byte)a_word; a_word >>= 8;
|
||||
*buf_++ = (FLAC__byte)a_word;
|
||||
}
|
||||
}
|
||||
else if(channels == 1) {
|
||||
for(sample = 0; sample < samples; sample++) {
|
||||
a_word = signal[0][sample];
|
||||
*buf_++ = (FLAC__byte)a_word; a_word >>= 8;
|
||||
*buf_++ = (FLAC__byte)a_word; a_word >>= 8;
|
||||
*buf_++ = (FLAC__byte)a_word;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(sample = 0; sample < samples; sample++) {
|
||||
for(channel = 0; channel < channels; channel++) {
|
||||
a_word = signal[channel][sample];
|
||||
*buf_++ = (FLAC__byte)a_word; a_word >>= 8;
|
||||
*buf_++ = (FLAC__byte)a_word; a_word >>= 8;
|
||||
*buf_++ = (FLAC__byte)a_word;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(bytes_per_sample == 1) {
|
||||
if(channels == 2) {
|
||||
for(sample = 0; sample < samples; sample++) {
|
||||
a_word = signal[0][sample];
|
||||
*buf_++ = (FLAC__byte)a_word;
|
||||
a_word = signal[1][sample];
|
||||
*buf_++ = (FLAC__byte)a_word;
|
||||
}
|
||||
}
|
||||
else if(channels == 1) {
|
||||
for(sample = 0; sample < samples; sample++) {
|
||||
a_word = signal[0][sample];
|
||||
*buf_++ = (FLAC__byte)a_word;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(sample = 0; sample < samples; sample++) {
|
||||
for(channel = 0; channel < channels; channel++) {
|
||||
a_word = signal[channel][sample];
|
||||
*buf_++ = (FLAC__byte)a_word;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else { /* bytes_per_sample == 4, maybe optimize more later */
|
||||
for(sample = 0; sample < samples; sample++) {
|
||||
for(channel = 0; channel < channels; channel++) {
|
||||
a_word = signal[channel][sample];
|
||||
*buf_++ = (FLAC__byte)a_word; a_word >>= 8;
|
||||
*buf_++ = (FLAC__byte)a_word; a_word >>= 8;
|
||||
*buf_++ = (FLAC__byte)a_word; a_word >>= 8;
|
||||
*buf_++ = (FLAC__byte)a_word;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert the incoming audio signal to a byte stream and FLAC__MD5Update it.
|
||||
*/
|
||||
FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample)
|
||||
{
|
||||
const size_t bytes_needed = (size_t)channels * (size_t)samples * (size_t)bytes_per_sample;
|
||||
|
||||
/* overflow check */
|
||||
if((size_t)channels > SIZE_MAX / (size_t)bytes_per_sample)
|
||||
return false;
|
||||
if((size_t)channels * (size_t)bytes_per_sample > SIZE_MAX / (size_t)samples)
|
||||
return false;
|
||||
|
||||
if(ctx->capacity < bytes_needed) {
|
||||
FLAC__byte *tmp = (FLAC__byte*)realloc(ctx->internal_buf, bytes_needed);
|
||||
if(0 == tmp) {
|
||||
free(ctx->internal_buf);
|
||||
if(0 == (ctx->internal_buf = (FLAC__byte*)safe_malloc_(bytes_needed)))
|
||||
return false;
|
||||
}
|
||||
ctx->internal_buf = tmp;
|
||||
ctx->capacity = bytes_needed;
|
||||
}
|
||||
|
||||
format_input_(ctx->internal_buf, signal, channels, samples, bytes_per_sample);
|
||||
|
||||
FLAC__MD5Update(ctx, ctx->internal_buf, bytes_needed);
|
||||
|
||||
return true;
|
||||
}
|
||||
221
flac/src/libFLAC/memory.c
Normal file
221
flac/src/libFLAC/memory.c
Normal file
@@ -0,0 +1,221 @@
|
||||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "private/memory.h"
|
||||
#include "FLAC/assert.h"
|
||||
#include "share/alloc.h"
|
||||
|
||||
void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address)
|
||||
{
|
||||
void *x;
|
||||
|
||||
FLAC__ASSERT(0 != aligned_address);
|
||||
|
||||
#ifdef FLAC__ALIGN_MALLOC_DATA
|
||||
/* align on 32-byte (256-bit) boundary */
|
||||
x = safe_malloc_add_2op_(bytes, /*+*/31);
|
||||
#ifdef SIZEOF_VOIDP
|
||||
#if SIZEOF_VOIDP == 4
|
||||
/* could do *aligned_address = x + ((unsigned) (32 - (((unsigned)x) & 31))) & 31; */
|
||||
*aligned_address = (void*)(((unsigned)x + 31) & -32);
|
||||
#elif SIZEOF_VOIDP == 8
|
||||
*aligned_address = (void*)(((FLAC__uint64)x + 31) & (FLAC__uint64)(-((FLAC__int64)32)));
|
||||
#else
|
||||
# error Unsupported sizeof(void*)
|
||||
#endif
|
||||
#else
|
||||
/* there's got to be a better way to do this right for all archs */
|
||||
if(sizeof(void*) == sizeof(unsigned))
|
||||
*aligned_address = (void*)(((unsigned)x + 31) & -32);
|
||||
else if(sizeof(void*) == sizeof(FLAC__uint64))
|
||||
*aligned_address = (void*)(((FLAC__uint64)x + 31) & (FLAC__uint64)(-((FLAC__int64)32)));
|
||||
else
|
||||
return 0;
|
||||
#endif
|
||||
#else
|
||||
x = safe_malloc_(bytes);
|
||||
*aligned_address = x;
|
||||
#endif
|
||||
return x;
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__memory_alloc_aligned_int32_array(unsigned elements, FLAC__int32 **unaligned_pointer, FLAC__int32 **aligned_pointer)
|
||||
{
|
||||
FLAC__int32 *pu; /* unaligned pointer */
|
||||
union { /* union needed to comply with C99 pointer aliasing rules */
|
||||
FLAC__int32 *pa; /* aligned pointer */
|
||||
void *pv; /* aligned pointer alias */
|
||||
} u;
|
||||
|
||||
FLAC__ASSERT(elements > 0);
|
||||
FLAC__ASSERT(0 != unaligned_pointer);
|
||||
FLAC__ASSERT(0 != aligned_pointer);
|
||||
FLAC__ASSERT(unaligned_pointer != aligned_pointer);
|
||||
|
||||
if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
|
||||
return false;
|
||||
|
||||
pu = (FLAC__int32*)FLAC__memory_alloc_aligned(sizeof(*pu) * (size_t)elements, &u.pv);
|
||||
if(0 == pu) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if(*unaligned_pointer != 0)
|
||||
free(*unaligned_pointer);
|
||||
*unaligned_pointer = pu;
|
||||
*aligned_pointer = u.pa;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__memory_alloc_aligned_uint32_array(unsigned elements, FLAC__uint32 **unaligned_pointer, FLAC__uint32 **aligned_pointer)
|
||||
{
|
||||
FLAC__uint32 *pu; /* unaligned pointer */
|
||||
union { /* union needed to comply with C99 pointer aliasing rules */
|
||||
FLAC__uint32 *pa; /* aligned pointer */
|
||||
void *pv; /* aligned pointer alias */
|
||||
} u;
|
||||
|
||||
FLAC__ASSERT(elements > 0);
|
||||
FLAC__ASSERT(0 != unaligned_pointer);
|
||||
FLAC__ASSERT(0 != aligned_pointer);
|
||||
FLAC__ASSERT(unaligned_pointer != aligned_pointer);
|
||||
|
||||
if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
|
||||
return false;
|
||||
|
||||
pu = (FLAC__uint32*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
|
||||
if(0 == pu) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if(*unaligned_pointer != 0)
|
||||
free(*unaligned_pointer);
|
||||
*unaligned_pointer = pu;
|
||||
*aligned_pointer = u.pa;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__memory_alloc_aligned_uint64_array(unsigned elements, FLAC__uint64 **unaligned_pointer, FLAC__uint64 **aligned_pointer)
|
||||
{
|
||||
FLAC__uint64 *pu; /* unaligned pointer */
|
||||
union { /* union needed to comply with C99 pointer aliasing rules */
|
||||
FLAC__uint64 *pa; /* aligned pointer */
|
||||
void *pv; /* aligned pointer alias */
|
||||
} u;
|
||||
|
||||
FLAC__ASSERT(elements > 0);
|
||||
FLAC__ASSERT(0 != unaligned_pointer);
|
||||
FLAC__ASSERT(0 != aligned_pointer);
|
||||
FLAC__ASSERT(unaligned_pointer != aligned_pointer);
|
||||
|
||||
if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
|
||||
return false;
|
||||
|
||||
pu = (FLAC__uint64*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
|
||||
if(0 == pu) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if(*unaligned_pointer != 0)
|
||||
free(*unaligned_pointer);
|
||||
*unaligned_pointer = pu;
|
||||
*aligned_pointer = u.pa;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(unsigned elements, unsigned **unaligned_pointer, unsigned **aligned_pointer)
|
||||
{
|
||||
unsigned *pu; /* unaligned pointer */
|
||||
union { /* union needed to comply with C99 pointer aliasing rules */
|
||||
unsigned *pa; /* aligned pointer */
|
||||
void *pv; /* aligned pointer alias */
|
||||
} u;
|
||||
|
||||
FLAC__ASSERT(elements > 0);
|
||||
FLAC__ASSERT(0 != unaligned_pointer);
|
||||
FLAC__ASSERT(0 != aligned_pointer);
|
||||
FLAC__ASSERT(unaligned_pointer != aligned_pointer);
|
||||
|
||||
if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
|
||||
return false;
|
||||
|
||||
pu = (unsigned*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
|
||||
if(0 == pu) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if(*unaligned_pointer != 0)
|
||||
free(*unaligned_pointer);
|
||||
*unaligned_pointer = pu;
|
||||
*aligned_pointer = u.pa;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef FLAC__INTEGER_ONLY_LIBRARY
|
||||
|
||||
FLAC__bool FLAC__memory_alloc_aligned_real_array(unsigned elements, FLAC__real **unaligned_pointer, FLAC__real **aligned_pointer)
|
||||
{
|
||||
FLAC__real *pu; /* unaligned pointer */
|
||||
union { /* union needed to comply with C99 pointer aliasing rules */
|
||||
FLAC__real *pa; /* aligned pointer */
|
||||
void *pv; /* aligned pointer alias */
|
||||
} u;
|
||||
|
||||
FLAC__ASSERT(elements > 0);
|
||||
FLAC__ASSERT(0 != unaligned_pointer);
|
||||
FLAC__ASSERT(0 != aligned_pointer);
|
||||
FLAC__ASSERT(unaligned_pointer != aligned_pointer);
|
||||
|
||||
if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
|
||||
return false;
|
||||
|
||||
pu = (FLAC__real*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
|
||||
if(0 == pu) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if(*unaligned_pointer != 0)
|
||||
free(*unaligned_pointer);
|
||||
*unaligned_pointer = pu;
|
||||
*aligned_pointer = u.pa;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
3363
flac/src/libFLAC/metadata_iterators.c
Normal file
3363
flac/src/libFLAC/metadata_iterators.c
Normal file
File diff suppressed because it is too large
Load Diff
1824
flac/src/libFLAC/metadata_object.c
Normal file
1824
flac/src/libFLAC/metadata_object.c
Normal file
File diff suppressed because it is too large
Load Diff
253
flac/src/libFLAC/ogg_decoder_aspect.c
Normal file
253
flac/src/libFLAC/ogg_decoder_aspect.c
Normal file
@@ -0,0 +1,253 @@
|
||||
/* libFLAC - Free Lossless Audio Codec
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h> /* for memcpy() */
|
||||
#include "FLAC/assert.h"
|
||||
#include "private/ogg_decoder_aspect.h"
|
||||
#include "private/ogg_mapping.h"
|
||||
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
#define max(x,y) ((x)>(y)?(x):(y))
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Public class methods
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
FLAC__bool FLAC__ogg_decoder_aspect_init(FLAC__OggDecoderAspect *aspect)
|
||||
{
|
||||
/* we will determine the serial number later if necessary */
|
||||
if(ogg_stream_init(&aspect->stream_state, aspect->serial_number) != 0)
|
||||
return false;
|
||||
|
||||
if(ogg_sync_init(&aspect->sync_state) != 0)
|
||||
return false;
|
||||
|
||||
aspect->version_major = ~(0u);
|
||||
aspect->version_minor = ~(0u);
|
||||
|
||||
aspect->need_serial_number = aspect->use_first_serial_number;
|
||||
|
||||
aspect->end_of_stream = false;
|
||||
aspect->have_working_page = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void FLAC__ogg_decoder_aspect_finish(FLAC__OggDecoderAspect *aspect)
|
||||
{
|
||||
(void)ogg_sync_clear(&aspect->sync_state);
|
||||
(void)ogg_stream_clear(&aspect->stream_state);
|
||||
}
|
||||
|
||||
void FLAC__ogg_decoder_aspect_set_serial_number(FLAC__OggDecoderAspect *aspect, long value)
|
||||
{
|
||||
aspect->use_first_serial_number = false;
|
||||
aspect->serial_number = value;
|
||||
}
|
||||
|
||||
void FLAC__ogg_decoder_aspect_set_defaults(FLAC__OggDecoderAspect *aspect)
|
||||
{
|
||||
aspect->use_first_serial_number = true;
|
||||
}
|
||||
|
||||
void FLAC__ogg_decoder_aspect_flush(FLAC__OggDecoderAspect *aspect)
|
||||
{
|
||||
(void)ogg_stream_reset(&aspect->stream_state);
|
||||
(void)ogg_sync_reset(&aspect->sync_state);
|
||||
aspect->end_of_stream = false;
|
||||
aspect->have_working_page = false;
|
||||
}
|
||||
|
||||
void FLAC__ogg_decoder_aspect_reset(FLAC__OggDecoderAspect *aspect)
|
||||
{
|
||||
FLAC__ogg_decoder_aspect_flush(aspect);
|
||||
|
||||
if(aspect->use_first_serial_number)
|
||||
aspect->need_serial_number = true;
|
||||
}
|
||||
|
||||
FLAC__OggDecoderAspectReadStatus FLAC__ogg_decoder_aspect_read_callback_wrapper(FLAC__OggDecoderAspect *aspect, FLAC__byte buffer[], size_t *bytes, FLAC__OggDecoderAspectReadCallbackProxy read_callback, const FLAC__StreamDecoder *decoder, void *client_data)
|
||||
{
|
||||
static const size_t OGG_BYTES_CHUNK = 8192;
|
||||
const size_t bytes_requested = *bytes;
|
||||
|
||||
/*
|
||||
* The FLAC decoding API uses pull-based reads, whereas Ogg decoding
|
||||
* is push-based. In libFLAC, when you ask to decode a frame, the
|
||||
* decoder will eventually call the read callback to supply some data,
|
||||
* but how much it asks for depends on how much free space it has in
|
||||
* its internal buffer. It does not try to grow its internal buffer
|
||||
* to accomodate a whole frame because then the internal buffer size
|
||||
* could not be limited, which is necessary in embedded applications.
|
||||
*
|
||||
* Ogg however grows its internal buffer until a whole page is present;
|
||||
* only then can you get decoded data out. So we can't just ask for
|
||||
* the same number of bytes from Ogg, then pass what's decoded down to
|
||||
* libFLAC. If what libFLAC is asking for will not contain a whole
|
||||
* page, then we will get no data from ogg_sync_pageout(), and at the
|
||||
* same time cannot just read more data from the client for the purpose
|
||||
* of getting a whole decoded page because the decoded size might be
|
||||
* larger than libFLAC's internal buffer.
|
||||
*
|
||||
* Instead, whenever this read callback wrapper is called, we will
|
||||
* continually request data from the client until we have at least one
|
||||
* page, and manage pages internally so that we can send pieces of
|
||||
* pages down to libFLAC in such a way that we obey its size
|
||||
* requirement. To limit the amount of callbacks, we will always try
|
||||
* to read in enough pages to return the full number of bytes
|
||||
* requested.
|
||||
*/
|
||||
*bytes = 0;
|
||||
while (*bytes < bytes_requested && !aspect->end_of_stream) {
|
||||
if (aspect->have_working_page) {
|
||||
if (aspect->have_working_packet) {
|
||||
size_t n = bytes_requested - *bytes;
|
||||
if ((size_t)aspect->working_packet.bytes <= n) {
|
||||
/* the rest of the packet will fit in the buffer */
|
||||
n = aspect->working_packet.bytes;
|
||||
memcpy(buffer, aspect->working_packet.packet, n);
|
||||
*bytes += n;
|
||||
buffer += n;
|
||||
aspect->have_working_packet = false;
|
||||
}
|
||||
else {
|
||||
/* only n bytes of the packet will fit in the buffer */
|
||||
memcpy(buffer, aspect->working_packet.packet, n);
|
||||
*bytes += n;
|
||||
buffer += n;
|
||||
aspect->working_packet.packet += n;
|
||||
aspect->working_packet.bytes -= n;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* try and get another packet */
|
||||
const int ret = ogg_stream_packetout(&aspect->stream_state, &aspect->working_packet);
|
||||
if (ret > 0) {
|
||||
aspect->have_working_packet = true;
|
||||
/* if it is the first header packet, check for magic and a supported Ogg FLAC mapping version */
|
||||
if (aspect->working_packet.bytes > 0 && aspect->working_packet.packet[0] == FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE) {
|
||||
const FLAC__byte *b = aspect->working_packet.packet;
|
||||
const unsigned header_length =
|
||||
FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH +
|
||||
FLAC__OGG_MAPPING_MAGIC_LENGTH +
|
||||
FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH +
|
||||
FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH +
|
||||
FLAC__OGG_MAPPING_NUM_HEADERS_LENGTH;
|
||||
if (aspect->working_packet.bytes < (long)header_length)
|
||||
return FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC;
|
||||
b += FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH;
|
||||
if (memcmp(b, FLAC__OGG_MAPPING_MAGIC, FLAC__OGG_MAPPING_MAGIC_LENGTH))
|
||||
return FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC;
|
||||
b += FLAC__OGG_MAPPING_MAGIC_LENGTH;
|
||||
aspect->version_major = (unsigned)(*b);
|
||||
b += FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH;
|
||||
aspect->version_minor = (unsigned)(*b);
|
||||
if (aspect->version_major != 1)
|
||||
return FLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION;
|
||||
aspect->working_packet.packet += header_length;
|
||||
aspect->working_packet.bytes -= header_length;
|
||||
}
|
||||
}
|
||||
else if (ret == 0) {
|
||||
aspect->have_working_page = false;
|
||||
}
|
||||
else { /* ret < 0 */
|
||||
/* lost sync, we'll leave the working page for the next call */
|
||||
return FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* try and get another page */
|
||||
const int ret = ogg_sync_pageout(&aspect->sync_state, &aspect->working_page);
|
||||
if (ret > 0) {
|
||||
/* got a page, grab the serial number if necessary */
|
||||
if(aspect->need_serial_number) {
|
||||
aspect->stream_state.serialno = aspect->serial_number = ogg_page_serialno(&aspect->working_page);
|
||||
aspect->need_serial_number = false;
|
||||
}
|
||||
if(ogg_stream_pagein(&aspect->stream_state, &aspect->working_page) == 0) {
|
||||
aspect->have_working_page = true;
|
||||
aspect->have_working_packet = false;
|
||||
}
|
||||
/* else do nothing, could be a page from another stream */
|
||||
}
|
||||
else if (ret == 0) {
|
||||
/* need more data */
|
||||
const size_t ogg_bytes_to_read = max(bytes_requested - *bytes, OGG_BYTES_CHUNK);
|
||||
char *oggbuf = ogg_sync_buffer(&aspect->sync_state, ogg_bytes_to_read);
|
||||
|
||||
if(0 == oggbuf) {
|
||||
return FLAC__OGG_DECODER_ASPECT_READ_STATUS_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
else {
|
||||
size_t ogg_bytes_read = ogg_bytes_to_read;
|
||||
|
||||
switch(read_callback(decoder, (FLAC__byte*)oggbuf, &ogg_bytes_read, client_data)) {
|
||||
case FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK:
|
||||
break;
|
||||
case FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM:
|
||||
aspect->end_of_stream = true;
|
||||
break;
|
||||
case FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT:
|
||||
return FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT;
|
||||
default:
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
|
||||
if(ogg_sync_wrote(&aspect->sync_state, ogg_bytes_read) < 0) {
|
||||
/* double protection; this will happen if the read callback returns more bytes than the max requested, which would overflow Ogg's internal buffer */
|
||||
FLAC__ASSERT(0);
|
||||
return FLAC__OGG_DECODER_ASPECT_READ_STATUS_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
else { /* ret < 0 */
|
||||
/* lost sync, bail out */
|
||||
return FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aspect->end_of_stream && *bytes == 0) {
|
||||
return FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM;
|
||||
}
|
||||
|
||||
return FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK;
|
||||
}
|
||||
227
flac/src/libFLAC/ogg_encoder_aspect.c
Normal file
227
flac/src/libFLAC/ogg_encoder_aspect.c
Normal file
@@ -0,0 +1,227 @@
|
||||
/* libFLAC - Free Lossless Audio Codec
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h> /* for memset() */
|
||||
#include "FLAC/assert.h"
|
||||
#include "private/ogg_encoder_aspect.h"
|
||||
#include "private/ogg_mapping.h"
|
||||
|
||||
static const FLAC__byte FLAC__OGG_MAPPING_VERSION_MAJOR = 1;
|
||||
static const FLAC__byte FLAC__OGG_MAPPING_VERSION_MINOR = 0;
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Public class methods
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
FLAC__bool FLAC__ogg_encoder_aspect_init(FLAC__OggEncoderAspect *aspect)
|
||||
{
|
||||
/* we will determine the serial number later if necessary */
|
||||
if(ogg_stream_init(&aspect->stream_state, aspect->serial_number) != 0)
|
||||
return false;
|
||||
|
||||
aspect->seen_magic = false;
|
||||
aspect->is_first_packet = true;
|
||||
aspect->samples_written = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void FLAC__ogg_encoder_aspect_finish(FLAC__OggEncoderAspect *aspect)
|
||||
{
|
||||
(void)ogg_stream_clear(&aspect->stream_state);
|
||||
/*@@@ what about the page? */
|
||||
}
|
||||
|
||||
void FLAC__ogg_encoder_aspect_set_serial_number(FLAC__OggEncoderAspect *aspect, long value)
|
||||
{
|
||||
aspect->serial_number = value;
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__ogg_encoder_aspect_set_num_metadata(FLAC__OggEncoderAspect *aspect, unsigned value)
|
||||
{
|
||||
if(value < (1u << FLAC__OGG_MAPPING_NUM_HEADERS_LEN)) {
|
||||
aspect->num_metadata = value;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void FLAC__ogg_encoder_aspect_set_defaults(FLAC__OggEncoderAspect *aspect)
|
||||
{
|
||||
aspect->serial_number = 0;
|
||||
aspect->num_metadata = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* The basic FLAC -> Ogg mapping goes like this:
|
||||
*
|
||||
* - 'fLaC' magic and STREAMINFO block get combined into the first
|
||||
* packet. The packet is prefixed with
|
||||
* + the one-byte packet type 0x7F
|
||||
* + 'FLAC' magic
|
||||
* + the 2 byte Ogg FLAC mapping version number
|
||||
* + tne 2 byte big-endian # of header packets
|
||||
* - The first packet is flushed to the first page.
|
||||
* - Each subsequent metadata block goes into its own packet.
|
||||
* - Each metadata packet is flushed to page (this is not required,
|
||||
* the mapping only requires that a flush must occur after all
|
||||
* metadata is written).
|
||||
* - Each subsequent FLAC audio frame goes into its own packet.
|
||||
*
|
||||
* WATCHOUT:
|
||||
* This depends on the behavior of FLAC__StreamEncoder that we get a
|
||||
* separate write callback for the fLaC magic, and then separate write
|
||||
* callbacks for each metadata block and audio frame.
|
||||
*/
|
||||
FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data)
|
||||
{
|
||||
/* WATCHOUT:
|
||||
* This depends on the behavior of FLAC__StreamEncoder that 'samples'
|
||||
* will be 0 for metadata writes.
|
||||
*/
|
||||
const FLAC__bool is_metadata = (samples == 0);
|
||||
|
||||
/*
|
||||
* Treat fLaC magic packet specially. We will note when we see it, then
|
||||
* wait until we get the STREAMINFO and prepend it in that packet
|
||||
*/
|
||||
if(aspect->seen_magic) {
|
||||
ogg_packet packet;
|
||||
FLAC__byte synthetic_first_packet_body[
|
||||
FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH +
|
||||
FLAC__OGG_MAPPING_MAGIC_LENGTH +
|
||||
FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH +
|
||||
FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH +
|
||||
FLAC__OGG_MAPPING_NUM_HEADERS_LENGTH +
|
||||
FLAC__STREAM_SYNC_LENGTH +
|
||||
FLAC__STREAM_METADATA_HEADER_LENGTH +
|
||||
FLAC__STREAM_METADATA_STREAMINFO_LENGTH
|
||||
];
|
||||
|
||||
memset(&packet, 0, sizeof(packet));
|
||||
packet.granulepos = aspect->samples_written + samples;
|
||||
|
||||
if(aspect->is_first_packet) {
|
||||
FLAC__byte *b = synthetic_first_packet_body;
|
||||
if(bytes != FLAC__STREAM_METADATA_HEADER_LENGTH + FLAC__STREAM_METADATA_STREAMINFO_LENGTH) {
|
||||
/*
|
||||
* If we get here, our assumption about the way write callbacks happen
|
||||
* (explained above) is wrong
|
||||
*/
|
||||
FLAC__ASSERT(0);
|
||||
return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
|
||||
}
|
||||
/* add first header packet type */
|
||||
*b = FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE;
|
||||
b += FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH;
|
||||
/* add 'FLAC' mapping magic */
|
||||
memcpy(b, FLAC__OGG_MAPPING_MAGIC, FLAC__OGG_MAPPING_MAGIC_LENGTH);
|
||||
b += FLAC__OGG_MAPPING_MAGIC_LENGTH;
|
||||
/* add Ogg FLAC mapping major version number */
|
||||
memcpy(b, &FLAC__OGG_MAPPING_VERSION_MAJOR, FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH);
|
||||
b += FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH;
|
||||
/* add Ogg FLAC mapping minor version number */
|
||||
memcpy(b, &FLAC__OGG_MAPPING_VERSION_MINOR, FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH);
|
||||
b += FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH;
|
||||
/* add number of header packets */
|
||||
*b = (FLAC__byte)(aspect->num_metadata >> 8);
|
||||
b++;
|
||||
*b = (FLAC__byte)(aspect->num_metadata);
|
||||
b++;
|
||||
/* add native FLAC 'fLaC' magic */
|
||||
memcpy(b, FLAC__STREAM_SYNC_STRING, FLAC__STREAM_SYNC_LENGTH);
|
||||
b += FLAC__STREAM_SYNC_LENGTH;
|
||||
/* add STREAMINFO */
|
||||
memcpy(b, buffer, bytes);
|
||||
FLAC__ASSERT(b + bytes - synthetic_first_packet_body == sizeof(synthetic_first_packet_body));
|
||||
packet.packet = (unsigned char *)synthetic_first_packet_body;
|
||||
packet.bytes = sizeof(synthetic_first_packet_body);
|
||||
|
||||
packet.b_o_s = 1;
|
||||
aspect->is_first_packet = false;
|
||||
}
|
||||
else {
|
||||
packet.packet = (unsigned char *)buffer;
|
||||
packet.bytes = bytes;
|
||||
}
|
||||
|
||||
if(is_last_block) {
|
||||
/* we used to check:
|
||||
* FLAC__ASSERT(total_samples_estimate == 0 || total_samples_estimate == aspect->samples_written + samples);
|
||||
* but it's really not useful since total_samples_estimate is an estimate and can be inexact
|
||||
*/
|
||||
packet.e_o_s = 1;
|
||||
}
|
||||
|
||||
if(ogg_stream_packetin(&aspect->stream_state, &packet) != 0)
|
||||
return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
|
||||
|
||||
/*@@@ can't figure out a way to pass a useful number for 'samples' to the write_callback, so we'll just pass 0 */
|
||||
if(is_metadata) {
|
||||
while(ogg_stream_flush(&aspect->stream_state, &aspect->page) != 0) {
|
||||
if(write_callback(encoder, aspect->page.header, aspect->page.header_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
|
||||
return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
|
||||
if(write_callback(encoder, aspect->page.body, aspect->page.body_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
|
||||
return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
while(ogg_stream_pageout(&aspect->stream_state, &aspect->page) != 0) {
|
||||
if(write_callback(encoder, aspect->page.header, aspect->page.header_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
|
||||
return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
|
||||
if(write_callback(encoder, aspect->page.body, aspect->page.body_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK)
|
||||
return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(is_metadata && current_frame == 0 && samples == 0 && bytes == 4 && 0 == memcmp(buffer, FLAC__STREAM_SYNC_STRING, sizeof(FLAC__STREAM_SYNC_STRING))) {
|
||||
aspect->seen_magic = true;
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* If we get here, our assumption about the way write callbacks happen
|
||||
* explained above is wrong
|
||||
*/
|
||||
FLAC__ASSERT(0);
|
||||
return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
|
||||
}
|
||||
|
||||
aspect->samples_written += samples;
|
||||
|
||||
return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
|
||||
}
|
||||
209
flac/src/libFLAC/ogg_helper.c
Normal file
209
flac/src/libFLAC/ogg_helper.c
Normal file
@@ -0,0 +1,209 @@
|
||||
/* libFLAC - Free Lossless Audio Codec
|
||||
* Copyright (C) 2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h> /* for malloc() */
|
||||
#include <string.h> /* for memcmp(), memcpy() */
|
||||
#include "FLAC/assert.h"
|
||||
#include "share/alloc.h"
|
||||
#include "private/ogg_helper.h"
|
||||
#include "protected/stream_encoder.h"
|
||||
|
||||
|
||||
static FLAC__bool full_read_(FLAC__StreamEncoder *encoder, FLAC__byte *buffer, size_t bytes, FLAC__StreamEncoderReadCallback read_callback, void *client_data)
|
||||
{
|
||||
while(bytes > 0) {
|
||||
size_t bytes_read = bytes;
|
||||
switch(read_callback(encoder, buffer, &bytes_read, client_data)) {
|
||||
case FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE:
|
||||
bytes -= bytes_read;
|
||||
buffer += bytes_read;
|
||||
break;
|
||||
case FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM:
|
||||
if(bytes_read == 0) {
|
||||
encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
|
||||
return false;
|
||||
}
|
||||
bytes -= bytes_read;
|
||||
buffer += bytes_read;
|
||||
break;
|
||||
case FLAC__STREAM_ENCODER_READ_STATUS_ABORT:
|
||||
encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
|
||||
return false;
|
||||
case FLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED:
|
||||
return false;
|
||||
default:
|
||||
/* double protection: */
|
||||
FLAC__ASSERT(0);
|
||||
encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void simple_ogg_page__init(ogg_page *page)
|
||||
{
|
||||
page->header = 0;
|
||||
page->header_len = 0;
|
||||
page->body = 0;
|
||||
page->body_len = 0;
|
||||
}
|
||||
|
||||
void simple_ogg_page__clear(ogg_page *page)
|
||||
{
|
||||
if(page->header)
|
||||
free(page->header);
|
||||
if(page->body)
|
||||
free(page->body);
|
||||
simple_ogg_page__init(page);
|
||||
}
|
||||
|
||||
FLAC__bool simple_ogg_page__get_at(FLAC__StreamEncoder *encoder, FLAC__uint64 position, ogg_page *page, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderReadCallback read_callback, void *client_data)
|
||||
{
|
||||
static const unsigned OGG_HEADER_FIXED_PORTION_LEN = 27;
|
||||
static const unsigned OGG_MAX_HEADER_LEN = 27/*OGG_HEADER_FIXED_PORTION_LEN*/ + 255;
|
||||
FLAC__byte crc[4];
|
||||
FLAC__StreamEncoderSeekStatus seek_status;
|
||||
|
||||
FLAC__ASSERT(page->header == 0);
|
||||
FLAC__ASSERT(page->header_len == 0);
|
||||
FLAC__ASSERT(page->body == 0);
|
||||
FLAC__ASSERT(page->body_len == 0);
|
||||
|
||||
/* move the stream pointer to the supposed beginning of the page */
|
||||
if(0 == seek_callback)
|
||||
return false;
|
||||
if((seek_status = seek_callback((FLAC__StreamEncoder*)encoder, position, client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) {
|
||||
if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR)
|
||||
encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* allocate space for the page header */
|
||||
if(0 == (page->header = (unsigned char *)safe_malloc_(OGG_MAX_HEADER_LEN))) {
|
||||
encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* read in the fixed part of the page header (up to but not including
|
||||
* the segment table */
|
||||
if(!full_read_(encoder, page->header, OGG_HEADER_FIXED_PORTION_LEN, read_callback, client_data))
|
||||
return false;
|
||||
|
||||
page->header_len = OGG_HEADER_FIXED_PORTION_LEN + page->header[26];
|
||||
|
||||
/* check to see if it's a correct, "simple" page (one packet only) */
|
||||
if(
|
||||
memcmp(page->header, "OggS", 4) || /* doesn't start with OggS */
|
||||
(page->header[5] & 0x01) || /* continued packet */
|
||||
memcmp(page->header+6, "\0\0\0\0\0\0\0\0", 8) || /* granulepos is non-zero */
|
||||
page->header[26] == 0 /* packet is 0-size */
|
||||
) {
|
||||
encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* read in the segment table */
|
||||
if(!full_read_(encoder, page->header + OGG_HEADER_FIXED_PORTION_LEN, page->header[26], read_callback, client_data))
|
||||
return false;
|
||||
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
/* check to see that it specifies a single packet */
|
||||
for(i = 0; i < (unsigned)page->header[26] - 1; i++) {
|
||||
if(page->header[i + OGG_HEADER_FIXED_PORTION_LEN] != 255) {
|
||||
encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
page->body_len = 255 * i + page->header[i + OGG_HEADER_FIXED_PORTION_LEN];
|
||||
}
|
||||
|
||||
/* allocate space for the page body */
|
||||
if(0 == (page->body = (unsigned char *)safe_malloc_(page->body_len))) {
|
||||
encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* read in the page body */
|
||||
if(!full_read_(encoder, page->body, page->body_len, read_callback, client_data))
|
||||
return false;
|
||||
|
||||
/* check the CRC */
|
||||
memcpy(crc, page->header+22, 4);
|
||||
ogg_page_checksum_set(page);
|
||||
if(memcmp(crc, page->header+22, 4)) {
|
||||
encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC__bool simple_ogg_page__set_at(FLAC__StreamEncoder *encoder, FLAC__uint64 position, ogg_page *page, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderWriteCallback write_callback, void *client_data)
|
||||
{
|
||||
FLAC__StreamEncoderSeekStatus seek_status;
|
||||
|
||||
FLAC__ASSERT(page->header != 0);
|
||||
FLAC__ASSERT(page->header_len != 0);
|
||||
FLAC__ASSERT(page->body != 0);
|
||||
FLAC__ASSERT(page->body_len != 0);
|
||||
|
||||
/* move the stream pointer to the supposed beginning of the page */
|
||||
if(0 == seek_callback)
|
||||
return false;
|
||||
if((seek_status = seek_callback((FLAC__StreamEncoder*)encoder, position, client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) {
|
||||
if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR)
|
||||
encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
ogg_page_checksum_set(page);
|
||||
|
||||
/* re-write the page */
|
||||
if(write_callback((FLAC__StreamEncoder*)encoder, page->header, page->header_len, 0, 0, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) {
|
||||
encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
|
||||
return false;
|
||||
}
|
||||
if(write_callback((FLAC__StreamEncoder*)encoder, page->body, page->body_len, 0, 0, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) {
|
||||
encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
47
flac/src/libFLAC/ogg_mapping.c
Normal file
47
flac/src/libFLAC/ogg_mapping.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/* libFLAC - Free Lossless Audio Codec
|
||||
* Copyright (C) 2004,2005,2006,2007,2008 Josh Coalson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "private/ogg_mapping.h"
|
||||
|
||||
const unsigned FLAC__OGG_MAPPING_PACKET_TYPE_LEN = 8; /* bits */
|
||||
|
||||
const FLAC__byte FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE = 0x7f;
|
||||
|
||||
const FLAC__byte * const FLAC__OGG_MAPPING_MAGIC = (const FLAC__byte * const)"FLAC";
|
||||
|
||||
const unsigned FLAC__OGG_MAPPING_VERSION_MAJOR_LEN = 8; /* bits */
|
||||
const unsigned FLAC__OGG_MAPPING_VERSION_MINOR_LEN = 8; /* bits */
|
||||
|
||||
const unsigned FLAC__OGG_MAPPING_NUM_HEADERS_LEN = 16; /* bits */
|
||||
31
flac/src/libFLAC/ppc/Makefile.am
Normal file
31
flac/src/libFLAC/ppc/Makefile.am
Normal file
@@ -0,0 +1,31 @@
|
||||
# libFLAC - Free Lossless Audio Codec library
|
||||
# Copyright (C) 2004,2005,2006,2007,2008 Josh Coalson
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# - Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# - Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# - Neither the name of the Xiph.org Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
SUBDIRS = as gas
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user