diff options
Diffstat (limited to 'src/lib')
39 files changed, 307 insertions, 332 deletions
diff --git a/src/lib/formats/cassimg.c b/src/lib/formats/cassimg.c index b7f1ea68ccd..20ccbc99407 100644 --- a/src/lib/formats/cassimg.c +++ b/src/lib/formats/cassimg.c @@ -379,7 +379,7 @@ static casserr_t lookup_sample(cassette_image *cassette, int channel, size_t sam /* is this block beyond the edge of our waveform? */ if (sample_blocknum >= cassette->blocks.count()) cassette->blocks.resize_keep_and_clear_new(sample_blocknum + 1); - + if (cassette->blocks[sample_blocknum] == NULL) cassette->blocks[sample_blocknum] = global_alloc(sample_block); diff --git a/src/lib/formats/ccvf_dsk.c b/src/lib/formats/ccvf_dsk.c index 75a4356c547..d8dc0117bd3 100644 --- a/src/lib/formats/ccvf_dsk.c +++ b/src/lib/formats/ccvf_dsk.c @@ -100,11 +100,11 @@ bool ccvf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) astring line; offs_t byteoffs = 0; char hex[3] = {0}; - + do { end = ccvf.chr(start, 10); line.cpysubstr(ccvf, start, end); - if (line.find(0, "Compucolor Virtual Floppy Disk Image") && line.find(0, "Label") && line.find(0, "Track")) { + if (line.find(0, "Compucolor Virtual Floppy Disk Image") && line.find(0, "Label") && line.find(0, "Track")) { for (int byte = 0; byte < 32; byte++) { if (byteoffs==78720) break; hex[0]=line[byte * 2]; @@ -117,11 +117,11 @@ bool ccvf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) UINT64 pos = 0; int total_size = 200000000/f.cell_size; - + for(int track=0; track < f.track_count; track++) { dynamic_array<UINT32> buffer(total_size); int offset = 0; - + for (int i=0; i<1920 && pos<size; i++, pos++) { for (int bit=0; bit<8; bit++) { bit_w(buffer, offset++, BIT(bytes[pos], bit), f.cell_size); diff --git a/src/lib/formats/d64_dsk.c b/src/lib/formats/d64_dsk.c index 0d6295e2c38..fb985b3ce7b 100644 --- a/src/lib/formats/d64_dsk.c +++ b/src/lib/formats/d64_dsk.c @@ -228,7 +228,7 @@ bool d64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) build_sector_description(f, img, track_offset, error_offset, sectors, sector_count); generate_track(desc, physical_track, head, sectors, sector_count, total_size, image); - + track_offset += track_size; error_offset += sector_count; } diff --git a/src/lib/formats/fmtowns_dsk.c b/src/lib/formats/fmtowns_dsk.c index 9b2bad2170d..71db43650ba 100644 --- a/src/lib/formats/fmtowns_dsk.c +++ b/src/lib/formats/fmtowns_dsk.c @@ -1,7 +1,7 @@ /* * fmtowns_dsk.c * - * FM Towns floppy image format + * FM Towns floppy image format * * Created on: 23/03/2014 */ diff --git a/src/lib/formats/g64_dsk.c b/src/lib/formats/g64_dsk.c index c1c55acc4e8..5beba1ca35f 100644 --- a/src/lib/formats/g64_dsk.c +++ b/src/lib/formats/g64_dsk.c @@ -54,7 +54,7 @@ bool g64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) for (int track = 0; track < track_count; track++) { offs_t track_offset = pick_integer_le(img, TRACK_OFFSET + (track * 4), 4); - + if (!track_offset) continue; @@ -68,7 +68,7 @@ bool g64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) UINT16 track_bytes = pick_integer_le(img, track_offset, 2); int track_size = track_bytes * 8; - + LOG_FORMATS("track %u size %u cell %ld\n", track, track_size, 200000000L/track_size); generate_track_from_bitstream(track, head, &img[track_offset+2], track_size, image); @@ -82,9 +82,9 @@ bool g64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) int g64_format::generate_bitstream(int track, int head, int speed_zone, UINT8 *trackbuf, int &track_size, floppy_image *image) { int cell_size = c1541_cell_size[speed_zone]; - + generate_bitstream_from_track(track, head, cell_size, trackbuf, track_size, image); - + int actual_cell_size = 200000000L/track_size; // allow a tolerance of +- 10 us (3990..4010 -> 4000) @@ -96,7 +96,7 @@ bool g64_format::save(io_generic *io, floppy_image *image) UINT8 header[] = { 'G', 'C', 'R', '-', '1', '5', '4', '1', 0x00, 0x54, TRACK_LENGTH & 0xff, TRACK_LENGTH >> 8 }; io_generic_write(io, header, SIGNATURE, sizeof(header)); - + int head = 0; int tracks_written = 0; @@ -137,7 +137,7 @@ bool g64_format::save(io_generic *io, floppy_image *image) io_generic_write_filler(io, 0xff, dpos, TRACK_LENGTH); io_generic_write(io, track_length, dpos, 2); io_generic_write(io, trackbuf, dpos + 2, track_size); - + tracks_written++; } diff --git a/src/lib/formats/mbee_cas.h b/src/lib/formats/mbee_cas.h index f80d4c15de3..ebca844c7ca 100644 --- a/src/lib/formats/mbee_cas.h +++ b/src/lib/formats/mbee_cas.h @@ -12,4 +12,3 @@ #include "cassimg.h" CASSETTE_FORMATLIST_EXTERN(mbee_cassette_formats); - diff --git a/src/lib/formats/phc25_cas.c b/src/lib/formats/phc25_cas.c index 4efa419f3fd..a0d807a335c 100644 --- a/src/lib/formats/phc25_cas.c +++ b/src/lib/formats/phc25_cas.c @@ -97,10 +97,10 @@ static int phc25_handle_cassette(INT16 *buffer, const UINT8 *bytes) UINT32 i; // silence -// sample_count += phc25_put_samples(buffer, 6640, 2, WAVEENTRY_HIGH); +// sample_count += phc25_put_samples(buffer, 6640, 2, WAVEENTRY_HIGH); /* start */ -// for (i=0; i<12155; i++) +// for (i=0; i<12155; i++) for (i=0; i<2155; i++) sample_count += phc25_output_bit(buffer, sample_count, 1); diff --git a/src/lib/formats/phc25_cas.h b/src/lib/formats/phc25_cas.h index e4018911361..82ee5e2f297 100644 --- a/src/lib/formats/phc25_cas.h +++ b/src/lib/formats/phc25_cas.h @@ -12,4 +12,3 @@ #include "cassimg.h" CASSETTE_FORMATLIST_EXTERN(phc25_cassette_formats); - diff --git a/src/lib/formats/sol_cas.c b/src/lib/formats/sol_cas.c index 67c7c4ba4dc..e5dc79cd21a 100644 --- a/src/lib/formats/sol_cas.c +++ b/src/lib/formats/sol_cas.c @@ -177,7 +177,7 @@ static int sol20_read_hex(const UINT8 *bytes, UINT8 numdigits) } return data; } - + // Turn digits into decimal static int sol20_read_dec(const UINT8 *bytes) { @@ -191,7 +191,7 @@ static int sol20_read_dec(const UINT8 *bytes) return data; } - + static int sol20_handle_cassette(INT16 *buffer, const UINT8 *bytes) { UINT32 sample_count = 0; @@ -283,7 +283,7 @@ static int sol20_handle_cassette(INT16 *buffer, const UINT8 *bytes) sample_count += sol20_output_byte(buffer, sample_count, sol20_header[i]); // write checksum sample_count += sol20_output_byte(buffer, sample_count, sol20_cksm_byte); - + sol20_cksm_byte = 0; process_d = 1; sol20_scan_to_eol(bytes); diff --git a/src/lib/formats/sol_cas.h b/src/lib/formats/sol_cas.h index 60388e012ab..add6743475d 100644 --- a/src/lib/formats/sol_cas.h +++ b/src/lib/formats/sol_cas.h @@ -12,4 +12,3 @@ #include "cassimg.h" CASSETTE_FORMATLIST_EXTERN(sol20_cassette_formats); - diff --git a/src/lib/formats/sorc_cas.h b/src/lib/formats/sorc_cas.h index 1f021464339..b2716458a88 100644 --- a/src/lib/formats/sorc_cas.h +++ b/src/lib/formats/sorc_cas.h @@ -12,4 +12,3 @@ #include "cassimg.h" CASSETTE_FORMATLIST_EXTERN(sorcerer_cassette_formats); - diff --git a/src/lib/formats/spc1000_cas.h b/src/lib/formats/spc1000_cas.h index ffdffab3074..b0dbc80f5dd 100644 --- a/src/lib/formats/spc1000_cas.h +++ b/src/lib/formats/spc1000_cas.h @@ -12,4 +12,3 @@ #include "cassimg.h" CASSETTE_FORMATLIST_EXTERN(spc1000_cassette_formats); - diff --git a/src/lib/formats/z80ne_dsk.c b/src/lib/formats/z80ne_dsk.c index 4445bcfcacf..6394e177f4f 100644 --- a/src/lib/formats/z80ne_dsk.c +++ b/src/lib/formats/z80ne_dsk.c @@ -208,7 +208,7 @@ static floperr_t z80ne_dmk_format_track(floppy_image_legacy *floppy, int head, i /* set up sector map */ sector_map.resize_and_clear(sectors, 0xFF); - + physical_sector = 0; for (logical_sector = 0; logical_sector < sectors; logical_sector++) { diff --git a/src/lib/libflac/include/FLAC/export.h b/src/lib/libflac/include/FLAC/export.h index a525f29c1e5..e8295b86eac 100644 --- a/src/lib/libflac/include/FLAC/export.h +++ b/src/lib/libflac/include/FLAC/export.h @@ -61,9 +61,9 @@ #else #ifdef FLAC_API_EXPORTS -#define FLAC_API _declspec(dllexport) +#define FLAC_API _declspec(dllexport) #else -#define FLAC_API _declspec(dllimport) +#define FLAC_API _declspec(dllimport) #endif #endif diff --git a/src/lib/libflac/include/FLAC/format.h b/src/lib/libflac/include/FLAC/format.h index 77e2d0130e5..2c838f34f8e 100644 --- a/src/lib/libflac/include/FLAC/format.h +++ b/src/lib/libflac/include/FLAC/format.h @@ -84,8 +84,8 @@ extern "C" { /* - Most of the values described in this file are defined by the FLAC - format specification. There is nothing to tune here. + Most of the values described in this file are defined by the FLAC + format specification. There is nothing to tune here. */ /** The largest legal metadata type code. */ @@ -211,7 +211,6 @@ extern FLAC_API const char * const FLAC__EntropyCodingMethodTypeString[]; /** Contents of a Rice partitioned residual */ typedef struct { - unsigned *parameters; /**< The Rice parameters for each context. */ @@ -230,7 +229,6 @@ typedef struct { /** Header for a Rice partitioned residual. (c.f. <A HREF="../format.html#partitioned_rice">format specification</A>) */ typedef struct { - unsigned order; /**< The partition order, i.e. # of contexts = 2 ^ \a order. */ @@ -486,7 +484,6 @@ typedef struct { /** An enumeration of the available metadata block types. */ typedef enum { - FLAC__METADATA_TYPE_STREAMINFO = 0, /**< <A HREF="../format.html#metadata_block_streaminfo">STREAMINFO</A> block */ diff --git a/src/lib/libflac/include/FLAC/metadata.h b/src/lib/libflac/include/FLAC/metadata.h index fff90b0bafd..879b0b40a63 100644 --- a/src/lib/libflac/include/FLAC/metadata.h +++ b/src/lib/libflac/include/FLAC/metadata.h @@ -306,7 +306,6 @@ typedef struct FLAC__Metadata_SimpleIterator FLAC__Metadata_SimpleIterator; * The iterator's current status can be obtained by calling FLAC__metadata_simple_iterator_status(). */ typedef enum { - FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK = 0, /**< The iterator is in the normal OK state */ @@ -763,7 +762,7 @@ typedef enum { FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH, /**< FLAC__metadata_chain_write() was called on a chain read by * FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks(), - * or + * or * FLAC__metadata_chain_write_with_callbacks()/FLAC__metadata_chain_write_with_callbacks_and_tempfile() * was called on a chain read by * FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg(). diff --git a/src/lib/libflac/include/FLAC/stream_decoder.h b/src/lib/libflac/include/FLAC/stream_decoder.h index 9ac159474af..1d44a36f204 100644 --- a/src/lib/libflac/include/FLAC/stream_decoder.h +++ b/src/lib/libflac/include/FLAC/stream_decoder.h @@ -199,7 +199,6 @@ extern "C" { * The decoder's state can be obtained by calling FLAC__stream_decoder_get_state(). */ typedef enum { - FLAC__STREAM_DECODER_SEARCH_FOR_METADATA = 0, /**< The decoder is ready to search for metadata. */ @@ -253,7 +252,6 @@ extern FLAC_API const char * const FLAC__StreamDecoderStateString[]; /** Possible return values for the FLAC__stream_decoder_init_*() functions. */ typedef enum { - FLAC__STREAM_DECODER_INIT_STATUS_OK = 0, /**< Initialization was successful. */ @@ -291,7 +289,6 @@ extern FLAC_API const char * const FLAC__StreamDecoderInitStatusString[]; /** Return values for the FLAC__StreamDecoder read callback. */ typedef enum { - FLAC__STREAM_DECODER_READ_STATUS_CONTINUE, /**< The read was OK and decoding can continue. */ @@ -322,7 +319,6 @@ extern FLAC_API const char * const FLAC__StreamDecoderReadStatusString[]; /** Return values for the FLAC__StreamDecoder seek callback. */ typedef enum { - FLAC__STREAM_DECODER_SEEK_STATUS_OK, /**< The seek was OK and decoding can continue. */ @@ -345,7 +341,6 @@ extern FLAC_API const char * const FLAC__StreamDecoderSeekStatusString[]; /** Return values for the FLAC__StreamDecoder tell callback. */ typedef enum { - FLAC__STREAM_DECODER_TELL_STATUS_OK, /**< The tell was OK and decoding can continue. */ @@ -368,7 +363,6 @@ extern FLAC_API const char * const FLAC__StreamDecoderTellStatusString[]; /** Return values for the FLAC__StreamDecoder length callback. */ typedef enum { - FLAC__STREAM_DECODER_LENGTH_STATUS_OK, /**< The length call was OK and decoding can continue. */ @@ -391,7 +385,6 @@ extern FLAC_API const char * const FLAC__StreamDecoderLengthStatusString[]; /** Return values for the FLAC__StreamDecoder write callback. */ typedef enum { - FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE, /**< The write was OK and decoding can continue. */ @@ -424,7 +417,6 @@ extern FLAC_API const char * const FLAC__StreamDecoderWriteStatusString[]; * a future encoder. */ typedef enum { - FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC, /**< An error in the stream caused the decoder to lose synchronization. */ diff --git a/src/lib/libflac/include/FLAC/stream_encoder.h b/src/lib/libflac/include/FLAC/stream_encoder.h index dbbbb23ee11..f533d8c8430 100644 --- a/src/lib/libflac/include/FLAC/stream_encoder.h +++ b/src/lib/libflac/include/FLAC/stream_encoder.h @@ -238,7 +238,6 @@ extern "C" { * must be deleted with FLAC__stream_encoder_delete(). */ typedef enum { - FLAC__STREAM_ENCODER_OK = 0, /**< The encoder is in the normal OK state and samples can be processed. */ @@ -290,7 +289,6 @@ extern FLAC_API const char * const FLAC__StreamEncoderStateString[]; /** Possible return values for the FLAC__stream_encoder_init_*() functions. */ typedef enum { - FLAC__STREAM_ENCODER_INIT_STATUS_OK = 0, /**< Initialization was successful. */ @@ -360,7 +358,6 @@ extern FLAC_API const char * const FLAC__StreamEncoderInitStatusString[]; /** Return values for the FLAC__StreamEncoder read callback. */ typedef enum { - FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE, /**< The read was OK and decoding can continue. */ @@ -386,7 +383,6 @@ extern FLAC_API const char * const FLAC__StreamEncoderReadStatusString[]; /** Return values for the FLAC__StreamEncoder write callback. */ typedef enum { - FLAC__STREAM_ENCODER_WRITE_STATUS_OK = 0, /**< The write was OK and encoding can continue. */ @@ -406,7 +402,6 @@ extern FLAC_API const char * const FLAC__StreamEncoderWriteStatusString[]; /** Return values for the FLAC__StreamEncoder seek callback. */ typedef enum { - FLAC__STREAM_ENCODER_SEEK_STATUS_OK, /**< The seek was OK and encoding can continue. */ @@ -429,7 +424,6 @@ extern FLAC_API const char * const FLAC__StreamEncoderSeekStatusString[]; /** Return values for the FLAC__StreamEncoder tell callback. */ typedef enum { - FLAC__STREAM_ENCODER_TELL_STATUS_OK, /**< The tell was OK and encoding can continue. */ diff --git a/src/lib/libflac/include/private/fixed.h b/src/lib/libflac/include/private/fixed.h index 6656b796bec..f2e0f4fb15a 100644 --- a/src/lib/libflac/include/private/fixed.h +++ b/src/lib/libflac/include/private/fixed.h @@ -40,16 +40,16 @@ #include "FLAC/format.h" /* - * FLAC__fixed_compute_best_predictor() - * -------------------------------------------------------------------- - * Compute the best fixed predictor and the expected bits-per-sample + * 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] + * 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]); @@ -67,30 +67,30 @@ unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsig #endif /* - * FLAC__fixed_compute_residual() - * -------------------------------------------------------------------- - * Compute the residual signal obtained from sutracting the predicted - * signal from the original. + * 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 + * 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. + * 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 + * 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[]); diff --git a/src/lib/libflac/include/private/float.h b/src/lib/libflac/include/private/float.h index 73313f6dbf8..6f7ae610f35 100644 --- a/src/lib/libflac/include/private/float.h +++ b/src/lib/libflac/include/private/float.h @@ -74,21 +74,21 @@ extern const FLAC__fixedpoint FLAC__FP_E; #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 + * 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). + * '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. + * '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. + * 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. + * The return value will also have 'fracbits' fractional bits. */ FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, unsigned fracbits, unsigned precision); diff --git a/src/lib/libflac/include/private/lpc.h b/src/lib/libflac/include/private/lpc.h index 2cb139b4bfd..35588bd718e 100644 --- a/src/lib/libflac/include/private/lpc.h +++ b/src/lib/libflac/include/private/lpc.h @@ -42,29 +42,29 @@ #ifndef FLAC__INTEGER_ONLY_LIBRARY /* - * FLAC__lpc_window_data() - * -------------------------------------------------------------------- - * Applies the given window to the data. + * 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 + * 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. + * 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] + * 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 @@ -80,44 +80,44 @@ void FLAC__lpc_compute_autocorrelation_asm_ia32_3dnow(const FLAC__real data[], u #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. + * 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) + * 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. + * 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). + * 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 + * 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. @@ -125,17 +125,17 @@ void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_o 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. + * 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 + * 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[]); @@ -151,19 +151,19 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx(const FLAC__i #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ /* - * FLAC__lpc_restore_signal() - * -------------------------------------------------------------------- - * Restore the original signal by summing the residual and the - * predictor. + * 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 + * 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[]); @@ -182,30 +182,30 @@ void FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8(const FLAC__int32 residu #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). + * 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 + * 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. + * 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 + * 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); diff --git a/src/lib/libflac/include/private/window.h b/src/lib/libflac/include/private/window.h index 01e0fc46c94..55a5bf29230 100644 --- a/src/lib/libflac/include/private/window.h +++ b/src/lib/libflac/include/private/window.h @@ -42,13 +42,13 @@ #ifndef FLAC__INTEGER_ONLY_LIBRARY /* - * FLAC__window_*() - * -------------------------------------------------------------------- - * Calculates window coefficients according to different apodization - * functions. + * FLAC__window_*() + * -------------------------------------------------------------------- + * Calculates window coefficients according to different apodization + * functions. * - * OUT window[0,L-1] - * IN L (number of points in window) + * 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); diff --git a/src/lib/libflac/libFLAC/bitreader.c b/src/lib/libflac/libFLAC/bitreader.c index e2a4ba3bd16..c6b8fe3b53f 100644 --- a/src/lib/libflac/libFLAC/bitreader.c +++ b/src/lib/libflac/libFLAC/bitreader.c @@ -301,13 +301,13 @@ FLAC__BitReader *FLAC__bitreader_new(void) FLAC__BitReader *br = (FLAC__BitReader*)calloc(1, sizeof(FLAC__BitReader)); /* calloc() implies: - memset(br, 0, sizeof(FLAC__BitReader)); - br->buffer = 0; - br->capacity = 0; - br->words = br->bytes = 0; - br->consumed_words = br->consumed_bits = 0; - br->read_callback = 0; - br->client_data = 0; + memset(br, 0, sizeof(FLAC__BitReader)); + br->buffer = 0; + br->capacity = 0; + br->words = br->bytes = 0; + br->consumed_words = br->consumed_bits = 0; + br->read_callback = 0; + br->client_data = 0; */ return br; } @@ -835,7 +835,6 @@ FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[ cwords = br->consumed_words; while(1) { - /* read unary part */ while(1) { while(cwords < br->words) { /* if we've not consumed up to a partial tail word... */ @@ -1018,7 +1017,6 @@ break2: ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits; while(1) { - /* read unary part */ while(1) { while(cwords < br->words) { /* if we've not consumed up to a partial tail word... */ diff --git a/src/lib/libflac/libFLAC/float.c b/src/lib/libflac/libFLAC/float.c index 60fa7e8371a..046fb1499a1 100644 --- a/src/lib/libflac/libFLAC/float.c +++ b/src/lib/libflac/libFLAC/float.c @@ -282,7 +282,7 @@ FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, unsigned fracbits, unsigned p if(x < ONE) return 0; - + if(precision > LOG2_LOOKUP_PRECISION) precision = LOG2_LOOKUP_PRECISION; diff --git a/src/lib/libflac/libFLAC/lpc.c b/src/lib/libflac/libFLAC/lpc.c index 00bbab44c1c..8e8332590a8 100644 --- a/src/lib/libflac/libFLAC/lpc.c +++ b/src/lib/libflac/libFLAC/lpc.c @@ -305,10 +305,10 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, u /* Here's a slower but clearer version: for(i = 0; i < data_len; i++) { - sum = 0; - for(j = 0; j < order; j++) - sum += qlp_coeff[j] * data[i-j-1]; - residual[i] = data[i] - (sum >> lp_quantization); + sum = 0; + for(j = 0; j < order; j++) + sum += qlp_coeff[j] * data[i-j-1]; + residual[i] = data[i] - (sum >> lp_quantization); } */ } @@ -516,18 +516,18 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, u case 15: sum += qlp_coeff[14] * data[i-15]; case 14: sum += qlp_coeff[13] * data[i-14]; case 13: sum += qlp_coeff[12] * data[i-13]; - sum += qlp_coeff[11] * data[i-12]; - sum += qlp_coeff[10] * data[i-11]; - sum += qlp_coeff[ 9] * data[i-10]; - sum += qlp_coeff[ 8] * data[i- 9]; - sum += qlp_coeff[ 7] * data[i- 8]; - sum += qlp_coeff[ 6] * data[i- 7]; - sum += qlp_coeff[ 5] * data[i- 6]; - sum += qlp_coeff[ 4] * data[i- 5]; - sum += qlp_coeff[ 3] * data[i- 4]; - sum += qlp_coeff[ 2] * data[i- 3]; - sum += qlp_coeff[ 1] * data[i- 2]; - sum += qlp_coeff[ 0] * data[i- 1]; + sum += qlp_coeff[11] * data[i-12]; + sum += qlp_coeff[10] * data[i-11]; + sum += qlp_coeff[ 9] * data[i-10]; + sum += qlp_coeff[ 8] * data[i- 9]; + sum += qlp_coeff[ 7] * data[i- 8]; + sum += qlp_coeff[ 6] * data[i- 7]; + sum += qlp_coeff[ 5] * data[i- 6]; + sum += qlp_coeff[ 4] * data[i- 5]; + sum += qlp_coeff[ 3] * data[i- 4]; + sum += qlp_coeff[ 2] * data[i- 3]; + sum += qlp_coeff[ 1] * data[i- 2]; + sum += qlp_coeff[ 0] * data[i- 1]; } residual[i] = data[i] - (sum >> lp_quantization); } @@ -778,18 +778,18 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da case 15: sum += qlp_coeff[14] * (FLAC__int64)data[i-15]; case 14: sum += qlp_coeff[13] * (FLAC__int64)data[i-14]; case 13: sum += qlp_coeff[12] * (FLAC__int64)data[i-13]; - sum += qlp_coeff[11] * (FLAC__int64)data[i-12]; - sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; - sum += qlp_coeff[ 9] * (FLAC__int64)data[i-10]; - sum += qlp_coeff[ 8] * (FLAC__int64)data[i- 9]; - sum += qlp_coeff[ 7] * (FLAC__int64)data[i- 8]; - sum += qlp_coeff[ 6] * (FLAC__int64)data[i- 7]; - sum += qlp_coeff[ 5] * (FLAC__int64)data[i- 6]; - sum += qlp_coeff[ 4] * (FLAC__int64)data[i- 5]; - sum += qlp_coeff[ 3] * (FLAC__int64)data[i- 4]; - sum += qlp_coeff[ 2] * (FLAC__int64)data[i- 3]; - sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2]; - sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1]; + sum += qlp_coeff[11] * (FLAC__int64)data[i-12]; + sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; + sum += qlp_coeff[ 9] * (FLAC__int64)data[i-10]; + sum += qlp_coeff[ 8] * (FLAC__int64)data[i- 9]; + sum += qlp_coeff[ 7] * (FLAC__int64)data[i- 8]; + sum += qlp_coeff[ 6] * (FLAC__int64)data[i- 7]; + sum += qlp_coeff[ 5] * (FLAC__int64)data[i- 6]; + sum += qlp_coeff[ 4] * (FLAC__int64)data[i- 5]; + sum += qlp_coeff[ 3] * (FLAC__int64)data[i- 4]; + sum += qlp_coeff[ 2] * (FLAC__int64)data[i- 3]; + sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2]; + sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1]; } residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); } @@ -835,10 +835,10 @@ void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, c /* Here's a slower but clearer version: for(i = 0; i < data_len; i++) { - sum = 0; - for(j = 0; j < order; j++) - sum += qlp_coeff[j] * data[i-j-1]; - data[i] = residual[i] + (sum >> lp_quantization); + sum = 0; + for(j = 0; j < order; j++) + sum += qlp_coeff[j] * data[i-j-1]; + data[i] = residual[i] + (sum >> lp_quantization); } */ } @@ -1046,18 +1046,18 @@ void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, c case 15: sum += qlp_coeff[14] * data[i-15]; case 14: sum += qlp_coeff[13] * data[i-14]; case 13: sum += qlp_coeff[12] * data[i-13]; - sum += qlp_coeff[11] * data[i-12]; - sum += qlp_coeff[10] * data[i-11]; - sum += qlp_coeff[ 9] * data[i-10]; - sum += qlp_coeff[ 8] * data[i- 9]; - sum += qlp_coeff[ 7] * data[i- 8]; - sum += qlp_coeff[ 6] * data[i- 7]; - sum += qlp_coeff[ 5] * data[i- 6]; - sum += qlp_coeff[ 4] * data[i- 5]; - sum += qlp_coeff[ 3] * data[i- 4]; - sum += qlp_coeff[ 2] * data[i- 3]; - sum += qlp_coeff[ 1] * data[i- 2]; - sum += qlp_coeff[ 0] * data[i- 1]; + sum += qlp_coeff[11] * data[i-12]; + sum += qlp_coeff[10] * data[i-11]; + sum += qlp_coeff[ 9] * data[i-10]; + sum += qlp_coeff[ 8] * data[i- 9]; + sum += qlp_coeff[ 7] * data[i- 8]; + sum += qlp_coeff[ 6] * data[i- 7]; + sum += qlp_coeff[ 5] * data[i- 6]; + sum += qlp_coeff[ 4] * data[i- 5]; + sum += qlp_coeff[ 3] * data[i- 4]; + sum += qlp_coeff[ 2] * data[i- 3]; + sum += qlp_coeff[ 1] * data[i- 2]; + sum += qlp_coeff[ 0] * data[i- 1]; } data[i] = residual[i] + (sum >> lp_quantization); } @@ -1308,18 +1308,18 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l case 15: sum += qlp_coeff[14] * (FLAC__int64)data[i-15]; case 14: sum += qlp_coeff[13] * (FLAC__int64)data[i-14]; case 13: sum += qlp_coeff[12] * (FLAC__int64)data[i-13]; - sum += qlp_coeff[11] * (FLAC__int64)data[i-12]; - sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; - sum += qlp_coeff[ 9] * (FLAC__int64)data[i-10]; - sum += qlp_coeff[ 8] * (FLAC__int64)data[i- 9]; - sum += qlp_coeff[ 7] * (FLAC__int64)data[i- 8]; - sum += qlp_coeff[ 6] * (FLAC__int64)data[i- 7]; - sum += qlp_coeff[ 5] * (FLAC__int64)data[i- 6]; - sum += qlp_coeff[ 4] * (FLAC__int64)data[i- 5]; - sum += qlp_coeff[ 3] * (FLAC__int64)data[i- 4]; - sum += qlp_coeff[ 2] * (FLAC__int64)data[i- 3]; - sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2]; - sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1]; + sum += qlp_coeff[11] * (FLAC__int64)data[i-12]; + sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; + sum += qlp_coeff[ 9] * (FLAC__int64)data[i-10]; + sum += qlp_coeff[ 8] * (FLAC__int64)data[i- 9]; + sum += qlp_coeff[ 7] * (FLAC__int64)data[i- 8]; + sum += qlp_coeff[ 6] * (FLAC__int64)data[i- 7]; + sum += qlp_coeff[ 5] * (FLAC__int64)data[i- 6]; + sum += qlp_coeff[ 4] * (FLAC__int64)data[i- 5]; + sum += qlp_coeff[ 3] * (FLAC__int64)data[i- 4]; + sum += qlp_coeff[ 2] * (FLAC__int64)data[i- 3]; + sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2]; + sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1]; } data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); } diff --git a/src/lib/libflac/libFLAC/md5.c b/src/lib/libflac/libFLAC/md5.c index 3cfebd23675..8e9b39fe127 100644 --- a/src/lib/libflac/libFLAC/md5.c +++ b/src/lib/libflac/libFLAC/md5.c @@ -2,8 +2,8 @@ # include <config.h> #endif -#include <stdlib.h> /* for malloc() */ -#include <string.h> /* for memcpy() */ +#include <stdlib.h> /* for malloc() */ +#include <string.h> /* for memcpy() */ #include "private/md5.h" #include "share/alloc.h" @@ -47,7 +47,7 @@ /* 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) + (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 @@ -143,7 +143,7 @@ static void byteSwap(FLAC__uint32 *buf, unsigned words) { register FLAC__uint32 x; do { - x = *buf; + x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); } while (--words); @@ -186,9 +186,9 @@ static void FLAC__MD5Update(FLAC__MD5Context *ctx, FLAC__byte const *buf, unsign t = ctx->bytes[0]; if ((ctx->bytes[0] = t + len) < t) - ctx->bytes[1]++; /* Carry from low to high */ + ctx->bytes[1]++; /* Carry from low to high */ - t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */ + 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; @@ -237,7 +237,7 @@ void FLAC__MD5Init(FLAC__MD5Context *ctx) */ void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *ctx) { - int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */ + 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. */ @@ -246,7 +246,7 @@ void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *ctx) /* Bytes of padding needed to make 56 bytes (-8..55) */ count = 56 - 1 - count; - if (count < 0) { /* Padding forces an extra block */ + if (count < 0) { /* Padding forces an extra block */ memset(p, 0, count + 8); byteSwapX16(ctx->in); FLAC__MD5Transform(ctx->buf, ctx->in); diff --git a/src/lib/libflac/libFLAC/metadata_iterators.c b/src/lib/libflac/libFLAC/metadata_iterators.c index f88795bcf82..f24edc27631 100644 --- a/src/lib/libflac/libFLAC/metadata_iterators.c +++ b/src/lib/libflac/libFLAC/metadata_iterators.c @@ -1835,8 +1835,8 @@ FLAC_API FLAC__Metadata_Iterator *FLAC__metadata_iterator_new(void) FLAC__Metadata_Iterator *iterator = (FLAC__Metadata_Iterator*)calloc(1, sizeof(FLAC__Metadata_Iterator)); /* calloc() implies: - iterator->current = 0; - iterator->chain = 0; + iterator->current = 0; + iterator->chain = 0; */ return iterator; diff --git a/src/lib/libflac/libFLAC/metadata_object.c b/src/lib/libflac/libFLAC/metadata_object.c index 6f8bccf4563..dc366476e14 100644 --- a/src/lib/libflac/libFLAC/metadata_object.c +++ b/src/lib/libflac/libFLAC/metadata_object.c @@ -1330,7 +1330,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_from_name_value_pa memcpy(entry->entry+nn+1, field_value, nv); entry->entry[entry->length] = '\0'; } - + return true; } diff --git a/src/lib/libflac/libFLAC/stream_decoder.c b/src/lib/libflac/libFLAC/stream_decoder.c index 198d5dcc883..29e1b4dc441 100644 --- a/src/lib/libflac/libFLAC/stream_decoder.c +++ b/src/lib/libflac/libFLAC/stream_decoder.c @@ -1290,7 +1290,7 @@ FILE *get_binary_stdin_(void) */ #if defined _MSC_VER || defined __MINGW32__ _setmode(_fileno(stdin), _O_BINARY); -#elif defined __CYGWIN__ +#elif defined __CYGWIN__ /* almost certainly not needed for any modern Cygwin, but let's be safe... */ setmode(_fileno(stdin), _O_BINARY); #elif defined __EMX__ @@ -3152,11 +3152,11 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s } /* our last move backwards wasn't big enough, try again */ approx_bytes_per_frame = approx_bytes_per_frame? approx_bytes_per_frame * 2 : 16; - continue; + continue; } /* allow one seek over upper bound, so we can get a correct upper_bound_sample for streams with unknown total_samples */ first_seek = false; - + /* make sure we are not seeking in corrupted stream */ if (this_frame_sample < lower_bound_sample) { decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; @@ -3196,7 +3196,7 @@ FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint FLAC__bool did_a_seek; unsigned iteration = 0; - /* In the first iterations, we will calculate the target byte position + /* In the first iterations, we will calculate the target byte position * by the distance from the target sample to left_sample and * right_sample (let's call it "proportional search"). After that, we * will switch to binary search. diff --git a/src/lib/libflac/libFLAC/stream_encoder.c b/src/lib/libflac/libFLAC/stream_encoder.c index afc79850096..8f139eb83e3 100644 --- a/src/lib/libflac/libFLAC/stream_encoder.c +++ b/src/lib/libflac/libFLAC/stream_encoder.c @@ -98,7 +98,7 @@ * parameter estimation in this encoder is very good, almost always * yielding compression within 0.1% of the optimal parameters. */ -#undef ENABLE_RICE_PARAMETER_SEARCH +#undef ENABLE_RICE_PARAMETER_SEARCH typedef struct { @@ -234,7 +234,7 @@ static unsigned evaluate_lpc_subframe_( #endif static unsigned evaluate_verbatim_subframe_( - FLAC__StreamEncoder *encoder, + FLAC__StreamEncoder *encoder, const FLAC__int32 signal[], unsigned blocksize, unsigned subframe_bps, @@ -835,7 +835,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( metadata_picture_has_type1 = true; /* standard icon must be 32x32 pixel PNG */ if( - m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD && + m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD && ( (strcmp(m->data.picture.mime_type, "image/png") && strcmp(m->data.picture.mime_type, "-->")) || m->data.picture.width != 32 || @@ -1182,7 +1182,7 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_stream( /*is_ogg=*/true ); } - + static FLAC__StreamEncoderInitStatus init_FILE_internal_( FLAC__StreamEncoder *encoder, FILE *file, @@ -1244,7 +1244,7 @@ static FLAC__StreamEncoderInitStatus init_FILE_internal_( return init_status; } - + FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_FILE( FLAC__StreamEncoder *encoder, FILE *file, @@ -1254,7 +1254,7 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_FILE( { return init_FILE_internal_(encoder, file, progress_callback, client_data, /*is_ogg=*/false); } - + FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_FILE( FLAC__StreamEncoder *encoder, FILE *file, @@ -4134,7 +4134,7 @@ unsigned get_wasted_bits_(FLAC__int32 signal[], unsigned samples) if(shift > 0) { for(i = 0; i < samples; i++) - signal[i] >>= shift; + signal[i] >>= shift; } return shift; diff --git a/src/lib/util/chd.h b/src/lib/util/chd.h index 872c63d46f8..cc0f493cc0b 100644 --- a/src/lib/util/chd.h +++ b/src/lib/util/chd.h @@ -526,7 +526,7 @@ private: , m_compression(0) , m_codecs(NULL) { } - + osd_work_item * m_osd; // OSD work item running on this block chd_file_compressor *m_compressor; // pointer back to the compressor volatile work_status m_status; // current status of this item diff --git a/src/lib/util/corealloc.c b/src/lib/util/corealloc.c index 69535d8d495..c8a23b73f27 100644 --- a/src/lib/util/corealloc.c +++ b/src/lib/util/corealloc.c @@ -46,7 +46,7 @@ public: const char * m_file; // file the allocation was made from int m_line; // line number within that file UINT64 m_id; // unique id - bool m_array; // array? + bool m_array; // array? // hashing prime number static const int k_hash_prime = 6151; @@ -115,7 +115,7 @@ void *malloc_file_line(size_t size, const char *file, int line, bool array, bool if (clear) memset(result, 0, size); else - { + { #if !__has_feature(memory_sanitizer) && defined(INITIALIZE_ALLOCATED_MEMORY) memset(result, 0xdd, size); #endif @@ -145,7 +145,7 @@ void free_file_line(void *memory, const char *file, int line, bool array) osd_break_into_debugger("Error: attempt to free untracked memory"); return; } - + // warn about mismatched arrays if (!array && entry->m_array) { @@ -182,8 +182,8 @@ void track_memory(bool track) //------------------------------------------------- -// next_memory_id - return the ID of the next -// allocated block +// next_memory_id - return the ID of the next +// allocated block //------------------------------------------------- UINT64 next_memory_id() diff --git a/src/lib/util/cstrpool.c b/src/lib/util/cstrpool.c index 17b43b325a6..874e5192ea0 100644 --- a/src/lib/util/cstrpool.c +++ b/src/lib/util/cstrpool.c @@ -39,7 +39,7 @@ const char *const_string_pool::add(const char *string) if (result != NULL) return result; } - + // no space anywhere, create a new pool and prepend it (so it gets used first) const char *result = m_chunklist.prepend(*global_alloc(pool_chunk)).add(string); assert(result != NULL); @@ -48,7 +48,7 @@ const char *const_string_pool::add(const char *string) //------------------------------------------------- -// contains - determine if the given string +// contains - determine if the given string // pointer lives in the pool //------------------------------------------------- @@ -62,7 +62,7 @@ bool const_string_pool::contains(const char *string) for (pool_chunk *chunk = m_chunklist.first(); chunk != NULL; chunk = chunk->next()) if (chunk->contains(string)) return true; - + return false; } @@ -72,8 +72,8 @@ bool const_string_pool::contains(const char *string) //------------------------------------------------- const_string_pool::pool_chunk::pool_chunk() - : m_next(NULL), - m_used(0) + : m_next(NULL), + m_used(0) { } @@ -87,7 +87,7 @@ const char *const_string_pool::pool_chunk::add(const char *string) // get the length of the string (no string can be longer than a full pool) int bytes = strlen(string) + 1; assert(bytes < POOL_SIZE); - + // if too big, return NULL if (m_used + bytes > POOL_SIZE) return NULL; diff --git a/src/lib/util/cstrpool.h b/src/lib/util/cstrpool.h index c4b4805362d..6058cc43ffb 100644 --- a/src/lib/util/cstrpool.h +++ b/src/lib/util/cstrpool.h @@ -26,23 +26,23 @@ class const_string_pool public: // construction const_string_pool(); - + // operations void reset() { m_chunklist.reset(); } const char *add(const char *string); bool contains(const char *string); - + private: // shared string pool class pool_chunk { static const int POOL_SIZE = 4096; friend class simple_list<pool_chunk>; - + public: // construction pool_chunk(); - + // getters pool_chunk *next() const { return m_next; } @@ -52,11 +52,11 @@ private: private: // internal state - pool_chunk * m_next; - UINT32 m_used; - char m_buffer[POOL_SIZE]; + pool_chunk * m_next; + UINT32 m_used; + char m_buffer[POOL_SIZE]; }; - simple_list<pool_chunk> m_chunklist; + simple_list<pool_chunk> m_chunklist; }; diff --git a/src/lib/util/options.h b/src/lib/util/options.h index f90e56a0a23..573822b73b6 100644 --- a/src/lib/util/options.h +++ b/src/lib/util/options.h @@ -175,7 +175,7 @@ private: bool validate_and_set_data(entry &curentry, const char *newdata, int priority, astring &error_string); // internal state - simple_list<entry> m_entrylist; // head of list of entries + simple_list<entry> m_entrylist; // head of list of entries tagmap_t<entry *> m_entrymap; // map for fast lookup astring m_command; // command found static const char *const s_option_unadorned[]; // array of unadorned option "names" diff --git a/src/lib/util/palette.c b/src/lib/util/palette.c index a516b3e4a32..6b3847f61da 100644 --- a/src/lib/util/palette.c +++ b/src/lib/util/palette.c @@ -47,14 +47,14 @@ inline rgb_t palette_t::adjust_palette_entry(rgb_t entry, float brightness, floa palette_client::dirty_state::dirty_state() : m_mindirty(0), - m_maxdirty(0) + m_maxdirty(0) { } //------------------------------------------------- // dirty_list - return the current list and -// min/max values +// min/max values //------------------------------------------------- const UINT32 *palette_client::dirty_state::dirty_list(UINT32 &mindirty, UINT32 &maxdirty) @@ -70,7 +70,7 @@ const UINT32 *palette_client::dirty_state::dirty_list(UINT32 &mindirty, UINT32 & //------------------------------------------------- // resize - resize the dirty array and mark all -// dirty +// dirty //------------------------------------------------- void palette_client::dirty_state::resize(UINT32 colors) @@ -82,7 +82,7 @@ void palette_client::dirty_state::resize(UINT32 colors) // mark all entries dirty m_dirty[dirty_dwords - 1] &= (1 << (colors % 32)) - 1; - // set min/max + // set min/max m_mindirty = 0; m_maxdirty = colors - 1; } @@ -102,7 +102,7 @@ void palette_client::dirty_state::mark_dirty(UINT32 index) //------------------------------------------------- // reset - clear the dirty array to mark all -// entries as clean +// entries as clean //------------------------------------------------- void palette_client::dirty_state::reset() @@ -125,9 +125,9 @@ void palette_client::dirty_state::reset() palette_client::palette_client(palette_t &palette) : m_palette(palette), - m_next(NULL), - m_live(&m_dirty[0]), - m_previous(&m_dirty[1]) + m_next(NULL), + m_live(&m_dirty[0]), + m_previous(&m_dirty[1]) { // add a reference to the palette palette.ref(); @@ -163,7 +163,7 @@ palette_client::~palette_client() //------------------------------------------------- -// dirty_list - atomically get the current dirty +// dirty_list - atomically get the current dirty // list for a client //------------------------------------------------- @@ -206,18 +206,18 @@ palette_t *palette_t::alloc(UINT32 numcolors, UINT32 numgroups) palette_t::palette_t(UINT32 numcolors, UINT32 numgroups) : m_refcount(1), - m_numcolors(numcolors), - m_numgroups(numgroups), - m_brightness(0.0f), - m_contrast(1.0f), - m_gamma(1.0f), - m_entry_color(numcolors), - m_entry_contrast(numcolors), - m_adjusted_color(numcolors * numgroups + 2), - m_adjusted_rgb15(numcolors * numgroups + 2), - m_group_bright(numgroups), - m_group_contrast(numgroups), - m_client_list(NULL) + m_numcolors(numcolors), + m_numgroups(numgroups), + m_brightness(0.0f), + m_contrast(1.0f), + m_gamma(1.0f), + m_entry_color(numcolors), + m_entry_contrast(numcolors), + m_adjusted_color(numcolors * numgroups + 2), + m_adjusted_rgb15(numcolors * numgroups + 2), + m_group_bright(numgroups), + m_group_contrast(numgroups), + m_client_list(NULL) { // initialize gamma map for (UINT32 index = 0; index < 256; index++) @@ -273,7 +273,7 @@ void palette_t::deref() //------------------------------------------------- -// set_brightness - set the overall brightness +// set_brightness - set the overall brightness // for the palette //------------------------------------------------- @@ -295,7 +295,7 @@ void palette_t::set_brightness(float brightness) //------------------------------------------------- -// set_contrast - set the overall contrast for +// set_contrast - set the overall contrast for // the palette //------------------------------------------------- @@ -314,7 +314,7 @@ void palette_t::set_contrast(float contrast) //------------------------------------------------- -// set_gamma - set the overall gamma for the +// set_gamma - set the overall gamma for the // palette //------------------------------------------------- @@ -342,7 +342,7 @@ void palette_t::set_gamma(float gamma) //------------------------------------------------- -// entry_set_color - set the raw RGB color for a +// entry_set_color - set the raw RGB color for a // given palette index //------------------------------------------------- @@ -362,7 +362,7 @@ void palette_t::entry_set_color(UINT32 index, rgb_t rgb) //------------------------------------------------- -// entry_set_contrast - set the contrast +// entry_set_contrast - set the contrast // adjustment for a single palette index //------------------------------------------------- @@ -382,7 +382,7 @@ void palette_t::entry_set_contrast(UINT32 index, float contrast) //------------------------------------------------- -// group_set_brightness - configure overall +// group_set_brightness - configure overall // brightness for a palette group //------------------------------------------------- @@ -405,7 +405,7 @@ void palette_t::group_set_brightness(UINT32 group, float brightness) //------------------------------------------------- -// group_set_contrast - configure overall +// group_set_contrast - configure overall // contrast for a palette group //------------------------------------------------- @@ -425,7 +425,7 @@ void palette_t::group_set_contrast(UINT32 group, float contrast) //------------------------------------------------- -// normalize_range - normalize a range of palette +// normalize_range - normalize a range of palette // entries //------------------------------------------------- @@ -474,9 +474,9 @@ void palette_t::update_adjusted_color(UINT32 group, UINT32 index) { // compute the adjusted value rgb_t adjusted = adjust_palette_entry(m_entry_color[index], - m_group_bright[group] + m_brightness, - m_group_contrast[group] * m_entry_contrast[index] * m_contrast, - m_gamma_map); + m_group_bright[group] + m_brightness, + m_group_contrast[group] * m_entry_contrast[index] * m_contrast, + m_gamma_map); // if not different, ignore UINT32 finalindex = group * m_numcolors + index; diff --git a/src/lib/util/palette.h b/src/lib/util/palette.h index 120da95f87a..30d5ba528e0 100644 --- a/src/lib/util/palette.h +++ b/src/lib/util/palette.h @@ -39,7 +39,7 @@ public: rgb_t(UINT32 data) { m_data = data; } rgb_t(UINT8 r, UINT8 g, UINT8 b) { m_data = (255 << 24) | (r << 16) | (g << 8) | b; } rgb_t(UINT8 a, UINT8 r, UINT8 g, UINT8 b) { m_data = (a << 24) | (r << 16) | (g << 8) | b; } - + // getters UINT8 a() const { return m_data >> 24; } UINT8 r() const { return m_data >> 16; } @@ -53,7 +53,7 @@ public: rgb_t &set_r(UINT8 r) { m_data &= ~0x00ff0000; m_data |= r << 16; return *this; } rgb_t &set_g(UINT8 g) { m_data &= ~0x0000ff00; m_data |= g << 8; return *this; } rgb_t &set_b(UINT8 b) { m_data &= ~0x000000ff; m_data |= b << 0; return *this; } - + // implicit conversion operators operator UINT32() const { return m_data; } @@ -64,11 +64,11 @@ public: rgb_t &operator=(UINT32 rhs) { m_data = rhs; return *this; } rgb_t &operator+=(const rgb_t &rhs) { m_data = rgb_t(clamphi(a() + rhs.a()), clamphi(r() + rhs.r()), clamphi(g() + rhs.g()), clamphi(b() + rhs.b())); return *this; } rgb_t &operator-=(const rgb_t &rhs) { m_data = rgb_t(clamplo(a() - rhs.a()), clamplo(r() - rhs.r()), clamplo(g() - rhs.g()), clamplo(b() - rhs.b())); return *this; } - + // arithmetic operators const rgb_t operator+(const rgb_t &rhs) const { rgb_t result = *this; result += rhs; return result; } const rgb_t operator-(const rgb_t &rhs) const { rgb_t result = *this; result -= rhs; return result; } - + // static helpers static UINT8 clamp(INT32 value) { return (value < 0) ? 0 : (value > 255) ? 255 : value; } static UINT8 clamphi(INT32 value) { return (value > 255) ? 255 : value; } @@ -79,7 +79,7 @@ public: static const rgb_t white; private: - UINT32 m_data; + UINT32 m_data; }; @@ -108,7 +108,7 @@ private: public: // construction dirty_state(); - + // operations const UINT32 *dirty_list(UINT32 &mindirty, UINT32 &maxdirty); void resize(UINT32 colors); @@ -127,7 +127,7 @@ private: palette_client *m_next; // pointer to next client dirty_state * m_live; // live dirty state dirty_state * m_previous; // previous dirty state - dirty_state m_dirty[2]; // two dirty states + dirty_state m_dirty[2]; // two dirty states }; @@ -141,7 +141,7 @@ class palette_t public: // static constructor: used to ensure same new/delete is used static palette_t *alloc(UINT32 numcolors, UINT32 numgroups = 1); - + // reference counting void ref() { m_refcount++; } void deref(); @@ -152,12 +152,12 @@ public: int max_index() const { return m_numcolors * m_numgroups + 2; } UINT32 black_entry() const { return m_numcolors * m_numgroups + 0; } UINT32 white_entry() const { return m_numcolors * m_numgroups + 1; } - + // overall adjustments void set_brightness(float brightness); void set_contrast(float contrast); void set_gamma(float gamma); - + // entry getters rgb_t entry_color(UINT32 index) const { return (index < m_numcolors) ? m_entry_color[index] : rgb_t::black; } rgb_t entry_adjusted_color(UINT32 index) const { return (index < m_numcolors * m_numgroups) ? m_adjusted_color[index] : rgb_t::black; } @@ -166,19 +166,19 @@ public: // entry setters void entry_set_color(UINT32 index, rgb_t rgb); void entry_set_contrast(UINT32 index, float contrast); - + // entry list getters const rgb_t *entry_list_raw() const { return m_entry_color; } const rgb_t *entry_list_adjusted() const { return m_adjusted_color; } const rgb_t *entry_list_adjusted_rgb15() const { return m_adjusted_rgb15; } - + // group adjustments void group_set_brightness(UINT32 group, float brightness); void group_set_contrast(UINT32 group, float contrast); - + // utilities void normalize_range(UINT32 start, UINT32 end, int lum_min = 0, int lum_max = 255); - + private: // construction/destruction palette_t(UINT32 numcolors, UINT32 numgroups = 1); diff --git a/src/lib/util/tagmap.c b/src/lib/util/tagmap.c index 5a447a49487..80218317993 100644 --- a/src/lib/util/tagmap.c +++ b/src/lib/util/tagmap.c @@ -12,4 +12,4 @@ #ifdef MAME_DEBUG INT32 g_tagmap_finds = 0; -#endif
\ No newline at end of file +#endif diff --git a/src/lib/util/tagmap.h b/src/lib/util/tagmap.h index d35922a49b0..e31b6671108 100644 --- a/src/lib/util/tagmap.h +++ b/src/lib/util/tagmap.h @@ -203,7 +203,7 @@ class tagged_list tagged_list &operator=(const tagged_list &); public: - class add_exception + class add_exception { public: add_exception(const char *tag) : m_tag(tag) { } @@ -211,7 +211,7 @@ public: private: const char *m_tag; }; - + // construction tagged_list() { } |
