/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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
#if defined _MSC_VER || defined __MINGW32__
#include <io.h> /* for _setmode() */
#include <fcntl.h> /* for _O_BINARY */
#endif
#if defined __CYGWIN__ || defined __EMX__
#include <io.h> /* for setmode(), O_BINARY */
#include <fcntl.h> /* for _O_BINARY */
#endif
#include <limits.h>
#include <stdio.h>
#include <stdlib.h> /* for malloc() */
#include <string.h> /* for memcpy() */
#include <sys/types.h> /* for off_t */
#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
#if _MSC_VER <= 1700 || defined __BORLANDC__ /* @@@ [2G limit] */
#define fseeko fseek
#define ftello ftell
#endif
#endif
#include "../assert.h"
#include "../alloc.h"
#include "../stream_decoder.h"
#include "include/protected/stream_encoder.h"
#include "include/private/bitwriter.h"
#include "include/private/bitmath.h"
#include "include/private/crc.h"
#include "include/private/cpu.h"
#include "include/private/fixed.h"
#include "include/private/format.h"
#include "include/private/lpc.h"
#include "include/private/md5.h"
#include "include/private/memory.h"
#if FLAC__HAS_OGG
#include "include/private/ogg_helper.h"
#include "include/private/ogg_mapping.h"
#endif
#include "include/private/stream_encoder_framing.h"
#include "include/private/window.h"
#ifndef FLaC__INLINE
#define FLaC__INLINE
#endif
#ifdef min
#undef min
#endif
#define min(x,y) ((x)<(y)?(x):(y))
#ifdef max
#undef max
#endif
#define max(x,y) ((x)>(y)?(x):(y))
/* Exact Rice codeword length calculation is off by default. The simple
* (and fast) estimation (of how many bits a residual value will be
* encoded with) in this encoder is very good, almost always yielding
* compression within 0.1% of exact calculation.
*/
#undef EXACT_RICE_BITS_CALCULATION
/* Rice parameter searching is off by default. The simple (and fast)
* parameter estimation in this encoder is very good, almost always
* yielding compression within 0.1% of the optimal parameters.
*/
#undef ENABLE_RICE_PARAMETER_SEARCH
typedef struct {
FLAC__int32 *data[FLAC__MAX_CHANNELS];
unsigned size; /* of each data[] in samples */
unsigned tail;
} verify_input_fifo;
typedef struct {
const FLAC__byte *data;
unsigned capacity;
unsigned bytes;
} verify_output;
typedef enum {
ENCODER_IN_MAGIC = 0,
ENCODER_IN_METADATA = 1,
ENCODER_IN_AUDIO = 2
} EncoderStateHint;
static struct CompressionLevels {
FLAC__bool do_mid_side_stereo;
FLAC__bool loose_mid_side_stereo;
unsigned max_lpc_order;
unsigned qlp_coeff_precision;
FLAC__bool do_qlp_coeff_prec_search;
FLAC__bool do_escape_coding;
FLAC__bool do_exhaustive_model_search;
unsigned min_residual_partition_order;
unsigned max_residual_partition_order;
unsigned rice_parameter_search_dist;
} compression_levels_[] = {
{ false, false, 0, 0, false, false, false, 0, 3, 0 },
{ true , true , 0, 0, false, false, false, 0, 3, 0 },
{ true , false, 0, 0, false, false, false, 0, 3, 0 },
{ false, false, 6, 0, false, false, false, 0, 4, 0 },
{ true , true , 8, 0, false, false, false, 0, 4, 0 },
{ true , false, 8, 0, false, false, false, 0, 5, 0 },
{ true , false, 8, 0, false, false, false, 0, 6, 0 },
{ true , false, 8, 0, false, false, true , 0, 6, 0 },
{ true , false, 12, 0, false, false, true , 0, 6, 0 }
};
/***********************************************************************
*
* Private class method prototypes
*
***********************************************************************/
static void set_defaults_enc(FLAC__StreamEncoder *encoder);
static void free_(FLAC__StreamEncoder *encoder);
static FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, unsigned new_blocksize);
static FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples, FLAC__bool is_last_block);
static FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, FLAC__bool is_last_block);
static void update_metadata_(const FLAC__StreamEncoder *encoder);
#if FLAC__HAS_OGG
static void update_ogg_metadata_(FLAC__StreamEncoder *encoder);
#endif
static FLAC__bool process_frame_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional_block, FLAC__bool is_last_block);
static FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional_block);
static FLAC__bool process_subframe_(
FLAC__StreamEncoder *encoder,
unsigned min_partition_order,
unsigned max_partition_order,
const FLAC__FrameHeader *frame_header,
unsigned subframe_bps,
const FLAC__int32 integer_signal[],
FLAC__Subframe *subframe[2],
FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents[2],
FLAC__int32 *residual[2],
unsigned *best_subframe,
unsigned *best_bits
);
static FLAC__bool add_subframe_(
FLAC__StreamEncoder *encoder,
unsigned blocksize,
unsigned subframe_bps,
const FLAC__Subframe *subframe,
FLAC__BitWriter *frame
);
static unsigned evaluate_constant_subframe_(
FLAC__StreamEncoder *encoder,
const FLAC__int32 signal,
unsigned blocksize,
unsigned subframe_bps,
FLAC__Subframe *subframe
);
static unsigned evaluate_fixed_subframe_(
FLAC__StreamEncoder *encoder,
const FLAC__int32 signal[],
FLAC__int32 residual[],
FLAC__uint64 abs_residual_partition_sums[],
unsigned raw_bits_per_partition[],
unsigned blocksize,
unsigned subframe_bps,
unsigned order,
unsigned rice_parameter,
unsigned rice_parameter_limit,
unsigned min_partition_order,
unsigned max_partition_order,
FLAC__bool do_escape_coding,
unsigned rice_parameter_search_dist,
FLAC__Subframe *subframe,
FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents
);
#ifndef FLAC__INTEGER_ONLY_LIBRARY
static unsigned evaluate_lpc_subframe_(
FLAC__StreamEncoder *encoder,
const FLAC__int32 signal[],
FLAC__int32 residual[],
FLAC__uint64 abs_residual_partition_sums[],
unsigned raw_bits_per_partition[],
const FLAC__real lp_coeff[],
unsigned blocksize,
unsigned subframe_bps,
unsigned order,
unsigned qlp_coeff_precision,
unsigned rice_parameter,
unsigned rice_parameter_limit,
unsigned min_partition_order,
unsigned max_partition_order,
FLAC__bool d
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
The Leap Motion Developer SDK contains the necessary libraries to get started with integrating the Leap Motion Controller into your project. You will find pre-compiled libraries, documentation and some simple examples to get you started. Make sure to check out our Links and Libraries section for support for other languages and frameworks and more in depth example code.
资源推荐
资源详情
资源评论
收起资源包目录
Leap Motion Developer SDK -Windows (2000个子文件)
stream_encoder.c 176KB
pngrtran.c 148KB
stream_decoder.c 136KB
window.c 128KB
pngrutil.c 93KB
pngwutil.c 85KB
vorbisfile.c 73KB
deflate.c 64KB
framing.c 51KB
pngwrite.c 49KB
inflate.c 49KB
jquant2.c 49KB
lpc_flac.c 48KB
pngread.c 48KB
pngpread.c 47KB
trees.c 44KB
bitreader.c 42KB
jmemmgr.c 41KB
jdmarker.c 40KB
vorbisenc.c 40KB
pngset.c 39KB
psy.c 36KB
transupp.c 33KB
jquant1.c 31KB
block.c 31KB
floor1.c 31KB
mapping0.c 29KB
jchuff.c 28KB
bitwriter.c 28KB
res0.c 25KB
jcphuff.c 25KB
jdcoefct.c 25KB
pngget.c 25KB
stream_encoder_framing.c 24KB
smallft.c 23KB
png.c 23KB
infback.c 22KB
jcparam.c 21KB
format.c 21KB
pngtrans.c 21KB
bitwise.c 21KB
jdmainct.c 20KB
jdhuff.c 20KB
jcmaster.c 20KB
jdphuff.c 20KB
jdmaster.c 20KB
info.c 20KB
jcsample.c 19KB
pngwtran.c 17KB
sharedbook.c 17KB
fixed.c 17KB
pngmem.c 17KB
jccoefct.c 16KB
jdsample.c 16KB
jcmarker.c 16KB
mdct.c 16KB
cpu.c 15KB
jccolor.c 15KB
jidctint.c 15KB
md5.c 14KB
jctrans.c 14KB
jdmerge.c 14KB
inftrees.c 14KB
codebook.c 14KB
jdinput.c 14KB
jidctred.c 13KB
crc32.c 13KB
jidctfst.c 13KB
jdcolor.c 13KB
lsp.c 13KB
jdapimin.c 13KB
jcdctmgr.c 13KB
inffast.c 13KB
jcprepct.c 12KB
jfdctint.c 11KB
envelope.c 11KB
pngerror.c 10KB
jdpostct.c 10KB
jdapistd.c 9KB
float.c 9KB
jcmainct.c 9KB
jcapimin.c 9KB
bitrate.c 9KB
jidctflt.c 8KB
jddctmgr.c 8KB
jerror.c 8KB
pngwio.c 8KB
jdatasrc.c 8KB
jfdctfst.c 8KB
zutil.c 7KB
floor0.c 7KB
window_flac.c 7KB
memory.c 7KB
crc.c 6KB
jcapistd.c 6KB
pngrio.c 6KB
jfdctflt.c 5KB
synthesis.c 5KB
jutils.c 5KB
jdtrans.c 5KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
- xue8212015-06-19果真不错。顶顶顶
- lkdaaaaaa2015-03-18这SDK是真的有用!
- shilin_sl2015-07-19不错,官网上也有。
fnext
- 粉丝: 41
- 资源: 14
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功