src/FLAC : Merge from upstream CVS.

This commit is contained in:
Erik de Castro Lopo 2007-07-25 21:09:44 +10:00
parent ea1f70fa87
commit 11186a0f4f
11 changed files with 72 additions and 22 deletions

View File

@ -1,3 +1,8 @@
2007-07-25 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/FLAC
Merge from FLAC upstream sources.
2007-07-15 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/flac.c

View File

@ -793,6 +793,7 @@ FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, unsig
/* this is by far the most heavily used reader call. it ain't pretty but it's fast */
/* a lot of the logic is copied, then adapted, from FLAC__bitreader_read_unary_unsigned() and FLAC__bitreader_read_raw_uint32() */
FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter)
/* OPT: possibly faster version for use with MSVC */
#ifdef _MSC_VER
{
unsigned i;

View File

@ -544,7 +544,7 @@ FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FL
msbits = uval >> parameter;
#if 1 /* OPT: can remove this special case if it doesn't make up for the extra compare */
#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;
@ -565,7 +565,7 @@ FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FL
}
}
else {
#elif 0 /*@@@@@@ OPT: try this version with MSVC6 to see if better, not much difference for gcc-4 */
#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;

View File

@ -61,9 +61,9 @@ FLAC_API const char *FLAC__VERSION_STRING = "1.2.0";
#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.0 20070707";
FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC 1.2.0 20070715";
#else
FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC CVS 1.2.0 20070707";
FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC CVS 1.2.0 20070715";
#endif
FLAC_API const FLAC__byte FLAC__STREAM_SYNC_STRING[4] = { 'f','L','a','C' };

View File

@ -1198,8 +1198,7 @@ static FLAC__bool chain_read_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle han
return true;
}
static
FLAC__StreamDecoderReadStatus chain_read_ogg_read_cb_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
static FLAC__StreamDecoderReadStatus chain_read_ogg_read_cb_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
{
FLAC__Metadata_Chain *chain = (FLAC__Metadata_Chain*)client_data;
(void)decoder;
@ -2319,8 +2318,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_cb_(FLAC__
return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
}
static
FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_picture_cstring_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__byte **data, FLAC__uint32 *length, FLAC__uint32 length_len)
static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_picture_cstring_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__byte **data, FLAC__uint32 *length, FLAC__uint32 length_len)
{
FLAC__byte buffer[sizeof(FLAC__uint32)];

View File

@ -420,8 +420,10 @@ static FLAC__StreamDecoderInitStatus init_stream_internal_(
#ifdef FLAC__CPU_IA32
FLAC__ASSERT(decoder->private_->cpuinfo.type == FLAC__CPUINFO_TYPE_IA32);
#ifdef FLAC__HAS_NASM
#if 1 /*@@@@@@ OPT: not clearly faster, needs more testing */
if(decoder->private_->cpuinfo.data.ia32.bswap)
decoder->private_->local_bitreader_read_rice_signed_block = FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap;
#endif
if(decoder->private_->cpuinfo.data.ia32.mmx) {
decoder->private_->local_lpc_restore_signal = FLAC__lpc_restore_signal_asm_ia32;
decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal_asm_ia32_mmx;

View File

@ -28,6 +28,8 @@
#include <stdlib.h>
#include <string.h>
#include "iconvert.h"
/*
* Convert data from one encoding to another. Return:
*

View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org>
*
* 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
#ifdef HAVE_ICONV
/*
* Convert data from one encoding to another. Return:
*
* -2 : memory allocation failed
* -1 : unknown encoding
* 0 : data was converted exactly
* 1 : data was converted inexactly
* 2 : data was invalid (but still converted)
*
* We convert in two steps, via UTF-8, as this is the only
* reliable way of distinguishing between invalid input
* and valid input which iconv refuses to transliterate.
* We convert from UTF-8 twice, because we have no way of
* knowing whether the conversion was exact if iconv returns
* E2BIG (due to a bug in the specification of iconv).
* An alternative approach is to assume that the output of
* iconv is never more than 4 times as long as the input,
* but I prefer to avoid that assumption if possible.
*/
int iconvert(const char *fromcode, const char *tocode,
const char *from, size_t fromlen,
char **to, size_t *tolen) ;
#endif /* HAVE_ICONV */

View File

@ -227,9 +227,7 @@ int utf8_decode(const char *from, char **to)
#include <langinfo.h>
#endif
int iconvert(const char *fromcode, const char *tocode,
const char *from, size_t fromlen,
char **to, size_t *tolen);
#include "iconvert.h"
static const char *current_charset(void)
{

View File

@ -23,6 +23,6 @@
FLAC__bool test_metadata(void);
FLAC__bool test_metadata_file_manipulation(void);
FLAC__bool test_metadata_object(void) ;
FLAC__bool test_metadata_object(void);
#endif

View File

@ -185,8 +185,7 @@ static void delete_from_our_metadata_(unsigned position)
* This wad of functions supports filename- and callback-based chain reading/writing.
* Everything up to set_file_stats_() is copied from libFLAC/metadata_iterators.c
*/
static
FLAC__bool open_tempfile_(const char *filename, FILE **tempfile, char **tempfilename)
static FLAC__bool open_tempfile_(const char *filename, FILE **tempfile, char **tempfilename)
{
static const char *tempfile_suffix = ".metadata_edit";
@ -201,8 +200,7 @@ FLAC__bool open_tempfile_(const char *filename, FILE **tempfile, char **tempfile
return true;
}
static
void cleanup_tempfile_(FILE **tempfile, char **tempfilename)
static void cleanup_tempfile_(FILE **tempfile, char **tempfilename)
{
if(0 != *tempfile) {
(void)fclose(*tempfile);
@ -216,8 +214,7 @@ void cleanup_tempfile_(FILE **tempfile, char **tempfilename)
}
}
static
FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilename)
static FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilename)
{
FLAC__ASSERT(0 != filename);
FLAC__ASSERT(0 != tempfile);
@ -247,16 +244,14 @@ FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tem
return true;
}
static
FLAC__bool get_file_stats_(const char *filename, struct stat *stats)
static FLAC__bool get_file_stats_(const char *filename, struct stat *stats)
{
FLAC__ASSERT(0 != filename);
FLAC__ASSERT(0 != stats);
return (0 == stat(filename, stats));
}
static
void set_file_stats_(const char *filename, struct stat *stats)
static void set_file_stats_(const char *filename, struct stat *stats)
{
struct utimbuf srctime;