mirror of
https://github.com/libretro/RetroArch
synced 2025-02-03 17:54:04 +00:00
(libchdr) Can't have C++ comments
(config.params.sh) Have to disable FLAC for now; still doesn't compile for Windows due to fseeko/ftello errors
This commit is contained in:
parent
1d3a2d7002
commit
f67641c52c
@ -108,9 +108,10 @@ uint32_t bitstream_read_offset(struct bitstream* bitstream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
/*-------------------------------------------------
|
||||||
// flush - flush to the nearest byte
|
* flush - flush to the nearest byte
|
||||||
//-------------------------------------------------
|
*-------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
uint32_t bitstream_flush(struct bitstream* bitstream)
|
uint32_t bitstream_flush(struct bitstream* bitstream)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// license:BSD-3-Clause
|
/* license:BSD-3-Clause
|
||||||
// copyright-holders:Aaron Giles
|
*
|
||||||
|
* copyright-holders:Aaron Giles
|
||||||
|
*/
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
cdrom.c
|
cdrom.c
|
||||||
@ -302,15 +304,16 @@ static const uint16_t qoffsets[ECC_Q_NUM_BYTES][ECC_Q_COMP] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
/*-------------------------------------------------
|
||||||
// ecc_source_byte - return data from the sector
|
* ecc_source_byte - return data from the sector
|
||||||
// at the given offset, masking anything
|
* at the given offset, masking anything
|
||||||
// particular to a mode
|
* particular to a mode
|
||||||
//-------------------------------------------------
|
*-------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
static inline uint8_t ecc_source_byte(const uint8_t *sector, uint32_t offset)
|
static INLINE uint8_t ecc_source_byte(const uint8_t *sector, uint32_t offset)
|
||||||
{
|
{
|
||||||
// in mode 2 always treat these as 0 bytes
|
/* in mode 2 always treat these as 0 bytes */
|
||||||
return (sector[MODE_OFFSET] == 2 && offset < 4) ? 0x00 : sector[SYNC_OFFSET + SYNC_NUM_BYTES + offset];
|
return (sector[MODE_OFFSET] == 2 && offset < 4) ? 0x00 : sector[SYNC_OFFSET + SYNC_NUM_BYTES + offset];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,8 +333,9 @@ static inline uint8_t ecc_source_byte(const uint8_t *sector, uint32_t offset)
|
|||||||
|
|
||||||
void ecc_compute_bytes(const uint8_t *sector, const uint16_t *row, int rowlen, uint8_t *val1, uint8_t *val2)
|
void ecc_compute_bytes(const uint8_t *sector, const uint16_t *row, int rowlen, uint8_t *val1, uint8_t *val2)
|
||||||
{
|
{
|
||||||
|
int component;
|
||||||
*val1 = *val2 = 0;
|
*val1 = *val2 = 0;
|
||||||
for (int component = 0; component < rowlen; component++)
|
for (component = 0; component < rowlen; component++)
|
||||||
{
|
{
|
||||||
*val1 ^= ecc_source_byte(sector, row[component]);
|
*val1 ^= ecc_source_byte(sector, row[component]);
|
||||||
*val2 ^= ecc_source_byte(sector, row[component]);
|
*val2 ^= ecc_source_byte(sector, row[component]);
|
||||||
@ -355,8 +359,9 @@ void ecc_compute_bytes(const uint8_t *sector, const uint16_t *row, int rowlen, u
|
|||||||
|
|
||||||
int ecc_verify(const uint8_t *sector)
|
int ecc_verify(const uint8_t *sector)
|
||||||
{
|
{
|
||||||
// first verify P bytes
|
int byte;
|
||||||
for (int byte = 0; byte < ECC_P_NUM_BYTES; byte++)
|
/* first verify P bytes */
|
||||||
|
for (byte = 0; byte < ECC_P_NUM_BYTES; byte++)
|
||||||
{
|
{
|
||||||
uint8_t val1, val2;
|
uint8_t val1, val2;
|
||||||
ecc_compute_bytes(sector, poffsets[byte], ECC_P_COMP, &val1, &val2);
|
ecc_compute_bytes(sector, poffsets[byte], ECC_P_COMP, &val1, &val2);
|
||||||
@ -364,8 +369,8 @@ int ecc_verify(const uint8_t *sector)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// then verify Q bytes
|
/* then verify Q bytes */
|
||||||
for (int byte = 0; byte < ECC_Q_NUM_BYTES; byte++)
|
for (byte = 0; byte < ECC_Q_NUM_BYTES; byte++)
|
||||||
{
|
{
|
||||||
uint8_t val1, val2;
|
uint8_t val1, val2;
|
||||||
ecc_compute_bytes(sector, qoffsets[byte], ECC_Q_COMP, &val1, &val2);
|
ecc_compute_bytes(sector, qoffsets[byte], ECC_Q_COMP, &val1, &val2);
|
||||||
@ -388,12 +393,13 @@ int ecc_verify(const uint8_t *sector)
|
|||||||
|
|
||||||
void ecc_generate(uint8_t *sector)
|
void ecc_generate(uint8_t *sector)
|
||||||
{
|
{
|
||||||
// first verify P bytes
|
int byte;
|
||||||
for (int byte = 0; byte < ECC_P_NUM_BYTES; byte++)
|
/* first verify P bytes */
|
||||||
|
for (byte = 0; byte < ECC_P_NUM_BYTES; byte++)
|
||||||
ecc_compute_bytes(sector, poffsets[byte], ECC_P_COMP, §or[ECC_P_OFFSET + byte], §or[ECC_P_OFFSET + ECC_P_NUM_BYTES + byte]);
|
ecc_compute_bytes(sector, poffsets[byte], ECC_P_COMP, §or[ECC_P_OFFSET + byte], §or[ECC_P_OFFSET + ECC_P_NUM_BYTES + byte]);
|
||||||
|
|
||||||
// then verify Q bytes
|
/* then verify Q bytes */
|
||||||
for (int byte = 0; byte < ECC_Q_NUM_BYTES; byte++)
|
for (byte = 0; byte < ECC_Q_NUM_BYTES; byte++)
|
||||||
ecc_compute_bytes(sector, qoffsets[byte], ECC_Q_COMP, §or[ECC_Q_OFFSET + byte], §or[ECC_Q_OFFSET + ECC_Q_NUM_BYTES + byte]);
|
ecc_compute_bytes(sector, qoffsets[byte], ECC_Q_COMP, §or[ECC_Q_OFFSET + byte], §or[ECC_Q_OFFSET + ECC_Q_NUM_BYTES + byte]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,8 +53,8 @@ enum
|
|||||||
CD_SUB_NONE /* no subcode data stored */
|
CD_SUB_NONE /* no subcode data stored */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CD_FLAG_GDROM 0x00000001 // disc is a GD-ROM, all tracks should be stored with GD-ROM metadata
|
#define CD_FLAG_GDROM 0x00000001 /* disc is a GD-ROM, all tracks should be stored with GD-ROM metadata */
|
||||||
#define CD_FLAG_GDROMLE 0x00000002 // legacy GD-ROM, with little-endian CDDA data
|
#define CD_FLAG_GDROMLE 0x00000002 /* legacy GD-ROM, with little-endian CDDA data */
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
FUNCTION PROTOTYPES
|
FUNCTION PROTOTYPES
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// license:BSD-3-Clause
|
/* license:BSD-3-Clause
|
||||||
// copyright-holders:Aaron Giles
|
* copyright-holders:Aaron Giles
|
||||||
|
*/
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
flac.c
|
flac.c
|
||||||
@ -12,9 +13,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "flac.h"
|
#include "flac.h"
|
||||||
|
|
||||||
//**************************************************************************
|
/***************************************************************************
|
||||||
// FLAC DECODER
|
* FLAC DECODER
|
||||||
//**************************************************************************
|
***************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
static FLAC__StreamDecoderReadStatus flac_decoder_read_callback_static(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
|
static FLAC__StreamDecoderReadStatus flac_decoder_read_callback_static(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
|
||||||
FLAC__StreamDecoderReadStatus flac_decoder_read_callback(void* client_data, FLAC__byte buffer[], size_t *bytes);
|
FLAC__StreamDecoderReadStatus flac_decoder_read_callback(void* client_data, FLAC__byte buffer[], size_t *bytes);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// license:BSD-3-Clause
|
/* license:BSD-3-Clause
|
||||||
// copyright-holders:Aaron Giles
|
* copyright-holders:Aaron Giles
|
||||||
/***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
flac.h
|
flac.h
|
||||||
|
|
||||||
@ -17,30 +17,31 @@
|
|||||||
#include "FLAC/ordinals.h"
|
#include "FLAC/ordinals.h"
|
||||||
#include "FLAC/stream_decoder.h"
|
#include "FLAC/stream_decoder.h"
|
||||||
|
|
||||||
//**************************************************************************
|
/***************************************************************************
|
||||||
// TYPE DEFINITIONS
|
* TYPE DEFINITIONS
|
||||||
//**************************************************************************
|
***************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
typedef struct _flac_decoder flac_decoder;
|
typedef struct _flac_decoder flac_decoder;
|
||||||
struct _flac_decoder {
|
struct _flac_decoder {
|
||||||
// output state
|
/* output state */
|
||||||
FLAC__StreamDecoder* decoder; // actual encoder
|
FLAC__StreamDecoder* decoder; /* actual encoder */
|
||||||
uint32_t sample_rate; // decoded sample rate
|
uint32_t sample_rate; /* decoded sample rate */
|
||||||
uint8_t channels; // decoded number of channels
|
uint8_t channels; /* decoded number of channels */
|
||||||
uint8_t bits_per_sample; // decoded bits per sample
|
uint8_t bits_per_sample; /* decoded bits per sample */
|
||||||
uint32_t compressed_offset; // current offset in compressed data
|
uint32_t compressed_offset; /* current offset in compressed data */
|
||||||
const FLAC__byte * compressed_start; // start of compressed data
|
const FLAC__byte * compressed_start; /* start of compressed data */
|
||||||
uint32_t compressed_length; // length of compressed data
|
uint32_t compressed_length; /* length of compressed data */
|
||||||
const FLAC__byte * compressed2_start; // start of compressed data
|
const FLAC__byte * compressed2_start; /* start of compressed data */
|
||||||
uint32_t compressed2_length; // length of compressed data
|
uint32_t compressed2_length; /* length of compressed data */
|
||||||
int16_t * uncompressed_start[8]; // pointer to start of uncompressed data (up to 8 streams)
|
int16_t * uncompressed_start[8]; /* pointer to start of uncompressed data (up to 8 streams) */
|
||||||
uint32_t uncompressed_offset; // current position in uncompressed data
|
uint32_t uncompressed_offset; /* current position in uncompressed data */
|
||||||
uint32_t uncompressed_length; // length of uncompressed data
|
uint32_t uncompressed_length; /* length of uncompressed data */
|
||||||
int uncompressed_swap; // swap uncompressed sample data
|
int uncompressed_swap; /* swap uncompressed sample data */
|
||||||
uint8_t custom_header[0x2a]; // custom header
|
uint8_t custom_header[0x2a]; /* custom header */
|
||||||
};
|
};
|
||||||
|
|
||||||
// ======================> flac_decoder
|
/* ======================> flac_decoder */
|
||||||
|
|
||||||
void flac_decoder_init(flac_decoder* decoder);
|
void flac_decoder_init(flac_decoder* decoder);
|
||||||
void flac_decoder_free(flac_decoder* decoder);
|
void flac_decoder_free(flac_decoder* decoder);
|
||||||
@ -48,4 +49,4 @@ int flac_decoder_reset(flac_decoder* decoder, uint32_t sample_rate, uint8_t nu
|
|||||||
int flac_decoder_decode_interleaved(flac_decoder* decoder, int16_t *samples, uint32_t num_samples, int swap_endian);
|
int flac_decoder_decode_interleaved(flac_decoder* decoder, int16_t *samples, uint32_t num_samples, int swap_endian);
|
||||||
uint32_t flac_decoder_finish(flac_decoder* decoder);
|
uint32_t flac_decoder_finish(flac_decoder* decoder);
|
||||||
|
|
||||||
#endif // __FLAC_H__
|
#endif /* __FLAC_H__ */
|
||||||
|
@ -453,7 +453,7 @@ int huffman_build_tree(struct huffman_decoder* decoder, uint32_t totaldata, uint
|
|||||||
node->numbits = 0;
|
node->numbits = 0;
|
||||||
node->bits = 0;
|
node->bits = 0;
|
||||||
|
|
||||||
// if we have a non-zero weight, compute the number of bits
|
/* if we have a non-zero weight, compute the number of bits */
|
||||||
if (node->weight > 0)
|
if (node->weight > 0)
|
||||||
{
|
{
|
||||||
/* determine the number of bits for this node */
|
/* determine the number of bits for this node */
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// license:BSD-3-Clause
|
/* license:BSD-3-Clause
|
||||||
// copyright-holders:Aaron Giles
|
* copyright-holders:Aaron Giles
|
||||||
/***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
huffman.h
|
huffman.h
|
||||||
|
|
||||||
@ -16,9 +16,10 @@
|
|||||||
#include "bitstream.h"
|
#include "bitstream.h"
|
||||||
|
|
||||||
|
|
||||||
//**************************************************************************
|
/***************************************************************************
|
||||||
// CONSTANTS
|
* CONSTANTS
|
||||||
//**************************************************************************
|
***************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
enum huffman_error
|
enum huffman_error
|
||||||
{
|
{
|
||||||
@ -31,49 +32,50 @@ enum huffman_error
|
|||||||
HUFFERR_TOO_MANY_CONTEXTS
|
HUFFERR_TOO_MANY_CONTEXTS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* TYPE DEFINITIONS
|
||||||
//**************************************************************************
|
***************************************************************************
|
||||||
// TYPE DEFINITIONS
|
*/
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
typedef uint16_t lookup_value;
|
typedef uint16_t lookup_value;
|
||||||
|
|
||||||
// a node in the huffman tree
|
/* a node in the huffman tree */
|
||||||
struct node_t
|
struct node_t
|
||||||
{
|
{
|
||||||
struct node_t* parent; // pointer to parent node
|
struct node_t* parent; /* pointer to parent node */
|
||||||
uint32_t count; // number of hits on this node
|
uint32_t count; /* number of hits on this node */
|
||||||
uint32_t weight; // assigned weight of this node
|
uint32_t weight; /* assigned weight of this node */
|
||||||
uint32_t bits; // bits used to encode the node
|
uint32_t bits; /* bits used to encode the node */
|
||||||
uint8_t numbits; // number of bits needed for this node
|
uint8_t numbits; /* number of bits needed for this node */
|
||||||
};
|
};
|
||||||
|
|
||||||
// ======================> huffman_context_base
|
/* ======================> huffman_context_base */
|
||||||
|
|
||||||
// context class for decoding
|
/* context class for decoding */
|
||||||
struct huffman_decoder
|
struct huffman_decoder
|
||||||
{
|
{
|
||||||
// internal state
|
/* internal state */
|
||||||
uint32_t numcodes; // number of total codes being processed
|
uint32_t numcodes; /* number of total codes being processed */
|
||||||
uint8_t maxbits; // maximum bits per code
|
uint8_t maxbits; /* maximum bits per code */
|
||||||
uint8_t prevdata; // value of the previous data (for delta-RLE encoding)
|
uint8_t prevdata; /* value of the previous data (for delta-RLE encoding) */
|
||||||
int rleremaining; // number of RLE bytes remaining (for delta-RLE encoding)
|
int rleremaining; /* number of RLE bytes remaining (for delta-RLE encoding) */
|
||||||
lookup_value * lookup; // pointer to the lookup table
|
lookup_value * lookup; /* pointer to the lookup table */
|
||||||
struct node_t * huffnode; // array of nodes
|
struct node_t * huffnode; /* array of nodes */
|
||||||
uint32_t * datahisto; // histogram of data values
|
uint32_t * datahisto; /* histogram of data values */
|
||||||
|
|
||||||
// array versions of the info we need
|
/* array versions of the info we need */
|
||||||
//node_t* huffnode_array; //[_NumCodes];
|
#if 0
|
||||||
//lookup_value* lookup_array; //[1 << _MaxBits];
|
node_t* huffnode_array; /* [_NumCodes]; */
|
||||||
|
lookup_value* lookup_array; /* [1 << _MaxBits]; */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// ======================> huffman_decoder
|
/* ======================> huffman_decoder */
|
||||||
|
|
||||||
struct huffman_decoder* create_huffman_decoder(int numcodes, int maxbits);
|
struct huffman_decoder* create_huffman_decoder(int numcodes, int maxbits);
|
||||||
void delete_huffman_decoder(struct huffman_decoder* decoder);
|
void delete_huffman_decoder(struct huffman_decoder* decoder);
|
||||||
|
|
||||||
// single item operations
|
/* single item operations */
|
||||||
uint32_t huffman_decode_one(struct huffman_decoder* decoder, struct bitstream* bitbuf);
|
uint32_t huffman_decode_one(struct huffman_decoder* decoder, struct bitstream* bitbuf);
|
||||||
|
|
||||||
enum huffman_error huffman_import_tree_rle(struct huffman_decoder* decoder, struct bitstream* bitbuf);
|
enum huffman_error huffman_import_tree_rle(struct huffman_decoder* decoder, struct bitstream* bitbuf);
|
||||||
|
@ -82,7 +82,7 @@ HAVE_SSE=no # x86 SSE optimizations (SSE, SSE2)
|
|||||||
HAVE_FLOATHARD=no # Force hard float ABI (for ARM)
|
HAVE_FLOATHARD=no # Force hard float ABI (for ARM)
|
||||||
HAVE_FLOATSOFTFP=no # Force soft float ABI (for ARM)
|
HAVE_FLOATSOFTFP=no # Force soft float ABI (for ARM)
|
||||||
HAVE_7ZIP=yes # Compile in 7z support
|
HAVE_7ZIP=yes # Compile in 7z support
|
||||||
HAVE_FLAC=yes # Compile in flac support
|
HAVE_FLAC=no # Compile in flac support
|
||||||
HAVE_UPDATE_ASSETS=yes # Disable downloading assets with online updater
|
HAVE_UPDATE_ASSETS=yes # Disable downloading assets with online updater
|
||||||
HAVE_PRESERVE_DYLIB=no # Enable dlclose() for Valgrind support
|
HAVE_PRESERVE_DYLIB=no # Enable dlclose() for Valgrind support
|
||||||
HAVE_PARPORT=auto # Parallel port joypad support
|
HAVE_PARPORT=auto # Parallel port joypad support
|
||||||
|
Loading…
x
Reference in New Issue
Block a user