mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
Fix OpenFEC compile error on Windows platform
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
* Default maximum number of source and encoding symbols for this codec.
|
||||
* This value depends in particular on the kind of decoder used. To this
|
||||
* limit, codec implementation details might add other limits (e.g. if
|
||||
* the ESI values are stored in UINT16 instead of UINT32...).
|
||||
* the ESI values are stored in _UINT16 instead of _UINT32...).
|
||||
*
|
||||
* Hints:
|
||||
* If ML decoding is enabled and used, then limit yourself to a value
|
||||
|
||||
@@ -83,7 +83,7 @@ of_status_t of_ldpc_ff_set_fec_parameters (of_ldpc_ff_cb_t* cb,
|
||||
|
||||
#ifdef OF_USE_ENCODER
|
||||
/**
|
||||
* @fn of_status_t of_ldpc_ff_build_repair_symbol (of_ldpc_ff_cb_t* ofcb, void* encoding_symbols_tab[], UINT32 esi_of_symbol_to_build)
|
||||
* @fn of_status_t of_ldpc_ff_build_repair_symbol (of_ldpc_ff_cb_t* ofcb, void* encoding_symbols_tab[], _UINT32 esi_of_symbol_to_build)
|
||||
* @brief build a repair symbol (encoder only)
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param encoding_symbols_tab (IN/OUT) table of source and repair symbols.
|
||||
@@ -97,12 +97,12 @@ of_status_t of_ldpc_ff_set_fec_parameters (of_ldpc_ff_cb_t* cb,
|
||||
*/
|
||||
of_status_t of_ldpc_ff_build_repair_symbol (of_ldpc_ff_cb_t* ofcb,
|
||||
void* encoding_symbols_tab[],
|
||||
UINT32 esi_of_symbol_to_build);
|
||||
_UINT32 esi_of_symbol_to_build);
|
||||
#endif //OF_USE_ENCODER
|
||||
|
||||
#ifdef OF_USE_DECODER
|
||||
/**
|
||||
* @fn of_status_t of_ldpc_ff_set_control_parameter (of_ldpc_ff_cb_t* ofcb,UINT32 type,void* value,UINT32 length)
|
||||
* @fn of_status_t of_ldpc_ff_set_control_parameter (of_ldpc_ff_cb_t* ofcb,_UINT32 type,void* value,_UINT32 length)
|
||||
* @brief set a specific FEC parameter
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param type (IN) Type of parameter. This type is FEC codec ID specific.
|
||||
@@ -111,12 +111,12 @@ of_status_t of_ldpc_ff_build_repair_symbol (of_ldpc_ff_cb_t* ofcb,
|
||||
* @return Error status.
|
||||
*/
|
||||
of_status_t of_ldpc_ff_set_control_parameter (of_ldpc_ff_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length);
|
||||
_UINT32 length);
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_ldpc_ff_get_control_parameter (of_ldpc_ff_cb_t* ofcb,UINT32 type,void* value,UINT32 length)
|
||||
* @fn of_status_t of_ldpc_ff_get_control_parameter (of_ldpc_ff_cb_t* ofcb,_UINT32 type,void* value,_UINT32 length)
|
||||
* @brief get a specific FEC parameter
|
||||
* @param ses (IN) Pointer to the session.
|
||||
* @param type (IN) Type of parameter. This type is FEC codec ID specific.
|
||||
@@ -127,16 +127,16 @@ of_status_t of_ldpc_ff_set_control_parameter (of_ldpc_ff_cb_t* ofcb,
|
||||
* @return Error status.
|
||||
*/
|
||||
of_status_t of_ldpc_ff_get_control_parameter (of_ldpc_ff_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length);
|
||||
_UINT32 length);
|
||||
|
||||
#endif //OF_USE_DECODER
|
||||
|
||||
/**
|
||||
* This function return the number of rows and cols of a matrix read into matrix_file.
|
||||
*
|
||||
* @fn of_status_t of_get_pck_matrix_dimensions_from_file(char * matrix_file,UINT32 * n_rows, UINT32 *n_cols)
|
||||
* @fn of_status_t of_get_pck_matrix_dimensions_from_file(char * matrix_file,_UINT32 * n_rows, _UINT32 *n_cols)
|
||||
* @brief return the number of rows and cols of a matrix
|
||||
* @param matrix_file (IN) name of the file containing the matrix
|
||||
* @param n_rows (OUT) number of rows in matrix
|
||||
@@ -144,8 +144,8 @@ of_status_t of_ldpc_ff_get_control_parameter (of_ldpc_ff_cb_t* ofcb,
|
||||
* @return Error status. If it's OK, nb_row and nb_col contain the number of rows and cols of matrix.
|
||||
*/
|
||||
of_status_t of_get_pck_matrix_dimensions_from_file (char* matrix_file,
|
||||
UINT32 * n_rows,
|
||||
UINT32 * n_cols);
|
||||
_UINT32 * n_rows,
|
||||
_UINT32 * n_cols);
|
||||
|
||||
|
||||
#endif //OF_LDPC_FF_H
|
||||
|
||||
@@ -63,12 +63,12 @@ of_status_t of_ldpc_ff_set_fec_parameters (of_ldpc_ff_cb_t* cb,
|
||||
of_ldpc_ff_parameters_t* params)
|
||||
{
|
||||
of_mod2entry *e;
|
||||
UINT32 row;
|
||||
UINT32 seq;
|
||||
UINT32 matrix_nb_par;
|
||||
UINT32 matrix_nb_src;
|
||||
UINT32 *p_matrix_nb_par;
|
||||
UINT32 *p_matrix_nb_src;
|
||||
_UINT32 row;
|
||||
_UINT32 seq;
|
||||
_UINT32 matrix_nb_par;
|
||||
_UINT32 matrix_nb_src;
|
||||
_UINT32 *p_matrix_nb_par;
|
||||
_UINT32 *p_matrix_nb_src;
|
||||
char * m_matrix_file;
|
||||
FILE *pFile;
|
||||
|
||||
@@ -133,10 +133,10 @@ of_status_t of_ldpc_ff_set_fec_parameters (of_ldpc_ff_cb_t* cb,
|
||||
#ifdef OF_USE_DECODER
|
||||
if (ofcb->codec_type & OF_DECODER)
|
||||
{
|
||||
ofcb->tab_nb_unknown_symbols = (UINT16*) of_calloc(ofcb->nb_repair_symbols, sizeof(UINT16));
|
||||
ofcb->tab_nb_unknown_symbols = (_UINT16*) of_calloc(ofcb->nb_repair_symbols, sizeof(_UINT16));
|
||||
ofcb->tab_const_term_of_equ = (void**) of_calloc(ofcb->nb_repair_symbols, sizeof(void*));
|
||||
ofcb->tab_nb_equ_for_repair = (UINT16*) of_calloc(ofcb->nb_repair_symbols, sizeof(UINT16));
|
||||
ofcb->tab_nb_enc_symbols_per_equ = (UINT16*) of_calloc(ofcb->nb_repair_symbols, sizeof(UINT16));
|
||||
ofcb->tab_nb_equ_for_repair = (_UINT16*) of_calloc(ofcb->nb_repair_symbols, sizeof(_UINT16));
|
||||
ofcb->tab_nb_enc_symbols_per_equ = (_UINT16*) of_calloc(ofcb->nb_repair_symbols, sizeof(_UINT16));
|
||||
if (ofcb->tab_nb_unknown_symbols == NULL || ofcb->tab_const_term_of_equ == NULL ||
|
||||
ofcb->tab_nb_equ_for_repair == NULL || ofcb->tab_nb_enc_symbols_per_equ == NULL) {
|
||||
goto no_mem;
|
||||
@@ -191,7 +191,7 @@ error:
|
||||
|
||||
of_status_t of_ldpc_ff_build_repair_symbol (of_ldpc_ff_cb_t* ofcb,
|
||||
void* encoding_symbols_tab[],
|
||||
UINT32 esi_of_symbol_to_build)
|
||||
_UINT32 esi_of_symbol_to_build)
|
||||
{
|
||||
if (ofcb->H2_is_identity_with_lower_triangle)
|
||||
{
|
||||
@@ -208,9 +208,9 @@ of_status_t of_ldpc_ff_build_repair_symbol (of_ldpc_ff_cb_t* ofcb,
|
||||
|
||||
|
||||
of_status_t of_ldpc_ff_set_control_parameter (of_ldpc_ff_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length)
|
||||
_UINT32 length)
|
||||
{
|
||||
OF_PRINT_ERROR(("of_ldpc_ff_set_control_parameter: ERROR, not implemented...\n"))
|
||||
return OF_STATUS_ERROR;
|
||||
@@ -218,9 +218,9 @@ of_status_t of_ldpc_ff_set_control_parameter (of_ldpc_ff_cb_t* ofcb,
|
||||
|
||||
|
||||
of_status_t of_ldpc_ff_get_control_parameter (of_ldpc_ff_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length)
|
||||
_UINT32 length)
|
||||
{
|
||||
of_ldpc_staircase_cb_t *ofcb_staircase;
|
||||
|
||||
@@ -228,23 +228,23 @@ of_status_t of_ldpc_ff_get_control_parameter (of_ldpc_ff_cb_t* ofcb,
|
||||
ofcb_staircase = (of_ldpc_staircase_cb_t*)ofcb;
|
||||
switch (type) {
|
||||
case OF_CTRL_GET_MAX_K:
|
||||
if (value == NULL || length != sizeof(UINT32)) {
|
||||
if (value == NULL || length != sizeof(_UINT32)) {
|
||||
OF_PRINT_ERROR(("%s: OF_CTRL_GET_MAX_K ERROR: null value or bad length (got %d, expected %ld)\n",
|
||||
__FUNCTION__, length, sizeof(UINT32)))
|
||||
__FUNCTION__, length, sizeof(_UINT32)))
|
||||
goto error;
|
||||
}
|
||||
*(UINT32*)value = ofcb_staircase->max_nb_source_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_K (%d)\n", __FUNCTION__, *(UINT32*)value))
|
||||
*(_UINT32*)value = ofcb_staircase->max_nb_source_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_K (%d)\n", __FUNCTION__, *(_UINT32*)value))
|
||||
break;
|
||||
|
||||
case OF_CTRL_GET_MAX_N:
|
||||
if (value == NULL || length != sizeof(UINT32)) {
|
||||
if (value == NULL || length != sizeof(_UINT32)) {
|
||||
OF_PRINT_ERROR(("%s: OF_CTRL_GET_MAX_N ERROR: null value or bad length (got %d, expected %ld)\n",
|
||||
__FUNCTION__, length, sizeof(UINT32)))
|
||||
__FUNCTION__, length, sizeof(_UINT32)))
|
||||
goto error;
|
||||
}
|
||||
*(UINT32*)value = ofcb_staircase->max_nb_encoding_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_N (%d)\n", __FUNCTION__, *(UINT32*)value))
|
||||
*(_UINT32*)value = ofcb_staircase->max_nb_encoding_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_N (%d)\n", __FUNCTION__, *(_UINT32*)value))
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -260,7 +260,7 @@ error:
|
||||
}
|
||||
|
||||
|
||||
of_status_t of_get_pck_matrix_dimensions_from_file(char * matrix_file,UINT32 * n_rows, UINT32 *n_cols){
|
||||
of_status_t of_get_pck_matrix_dimensions_from_file(char * matrix_file,_UINT32 * n_rows, _UINT32 *n_cols){
|
||||
|
||||
FILE * f;
|
||||
char * pch;
|
||||
|
||||
@@ -47,9 +47,9 @@
|
||||
*/
|
||||
typedef struct of_ldpc_ff_parameters
|
||||
{
|
||||
UINT32 nb_source_symbols; /* must be 1st item */
|
||||
UINT32 nb_repair_symbols; /* must be 2nd item */
|
||||
UINT32 encoding_symbol_length; /* must be 3rd item */
|
||||
_UINT32 nb_source_symbols; /* must be 1st item */
|
||||
_UINT32 nb_repair_symbols; /* must be 2nd item */
|
||||
_UINT32 encoding_symbol_length; /* must be 3rd item */
|
||||
/*
|
||||
* FEC codec id specific attributes follow...
|
||||
*/
|
||||
|
||||
@@ -36,23 +36,23 @@
|
||||
|
||||
#ifdef OF_USE_LINEAR_BINARY_CODES_UTILS
|
||||
|
||||
static const UINT64 of_m1 = 0x5555555555555555LL; //binary: 0101...
|
||||
static const UINT64 of_m2 = 0x3333333333333333LL; //binary: 00110011..
|
||||
static const UINT64 of_m4 = 0x0f0f0f0f0f0f0f0fLL; //binary: 4 zeros, 4 ones ...
|
||||
static const UINT64 of_m8 = 0x00ff00ff00ff00ffLL; //binary: 8 zeros, 8 ones ...
|
||||
static const UINT64 of_m16 = 0x0000ffff0000ffffLL; //binary: 16 zeros, 16 ones ...
|
||||
static const UINT64 of_m32 = 0x00000000ffffffffLL; //binary: 32 zeros, 32 ones
|
||||
static const UINT64 of_hff = 0xffffffffffffffffLL; //binary: all ones
|
||||
static const UINT64 of_h01 = 0x0101010101010101LL; //the sum of 256 to the power of 0,1,2,3...
|
||||
static const _UINT64 of_m1 = 0x5555555555555555LL; //binary: 0101...
|
||||
static const _UINT64 of_m2 = 0x3333333333333333LL; //binary: 00110011..
|
||||
static const _UINT64 of_m4 = 0x0f0f0f0f0f0f0f0fLL; //binary: 4 zeros, 4 ones ...
|
||||
static const _UINT64 of_m8 = 0x00ff00ff00ff00ffLL; //binary: 8 zeros, 8 ones ...
|
||||
static const _UINT64 of_m16 = 0x0000ffff0000ffffLL; //binary: 16 zeros, 16 ones ...
|
||||
static const _UINT64 of_m32 = 0x00000000ffffffffLL; //binary: 32 zeros, 32 ones
|
||||
static const _UINT64 of_hff = 0xffffffffffffffffLL; //binary: all ones
|
||||
static const _UINT64 of_h01 = 0x0101010101010101LL; //the sum of 256 to the power of 0,1,2,3...
|
||||
|
||||
|
||||
UINT8 of_hw8table[256] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8};
|
||||
_UINT8 of_hw8table[256] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8};
|
||||
|
||||
|
||||
//This uses fewer arithmetic operations than any other known
|
||||
//implementation on machines with fast multiplication.
|
||||
//It uses 12 arithmetic operations, one of which is a multiply.
|
||||
INT32 of_popcount_3 (UINT64 x)
|
||||
_INT32 of_popcount_3 (_UINT64 x)
|
||||
{
|
||||
x -= (x >> 1) & of_m1; //put count of each 2 bits into those 2 bits
|
||||
x = (x & of_m2) + ( (x >> 2) & of_m2); //put count of each 4 bits into those 4 bits
|
||||
@@ -61,9 +61,9 @@ INT32 of_popcount_3 (UINT64 x)
|
||||
}
|
||||
|
||||
|
||||
UINT32 of_hweight32 (UINT32 w)
|
||||
_UINT32 of_hweight32 (_UINT32 w)
|
||||
{
|
||||
UINT32 res = w - ( (w >> 1) & 0x55555555);
|
||||
_UINT32 res = w - ( (w >> 1) & 0x55555555);
|
||||
res = (res & 0x33333333) + ( (res >> 2) & 0x33333333);
|
||||
res = (res + (res >> 4)) & 0x0F0F0F0F;
|
||||
res = res + (res >> 8);
|
||||
@@ -71,7 +71,7 @@ UINT32 of_hweight32 (UINT32 w)
|
||||
}
|
||||
|
||||
|
||||
UINT8 of_hweight8_table (UINT8 w)
|
||||
_UINT8 of_hweight8_table (_UINT8 w)
|
||||
{
|
||||
//unsigned char res;
|
||||
//res=of_hw8table[w];
|
||||
@@ -83,10 +83,10 @@ UINT8 of_hweight8_table (UINT8 w)
|
||||
}
|
||||
|
||||
|
||||
UINT32 of_hweight32_table (UINT32 w)
|
||||
_UINT32 of_hweight32_table (_UINT32 w)
|
||||
{
|
||||
UINT32 res = 0;
|
||||
UINT8 *w8 = (UINT8*) (&w);
|
||||
_UINT32 res = 0;
|
||||
_UINT8 *w8 = (_UINT8*) (&w);
|
||||
// for (int j = 0; j<4; j++){
|
||||
// res+=hweight8_table(w8[j]);
|
||||
// }
|
||||
@@ -96,12 +96,12 @@ UINT32 of_hweight32_table (UINT32 w)
|
||||
}
|
||||
|
||||
|
||||
UINT32 of_hweight32_naive (UINT32 w)
|
||||
_UINT32 of_hweight32_naive (_UINT32 w)
|
||||
{
|
||||
INT32 j;
|
||||
UINT32 res = 0;
|
||||
UINT32 x = w;
|
||||
for (j = 0; j < sizeof (UINT32); j++)
|
||||
_INT32 j;
|
||||
_UINT32 res = 0;
|
||||
_UINT32 x = w;
|
||||
for (j = 0; j < sizeof (_UINT32); j++)
|
||||
{
|
||||
res += x & 1;
|
||||
x = x >> 1;
|
||||
@@ -111,12 +111,12 @@ UINT32 of_hweight32_naive (UINT32 w)
|
||||
|
||||
|
||||
/* compute the hamming weight of an array containg 32bits words*/
|
||||
UINT32 of_hweight_array (UINT32 *array, INT32 size)
|
||||
_UINT32 of_hweight_array (_UINT32 *array, _INT32 size)
|
||||
{
|
||||
UINT32 weight = 0;
|
||||
UINT32 i;
|
||||
UINT32 array_size_32, array_size_32_rem;
|
||||
UINT32 *v32;
|
||||
_UINT32 weight = 0;
|
||||
_UINT32 i;
|
||||
_UINT32 array_size_32, array_size_32_rem;
|
||||
_UINT32 *v32;
|
||||
|
||||
array_size_32 = size >> 5;
|
||||
array_size_32_rem = size % 32; // Remaining bytes
|
||||
@@ -126,14 +126,14 @@ UINT32 of_hweight_array (UINT32 *array, INT32 size)
|
||||
}
|
||||
|
||||
#if defined (__LP64__) || (__WORDSIZE == 64)
|
||||
UINT32 array_size64; // Size of array in 64bits unit
|
||||
UINT32 array_size64rem;
|
||||
_UINT32 array_size64; // Size of array in 64bits unit
|
||||
_UINT32 array_size64rem;
|
||||
array_size64 = array_size_32 >> 1;
|
||||
array_size64rem = array_size_32 % 2;
|
||||
|
||||
// 64-bit machines
|
||||
/* First perform as many 64-bit XORs as needed... */
|
||||
UINT64 *v64 = (UINT64*) array; // to pointer to 64-bit integers
|
||||
_UINT64 *v64 = (_UINT64*) array; // to pointer to 64-bit integers
|
||||
for (i = array_size64; i > 0; i--)
|
||||
{
|
||||
weight += of_popcount_3 (*v64);
|
||||
@@ -142,12 +142,12 @@ UINT32 of_hweight_array (UINT32 *array, INT32 size)
|
||||
/* then perform a 32-bit XOR if needed... */
|
||||
if (array_size64rem > 0)
|
||||
{
|
||||
v32 = (UINT32*) v64; // to pointer to 32-bit integers
|
||||
v32 = (_UINT32*) v64; // to pointer to 32-bit integers
|
||||
weight += of_hweight32_table (*v32);
|
||||
v32++;
|
||||
}
|
||||
#else // 32-bit machines
|
||||
v32 = (UINT32*) array;
|
||||
v32 = (_UINT32*) array;
|
||||
for (i = array_size_32;i > 0;i--)
|
||||
{
|
||||
weight += of_hweight32_table (*v32);
|
||||
|
||||
@@ -43,53 +43,53 @@
|
||||
* implementation on machines with fast multiplication.
|
||||
* It uses 12 arithmetic operations, one of which is a multiply.
|
||||
*
|
||||
* @fn INT32 of_popcount_3 (UINT64 x)
|
||||
* @fn _INT32 of_popcount_3 (_UINT64 x)
|
||||
* @brief return the number of "1" in a 64 bits word.
|
||||
* @param x (IN) 64bits word
|
||||
* @return count of "1" of x
|
||||
*/
|
||||
INT32 of_popcount_3 (UINT64 x);
|
||||
_INT32 of_popcount_3 (_UINT64 x);
|
||||
|
||||
/**
|
||||
* return the hamming weight of a 32bits word
|
||||
*
|
||||
* @fn UINT32 of_hweight32 (UINT32 w)
|
||||
* @fn _UINT32 of_hweight32 (_UINT32 w)
|
||||
* @brief return the hamming weight of a 32bits word
|
||||
* @param w (IN) 32bits word
|
||||
* @return hamming weight of w
|
||||
*/
|
||||
UINT32 of_hweight32 (UINT32 w);
|
||||
_UINT32 of_hweight32 (_UINT32 w);
|
||||
|
||||
/**
|
||||
* return the hamming weight of a 32bits word with a naive method
|
||||
*
|
||||
* @fn UINT32 of_hweight32_naive (UINT32 w)
|
||||
* @fn _UINT32 of_hweight32_naive (_UINT32 w)
|
||||
* @brief return the hamming weight of a 32bits word
|
||||
* @param w (IN) 32bits word
|
||||
* @return hamming weight of w
|
||||
*/
|
||||
UINT32 of_hweight32_naive (UINT32 w);
|
||||
_UINT32 of_hweight32_naive (_UINT32 w);
|
||||
|
||||
/**
|
||||
* return the hamming weight of a 32bits word with a corresponding table method
|
||||
*
|
||||
* @fn UINT32 of_hweight32_table (UINT32 w)
|
||||
* @fn _UINT32 of_hweight32_table (_UINT32 w)
|
||||
* @brief return the hamming weight of a 32bits word
|
||||
* @param w (IN) 32bits word
|
||||
* @return hamming weight of w
|
||||
*/
|
||||
UINT32 of_hweight32_table (UINT32 w);
|
||||
_UINT32 of_hweight32_table (_UINT32 w);
|
||||
|
||||
/**
|
||||
* return the hamming weight of an array word
|
||||
*
|
||||
* @fn UINT32 of_hweight_array (UINT32 *array, INT32 size)
|
||||
* @fn _UINT32 of_hweight_array (_UINT32 *array, _INT32 size)
|
||||
* @brief return the hamming weight of a 32bits word
|
||||
* @param array (IN) pointer to array
|
||||
* @param size (IN) size of array
|
||||
* @return hamming weight of array
|
||||
*/
|
||||
UINT32 of_hweight_array (UINT32 *array, INT32 size);
|
||||
_UINT32 of_hweight_array (_UINT32 *array, _INT32 size);
|
||||
|
||||
#endif //OF_USE_LINEAR_BINARY_CODES_UTILS
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ void of_mod2sparse_to_dense (of_mod2sparse *m, /* Sparse matrix to convert */
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2entry *e;
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
|
||||
if (of_mod2sparse_rows (m) > of_mod2dense_rows (r)
|
||||
|| of_mod2sparse_cols (m) > of_mod2dense_cols (r))
|
||||
@@ -72,7 +72,7 @@ void of_mod2sparse_to_dense (of_mod2sparse *m, /* Sparse matrix to convert */
|
||||
void of_mod2dense_to_sparse (of_mod2dense *m, /* Dense matrix to convert */
|
||||
of_mod2sparse *r) /* Place to store result */
|
||||
{
|
||||
UINT32 i, j;
|
||||
_UINT32 i, j;
|
||||
|
||||
if (of_mod2dense_rows (m) > of_mod2sparse_rows (r)
|
||||
|| of_mod2dense_cols (m) > of_mod2sparse_cols (r))
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
/* ALLOCATE SPACE FOR A DENSE MOD2 MATRIX. */
|
||||
|
||||
of_mod2dense *of_mod2dense_allocate (UINT32 n_rows, /* Number of rows in matrix */
|
||||
UINT32 n_cols) /* Number of columns in matrix */
|
||||
of_mod2dense *of_mod2dense_allocate (_UINT32 n_rows, /* Number of rows in matrix */
|
||||
_UINT32 n_cols) /* Number of columns in matrix */
|
||||
{
|
||||
of_mod2dense *m;
|
||||
UINT32 j;
|
||||
_UINT32 j;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
if (n_rows <= 0 || n_cols <= 0)
|
||||
@@ -80,7 +80,7 @@ void of_mod2dense_free (of_mod2dense *m) /* Matrix to free */
|
||||
void of_mod2dense_clear (of_mod2dense *r)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 k, j;
|
||||
_UINT32 k, j;
|
||||
#ifdef COL_ORIENTED
|
||||
for (j = 0; j < of_mod2dense_cols (r); j++)
|
||||
{
|
||||
@@ -109,7 +109,7 @@ void of_mod2dense_copy (of_mod2dense *m, /* Matrix to copy */
|
||||
of_mod2dense *r) /* Place to store copy of matrix */
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 k, j;
|
||||
_UINT32 k, j;
|
||||
|
||||
|
||||
if (of_mod2dense_rows (m) > of_mod2dense_rows (r)
|
||||
@@ -168,10 +168,10 @@ void of_mod2dense_copy (of_mod2dense *m, /* Matrix to copy */
|
||||
|
||||
void of_mod2dense_copyrows (of_mod2dense *m, /* Matrix to copy */
|
||||
of_mod2dense *r, /* Place to store copy of matrix */
|
||||
UINT32 *rows) /* Indexes of rows to copy, from 0 */
|
||||
_UINT32 *rows) /* Indexes of rows to copy, from 0 */
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 i, j, k;
|
||||
_UINT32 i, j, k;
|
||||
|
||||
if (of_mod2dense_cols (m) > of_mod2dense_cols (r))
|
||||
{
|
||||
@@ -226,9 +226,9 @@ void of_mod2dense_copyrows (of_mod2dense *m, /* Matrix to copy */
|
||||
|
||||
void of_mod2dense_copycols (of_mod2dense *m, /* Matrix to copy */
|
||||
of_mod2dense *r, /* Place to store copy of matrix */
|
||||
UINT32 *cols) /* Indexes of columns to copy, from 0 */
|
||||
_UINT32 *cols) /* Indexes of columns to copy, from 0 */
|
||||
{
|
||||
UINT32 i, j;
|
||||
_UINT32 i, j;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
if (of_mod2dense_rows (m) > of_mod2dense_rows (r))
|
||||
@@ -273,7 +273,7 @@ void of_mod2dense_copycols (of_mod2dense *m, /* Matrix to copy */
|
||||
void of_mod2dense_print (FILE *f,
|
||||
of_mod2dense *m)
|
||||
{
|
||||
UINT32 i, j;
|
||||
_UINT32 i, j;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
for (i = 0; i < of_mod2dense_rows (m); i++)
|
||||
@@ -300,8 +300,8 @@ void of_mod2dense_print_bitmap (of_mod2dense *m,
|
||||
char *fname)
|
||||
{
|
||||
#ifdef IL_SUPPORT
|
||||
UINT32 i, j;
|
||||
UINT32 x,y;
|
||||
_UINT32 i, j;
|
||||
_UINT32 x,y;
|
||||
ILuint lImage;
|
||||
char cmd[100];
|
||||
|
||||
@@ -311,7 +311,7 @@ void of_mod2dense_print_bitmap (of_mod2dense *m,
|
||||
ilBindImage(lImage);
|
||||
//of_mod2dense_print_stats(stdout,m);
|
||||
ilTexImage(of_mod2dense_cols (m),of_mod2dense_rows (m) , 1, 3, IL_RGB, IL_UNSIGNED_BYTE, NULL);
|
||||
UINT32 val =1;
|
||||
_UINT32 val =1;
|
||||
y=of_mod2dense_rows (m);
|
||||
x=of_mod2dense_cols (m);
|
||||
for (i = 0; i < of_mod2dense_rows (m); i++)
|
||||
@@ -352,10 +352,10 @@ void of_mod2dense_print_bitmap (of_mod2dense *m,
|
||||
with a different byte-ordering. At present, this assumes that the words
|
||||
used to pack bits into are no longer than 32 bits. */
|
||||
|
||||
UINT32 of_mod2dense_write (FILE *f, of_mod2dense *m)
|
||||
_UINT32 of_mod2dense_write (FILE *f, of_mod2dense *m)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 j, k;
|
||||
_UINT32 j, k;
|
||||
|
||||
of_intio_write (f, m->n_rows);
|
||||
if (ferror (f))
|
||||
@@ -407,9 +407,9 @@ UINT32 of_mod2dense_write (FILE *f, of_mod2dense *m)
|
||||
of_mod2dense *of_mod2dense_read (FILE *f)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 n_rows, n_cols;
|
||||
_UINT32 n_rows, n_cols;
|
||||
of_mod2dense *m;
|
||||
UINT32 j, k;
|
||||
_UINT32 j, k;
|
||||
|
||||
n_rows = of_intio_read (f);
|
||||
if (feof (f) || ferror (f) || n_rows <= 0)
|
||||
@@ -462,9 +462,9 @@ of_mod2dense *of_mod2dense_read (FILE *f)
|
||||
|
||||
/* GET AN ELEMENT FROM A DENSE MOD2 MATRIX. */
|
||||
|
||||
UINT32 of_mod2dense_get (of_mod2dense *m, /* Matrix to get element from */
|
||||
UINT32 row, /* Row of element (starting with zero) */
|
||||
UINT32 col) /* Column of element (starting with zero) */
|
||||
_UINT32 of_mod2dense_get (of_mod2dense *m, /* Matrix to get element from */
|
||||
_UINT32 row, /* Row of element (starting with zero) */
|
||||
_UINT32 col) /* Column of element (starting with zero) */
|
||||
{
|
||||
//OF_ENTER_FUNCTION
|
||||
#ifdef OF_DEBUG
|
||||
@@ -489,10 +489,10 @@ UINT32 of_mod2dense_get (of_mod2dense *m, /* Matrix to get element from */
|
||||
|
||||
/* SET AN ELEMENT IN A DENSE MOD2 MATRIX. */
|
||||
|
||||
INT32 of_mod2dense_set (of_mod2dense *m, /* Matrix to modify element of */
|
||||
UINT32 row, /* Row of element (starting with zero) */
|
||||
UINT32 col, /* Column of element (starting with zero) */
|
||||
UINT32 value) /* New value of element (0 or 1) */
|
||||
_INT32 of_mod2dense_set (of_mod2dense *m, /* Matrix to modify element of */
|
||||
_UINT32 row, /* Row of element (starting with zero) */
|
||||
_UINT32 col, /* Column of element (starting with zero) */
|
||||
_UINT32 value) /* New value of element (0 or 1) */
|
||||
{
|
||||
of_mod2word *w;
|
||||
|
||||
@@ -522,12 +522,12 @@ INT32 of_mod2dense_set (of_mod2dense *m, /* Matrix to modify element of */
|
||||
|
||||
/* FLIP AN ELEMENT OF A DENSE MOD2 MATRIX. */
|
||||
|
||||
UINT32 of_mod2dense_flip (of_mod2dense *m, /* Matrix to flip element in */
|
||||
UINT32 row, /* Row of element (starting with zero) */
|
||||
UINT32 col) /* Column of element (starting with zero) */
|
||||
_UINT32 of_mod2dense_flip (of_mod2dense *m, /* Matrix to flip element in */
|
||||
_UINT32 row, /* Row of element (starting with zero) */
|
||||
_UINT32 col) /* Column of element (starting with zero) */
|
||||
{
|
||||
of_mod2word *w;
|
||||
UINT32 b;
|
||||
_UINT32 b;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
if (row >= of_mod2dense_rows (m) || col >= of_mod2dense_cols (m))
|
||||
@@ -571,7 +571,7 @@ void of_mod2dense_transpose
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2word w, v, *p;
|
||||
UINT32 k1, j1, i2, j2;
|
||||
_UINT32 k1, j1, i2, j2;
|
||||
|
||||
if (of_mod2dense_rows (m) != of_mod2dense_cols (r)
|
||||
|| of_mod2dense_cols (m) != of_mod2dense_rows (r))
|
||||
@@ -651,7 +651,7 @@ void of_mod2dense_add
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 j, k;
|
||||
_UINT32 j, k;
|
||||
|
||||
if (of_mod2dense_rows (m1) != of_mod2dense_rows (r)
|
||||
|| of_mod2dense_cols (m1) != of_mod2dense_cols (r)
|
||||
@@ -700,7 +700,7 @@ void of_mod2dense_multiply
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 i, j, k;
|
||||
_UINT32 i, j, k;
|
||||
|
||||
if (of_mod2dense_cols (m1) != of_mod2dense_rows (m2)
|
||||
|| of_mod2dense_rows (m1) != of_mod2dense_rows (r)
|
||||
@@ -754,13 +754,13 @@ void of_mod2dense_multiply
|
||||
|
||||
/* SEE WHETHER TWO DENSE MOD2 MATRICES ARE EQUAL. */
|
||||
|
||||
UINT32 of_mod2dense_equal
|
||||
_UINT32 of_mod2dense_equal
|
||||
(of_mod2dense *m1,
|
||||
of_mod2dense *m2
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 k, j, w;
|
||||
_UINT32 k, j, w;
|
||||
of_mod2word m;
|
||||
|
||||
if (of_mod2dense_rows (m1) != of_mod2dense_rows (m2)
|
||||
@@ -824,14 +824,14 @@ UINT32 of_mod2dense_equal
|
||||
|
||||
/* INVERT A DENSE MOD2 MATRIX. */
|
||||
|
||||
UINT32 of_mod2dense_invert
|
||||
_UINT32 of_mod2dense_invert
|
||||
(of_mod2dense *m, /* The matrix to find the inverse of (destroyed) */
|
||||
of_mod2dense *r /* Place to store the inverse */
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2word *s, *t;
|
||||
UINT32 i, j, k, n, w, k0, b0;
|
||||
_UINT32 i, j, k, n, w, k0, b0;
|
||||
|
||||
if (of_mod2dense_rows (m) != of_mod2dense_cols (m))
|
||||
{
|
||||
@@ -977,14 +977,14 @@ UINT32 of_mod2dense_invert
|
||||
|
||||
/* TRIANGULARIZE A DENSE MOD2 MATRIX. */
|
||||
|
||||
UINT32 of_mod2dense_triangularize
|
||||
_UINT32 of_mod2dense_triangularize
|
||||
(of_mod2dense *m, /* The matrix to find the inverse of (destroyed) */
|
||||
of_mod2dense *r /* Place to store the inverse */
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2word *s, *t;
|
||||
UINT32 i, j, k, n, p, w, k0, b0;
|
||||
_UINT32 i, j, k, n, p, w, k0, b0;
|
||||
|
||||
/* if (of_mod2dense_rows(m)!=of_mod2dense_cols(m)) */
|
||||
/* { fprintf(stderr,"of_mod2dense_triangularize: Matrix to invert is not square\n"); */
|
||||
@@ -1147,17 +1147,17 @@ UINT32 of_mod2dense_triangularize
|
||||
|
||||
/* INVERT A DENSE MOD2 MATRIX WITH ROWS & COLUMNS SELECTED FROM BIGGER MATRIX.*/
|
||||
|
||||
UINT32 of_mod2dense_invert_selected
|
||||
_UINT32 of_mod2dense_invert_selected
|
||||
(of_mod2dense *m, /* Matrix from which to pick a submatrix to invert */
|
||||
of_mod2dense *r, /* Place to store the inverse */
|
||||
UINT32 *rows, /* Set to indexes of rows used and not used */
|
||||
UINT32 *cols /* Set to indexes of columns used and not used */
|
||||
_UINT32 *rows, /* Set to indexes of rows used and not used */
|
||||
_UINT32 *cols /* Set to indexes of columns used and not used */
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2word *s, *t;
|
||||
UINT32 R;
|
||||
UINT32 i, j, k, n, w, k0, b0, n2, c;
|
||||
_UINT32 R;
|
||||
_UINT32 i, j, k, n, w, k0, b0, n2, c;
|
||||
|
||||
if (r == m)
|
||||
{
|
||||
@@ -1341,17 +1341,17 @@ UINT32 of_mod2dense_invert_selected
|
||||
|
||||
/* FORCIBLY INVERT A DENSE MOD2 MATRIX. */
|
||||
|
||||
UINT32 of_mod2dense_forcibly_invert
|
||||
_UINT32 of_mod2dense_forcibly_invert
|
||||
(of_mod2dense *m, /* The matrix to find the inverse of (destroyed) */
|
||||
of_mod2dense *r, /* Place to store the inverse */
|
||||
UINT32 *a_row, /* Place to store row indexes of altered elements */
|
||||
UINT32 *a_col /* Place to store column indexes of altered elements */
|
||||
_UINT32 *a_row, /* Place to store row indexes of altered elements */
|
||||
_UINT32 *a_col /* Place to store column indexes of altered elements */
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
// of_mod2word *s, *t;
|
||||
|
||||
UINT32 c = 0;
|
||||
_UINT32 c = 0;
|
||||
#ifdef COL_ORIENTED
|
||||
if (of_mod2dense_rows (m) != of_mod2dense_cols (m))
|
||||
{
|
||||
@@ -1460,9 +1460,9 @@ double of_mod2dense_density (of_mod2dense *m)
|
||||
{
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 nb_one = 0;
|
||||
UINT32 nb_entry = 0;
|
||||
UINT32 i, j;
|
||||
_UINT32 nb_one = 0;
|
||||
_UINT32 nb_entry = 0;
|
||||
_UINT32 i, j;
|
||||
double density = 0;
|
||||
#ifdef COL_ORIENTED
|
||||
for (j = 0; j < of_mod2dense_cols (m); j++)
|
||||
@@ -1498,10 +1498,10 @@ double of_mod2dense_density (of_mod2dense *m)
|
||||
/* RETURNS TRUE IF THE SPECIFIED ROW IS EMPTY */
|
||||
|
||||
bool of_mod2dense_row_is_empty (of_mod2dense *m,
|
||||
UINT32 row)
|
||||
_UINT32 row)
|
||||
{
|
||||
UINT32 i;
|
||||
UINT32 n_w; // number of of_mod2word in the row
|
||||
_UINT32 i;
|
||||
_UINT32 n_w; // number of of_mod2word in the row
|
||||
of_mod2word *w; // pointer to the current word of the row
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
@@ -1525,9 +1525,9 @@ bool of_mod2dense_row_is_empty (of_mod2dense *m,
|
||||
}
|
||||
|
||||
|
||||
UINT32 of_mod2dense_row_weight (of_mod2dense *m, UINT32 i)
|
||||
_UINT32 of_mod2dense_row_weight (of_mod2dense *m, _UINT32 i)
|
||||
{
|
||||
UINT32 weight = 0;
|
||||
_UINT32 weight = 0;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
if (i >= of_mod2dense_rows (m))
|
||||
@@ -1538,9 +1538,9 @@ UINT32 of_mod2dense_row_weight (of_mod2dense *m, UINT32 i)
|
||||
//of_mod2dense_print_memory_info(m);
|
||||
#define SLOW_HAMMING_WEIGHT_CALCULATION
|
||||
#ifdef SLOW_HAMMING_WEIGHT_CALCULATION
|
||||
UINT32 j;
|
||||
UINT32 nwords; /* number of of_mod2word in a row */
|
||||
//UINT32 weight1 = 0;
|
||||
_UINT32 j;
|
||||
_UINT32 nwords; /* number of of_mod2word in a row */
|
||||
//_UINT32 weight1 = 0;
|
||||
|
||||
nwords = of_mod2dense_cols (m) >> (of_mod2_wordsize_shift); // number of of_mod2word in a row
|
||||
|
||||
@@ -1553,7 +1553,7 @@ UINT32 of_mod2dense_row_weight (of_mod2dense *m, UINT32 i)
|
||||
}
|
||||
//printf("weight method2=%d (standard)\n",weight);
|
||||
#else
|
||||
weight = of_hweight_array ((UINT32 *) m->row[i], of_mod2dense_cols (m));
|
||||
weight = of_hweight_array ((_UINT32 *) m->row[i], of_mod2dense_cols (m));
|
||||
#endif
|
||||
|
||||
OF_EXIT_FUNCTION
|
||||
@@ -1561,11 +1561,11 @@ UINT32 of_mod2dense_row_weight (of_mod2dense *m, UINT32 i)
|
||||
}
|
||||
|
||||
|
||||
UINT32 of_mod2dense_row_weight_ignore_first (of_mod2dense *m, UINT32 i, UINT32 nb_ignore)
|
||||
_UINT32 of_mod2dense_row_weight_ignore_first (of_mod2dense *m, _UINT32 i, _UINT32 nb_ignore)
|
||||
{
|
||||
UINT32 weight = 0;
|
||||
//UINT32 nwords;
|
||||
UINT32 start0;
|
||||
_UINT32 weight = 0;
|
||||
//_UINT32 nwords;
|
||||
_UINT32 start0;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
if (i >= of_mod2dense_rows (m))
|
||||
@@ -1577,25 +1577,25 @@ UINT32 of_mod2dense_row_weight_ignore_first (of_mod2dense *m, UINT32 i, UINT32 n
|
||||
//nwords = of_mod2dense_cols (m) >> of_mod2_wordsize_shift; // number of of_mod2word in a row
|
||||
start0 = nb_ignore >> (of_mod2_wordsize_shift - 1);
|
||||
|
||||
UINT32 offset32 = nb_ignore >> of_mod2_wordsize_shift; // number of 32bits words that must be ignored
|
||||
UINT32 rem = of_mod2dense_cols (m) - (offset32 << of_mod2_wordsize_shift); // number of remaining bits to consider
|
||||
_UINT32 offset32 = nb_ignore >> of_mod2_wordsize_shift; // number of 32bits words that must be ignored
|
||||
_UINT32 rem = of_mod2dense_cols (m) - (offset32 << of_mod2_wordsize_shift); // number of remaining bits to consider
|
||||
|
||||
weight = of_hweight_array ((UINT32 *) & m->row[i][offset32], rem);
|
||||
weight = of_hweight_array ((_UINT32 *) & m->row[i][offset32], rem);
|
||||
OF_EXIT_FUNCTION
|
||||
return weight;
|
||||
}
|
||||
|
||||
|
||||
UINT32 of_mod2dense_col_weight (of_mod2dense *m, UINT32 i)
|
||||
_UINT32 of_mod2dense_col_weight (of_mod2dense *m, _UINT32 i)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 weight = 0;
|
||||
_UINT32 weight = 0;
|
||||
if (i >= of_mod2dense_cols (m))
|
||||
{
|
||||
OF_EXIT_FUNCTION
|
||||
return -1;
|
||||
}
|
||||
UINT32 j;
|
||||
_UINT32 j;
|
||||
for (j = 0; j < of_mod2dense_rows (m); j++)
|
||||
{
|
||||
if (of_mod2dense_get (m, j, i))
|
||||
@@ -1612,18 +1612,18 @@ UINT32 of_mod2dense_col_weight (of_mod2dense *m, UINT32 i)
|
||||
void of_mod2dense_print_stats (FILE *f, of_mod2dense *m)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
float density = 0;
|
||||
float row_density = 0;
|
||||
float col_density = 0;
|
||||
|
||||
/* rows stats*/
|
||||
float aver_nb_entry_per_row = 0;
|
||||
UINT32 max_entry_per_row = 0;
|
||||
UINT32 min_entry_per_row = 9999999;
|
||||
UINT32 nb_entry_row[ROW_MAX_ENTRY];
|
||||
UINT32 nb_entry_current_row = 0;
|
||||
UINT32 ctr = 0;
|
||||
_UINT32 max_entry_per_row = 0;
|
||||
_UINT32 min_entry_per_row = 9999999;
|
||||
_UINT32 nb_entry_row[ROW_MAX_ENTRY];
|
||||
_UINT32 nb_entry_current_row = 0;
|
||||
_UINT32 ctr = 0;
|
||||
|
||||
for (i = 0;i < ROW_MAX_ENTRY;i++)
|
||||
{
|
||||
@@ -1648,10 +1648,10 @@ void of_mod2dense_print_stats (FILE *f, of_mod2dense *m)
|
||||
|
||||
/* cols stats*/
|
||||
float aver_nb_entry_per_col = 0;
|
||||
UINT32 max_entry_per_col = 0;
|
||||
UINT32 min_entry_per_col = 9999999;
|
||||
UINT32 nb_entry_col[COL_MAX_ENTRY];
|
||||
UINT32 nb_entry_current_col = 0;
|
||||
_UINT32 max_entry_per_col = 0;
|
||||
_UINT32 min_entry_per_col = 9999999;
|
||||
_UINT32 nb_entry_col[COL_MAX_ENTRY];
|
||||
_UINT32 nb_entry_current_col = 0;
|
||||
|
||||
ctr = 0;
|
||||
for (i = 0;i < COL_MAX_ENTRY;i++)
|
||||
@@ -1733,9 +1733,9 @@ void of_mod2dense_print_memory_info (of_mod2dense *m)
|
||||
}
|
||||
|
||||
|
||||
void of_mod2dense_xor_rows(of_mod2dense *m, UINT16 from, UINT16 to)
|
||||
void of_mod2dense_xor_rows(of_mod2dense *m, _UINT16 from, _UINT16 to)
|
||||
{
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
of_mod2word *f;
|
||||
of_mod2word *t;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
/* PACKING OF BITS INTO WORDS. Bits are packed into 32-bit words, with
|
||||
the low-order bit coming first. */
|
||||
|
||||
typedef UINT32 of_mod2word; /* Data type that holds packed bits */
|
||||
typedef _UINT32 of_mod2word; /* Data type that holds packed bits */
|
||||
|
||||
|
||||
#define of_mod2_wordsize 32 /* Number of bits that fit in a of_mod2word. Can't
|
||||
@@ -67,10 +67,10 @@ typedef UINT32 of_mod2word; /* Data type that holds packed bits */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 n_rows; /* Number of rows in the matrix */
|
||||
UINT32 n_cols; /* Number of columns in the matrix */
|
||||
_UINT32 n_rows; /* Number of rows in the matrix */
|
||||
_UINT32 n_cols; /* Number of columns in the matrix */
|
||||
|
||||
UINT32 n_words; /* Number of words used to store a column of bits */
|
||||
_UINT32 n_words; /* Number of words used to store a column of bits */
|
||||
|
||||
#ifdef COL_ORIENTED
|
||||
of_mod2word **col; /* Pointer to array of pointers to columns */
|
||||
@@ -90,52 +90,52 @@ typedef struct
|
||||
|
||||
/* PROCEDURES. */
|
||||
|
||||
of_mod2dense *of_mod2dense_allocate (UINT32, UINT32);
|
||||
of_mod2dense *of_mod2dense_allocate (_UINT32, _UINT32);
|
||||
void of_mod2dense_free (of_mod2dense *);
|
||||
|
||||
void of_mod2dense_clear (of_mod2dense *);
|
||||
void of_mod2dense_copy (of_mod2dense *, of_mod2dense *);
|
||||
void of_mod2dense_copyrows (of_mod2dense*, of_mod2dense *, UINT32 *);
|
||||
void of_mod2dense_copycols (of_mod2dense*, of_mod2dense *, UINT32 *);
|
||||
void of_mod2dense_copyrows (of_mod2dense*, of_mod2dense *, _UINT32 *);
|
||||
void of_mod2dense_copycols (of_mod2dense*, of_mod2dense *, _UINT32 *);
|
||||
|
||||
void of_mod2dense_print (FILE *, of_mod2dense *);
|
||||
UINT32 of_mod2dense_write (FILE *, of_mod2dense *);
|
||||
_UINT32 of_mod2dense_write (FILE *, of_mod2dense *);
|
||||
of_mod2dense *of_mod2dense_read (FILE *);
|
||||
|
||||
UINT32 of_mod2dense_get (of_mod2dense *, UINT32, UINT32);
|
||||
INT32 of_mod2dense_set (of_mod2dense *, UINT32, UINT32, UINT32);
|
||||
UINT32 of_mod2dense_flip (of_mod2dense *, UINT32, UINT32);
|
||||
_UINT32 of_mod2dense_get (of_mod2dense *, _UINT32, _UINT32);
|
||||
_INT32 of_mod2dense_set (of_mod2dense *, _UINT32, _UINT32, _UINT32);
|
||||
_UINT32 of_mod2dense_flip (of_mod2dense *, _UINT32, _UINT32);
|
||||
|
||||
void of_mod2dense_transpose (of_mod2dense *, of_mod2dense *);
|
||||
void of_mod2dense_add (of_mod2dense *, of_mod2dense *, of_mod2dense *);
|
||||
void of_mod2dense_multiply (of_mod2dense *, of_mod2dense *, of_mod2dense *);
|
||||
|
||||
UINT32 of_mod2dense_equal (of_mod2dense *, of_mod2dense *);
|
||||
_UINT32 of_mod2dense_equal (of_mod2dense *, of_mod2dense *);
|
||||
|
||||
UINT32 of_mod2dense_invert (of_mod2dense *, of_mod2dense *);
|
||||
UINT32 of_mod2dense_forcibly_invert (of_mod2dense *, of_mod2dense *, UINT32 *, UINT32 *);
|
||||
UINT32 of_mod2dense_invert_selected (of_mod2dense *, of_mod2dense *, UINT32 *, UINT32 *);
|
||||
_UINT32 of_mod2dense_invert (of_mod2dense *, of_mod2dense *);
|
||||
_UINT32 of_mod2dense_forcibly_invert (of_mod2dense *, of_mod2dense *, _UINT32 *, _UINT32 *);
|
||||
_UINT32 of_mod2dense_invert_selected (of_mod2dense *, of_mod2dense *, _UINT32 *, _UINT32 *);
|
||||
|
||||
UINT32 of_mod2dense_triangularize (of_mod2dense *, of_mod2dense *);
|
||||
_UINT32 of_mod2dense_triangularize (of_mod2dense *, of_mod2dense *);
|
||||
|
||||
|
||||
void of_mod2dense_print_bitmap (of_mod2dense *, char *); //MC added
|
||||
void of_mod2dense_print_memory_info (of_mod2dense *); //MC added
|
||||
double of_mod2dense_density (of_mod2dense *); // MC added
|
||||
|
||||
bool of_mod2dense_row_is_empty (of_mod2dense *m, UINT32 row); // VR added
|
||||
UINT32 of_mod2word_weight (of_mod2word); // MC added
|
||||
bool of_mod2dense_row_is_empty (of_mod2dense *m, _UINT32 row); // VR added
|
||||
_UINT32 of_mod2word_weight (of_mod2word); // MC added
|
||||
|
||||
UINT32 of_mod2dense_row_weight (of_mod2dense *, UINT32); // MC added
|
||||
UINT32 of_mod2dense_row_weight_ignore_first (of_mod2dense *m, UINT32 i, UINT32 nb_ignore);// MC added
|
||||
UINT32 of_mod2dense_col_weight (of_mod2dense *, UINT32); // MC added
|
||||
_UINT32 of_mod2dense_row_weight (of_mod2dense *, _UINT32); // MC added
|
||||
_UINT32 of_mod2dense_row_weight_ignore_first (of_mod2dense *m, _UINT32 i, _UINT32 nb_ignore);// MC added
|
||||
_UINT32 of_mod2dense_col_weight (of_mod2dense *, _UINT32); // MC added
|
||||
|
||||
void of_mod2dense_print_stats (FILE *, of_mod2dense *);// MC added
|
||||
|
||||
//void of_mod2dense_add_row (of_mod2dense *, UINT32 , UINT32); // MC added
|
||||
//void of_mod2dense_add_row_ignore_first (of_mod2dense *, UINT32 , UINT32, UINT32); // MC added
|
||||
//void of_mod2dense_add_row (of_mod2dense *, _UINT32 , _UINT32); // MC added
|
||||
//void of_mod2dense_add_row_ignore_first (of_mod2dense *, _UINT32 , _UINT32, _UINT32); // MC added
|
||||
|
||||
void of_mod2dense_xor_rows(of_mod2dense *m, UINT16 from, UINT16 to);
|
||||
void of_mod2dense_xor_rows(of_mod2dense *m, _UINT16 from, _UINT16 to);
|
||||
#endif //OF_USE_LINEAR_BINARY_CODES_UTILS
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,8 +31,8 @@ static void of_mod2sparse_delete_opt (of_mod2sparse *, of_mod2entry *, of_mod2e
|
||||
*
|
||||
*/
|
||||
static of_mod2entry * of_mod2sparse_insert_opt (of_mod2sparse *,
|
||||
UINT32 ,
|
||||
UINT32,
|
||||
_UINT32 ,
|
||||
_UINT32,
|
||||
of_mod2entry **__parsing);
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ static of_mod2entry *of_alloc_entry (of_mod2sparse *m)
|
||||
//OF_ENTER_FUNCTION
|
||||
of_mod2block *b;
|
||||
of_mod2entry *e;
|
||||
INT32 k;
|
||||
_INT32 k;
|
||||
|
||||
if (m->next_free == 0)
|
||||
{
|
||||
@@ -71,13 +71,13 @@ static of_mod2entry *of_alloc_entry (of_mod2sparse *m)
|
||||
|
||||
/* ALLOCATE SPACE FOR A SPARSE MOD2 MATRIX. */
|
||||
|
||||
of_mod2sparse *of_mod2sparse_allocate (UINT32 n_rows, /* Number of rows in matrix */
|
||||
UINT32 n_cols) /* Number of columns in matrix */
|
||||
of_mod2sparse *of_mod2sparse_allocate (_UINT32 n_rows, /* Number of rows in matrix */
|
||||
_UINT32 n_cols) /* Number of columns in matrix */
|
||||
{
|
||||
//OF_ENTER_FUNCTION
|
||||
of_mod2sparse *m;
|
||||
of_mod2entry *e;
|
||||
INT32 i, j;
|
||||
_INT32 i, j;
|
||||
|
||||
if (n_rows <= 0 || n_cols <= 0)
|
||||
{
|
||||
@@ -150,7 +150,7 @@ void of_mod2sparse_clear (of_mod2sparse *r)
|
||||
{
|
||||
of_mod2block *b;
|
||||
of_mod2entry *e;
|
||||
INT32 i, j;
|
||||
_INT32 i, j;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
for (i = 0; i < of_mod2sparse_rows (r); i++)
|
||||
@@ -190,7 +190,7 @@ void of_mod2sparse_copy (of_mod2sparse *m, /* Matrix to copy */
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2entry *e, *f;
|
||||
INT32 i;
|
||||
_INT32 i;
|
||||
|
||||
if (of_mod2sparse_rows (m) > of_mod2sparse_rows (r)
|
||||
|| of_mod2sparse_cols (m) > of_mod2sparse_cols (r))
|
||||
@@ -219,10 +219,10 @@ void of_mod2sparse_copy (of_mod2sparse *m, /* Matrix to copy */
|
||||
|
||||
void of_mod2sparse_copyrows (of_mod2sparse *m, /* Matrix to copy */
|
||||
of_mod2sparse *r, /* Place to store copy of matrix */
|
||||
UINT32 *rows) /* Indexes of rows to copy, from 0 */
|
||||
_UINT32 *rows) /* Indexes of rows to copy, from 0 */
|
||||
{
|
||||
of_mod2entry *e;
|
||||
INT32 i;
|
||||
_INT32 i;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
if (of_mod2sparse_cols (m) > of_mod2sparse_cols (r))
|
||||
@@ -255,13 +255,13 @@ void of_mod2sparse_copyrows (of_mod2sparse *m, /* Matrix to copy */
|
||||
|
||||
void of_mod2sparse_copyrows_opt (of_mod2sparse *m, /* Matrix to copy */
|
||||
of_mod2sparse *r, /* Place to store copy of matrix */
|
||||
UINT32 *rows, /* Indexes of rows to copy, from 0 */
|
||||
_UINT32 *rows, /* Indexes of rows to copy, from 0 */
|
||||
of_mod2entry **__parsing)
|
||||
{
|
||||
of_mod2entry * __inserted;
|
||||
bool __was_null = false;
|
||||
of_mod2entry * __e;
|
||||
INT32 i;
|
||||
_INT32 i;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
if (of_mod2sparse_cols (m) > of_mod2sparse_cols (r))
|
||||
@@ -314,10 +314,10 @@ void of_mod2sparse_copyrows_opt (of_mod2sparse *m, /* Matrix to copy */
|
||||
|
||||
void of_mod2sparse_copycols (of_mod2sparse *m, /* Matrix to copy */
|
||||
of_mod2sparse *r, /* Place to store copy of matrix */
|
||||
UINT32 *cols) /* Indexes of columns to copy, from 0 */
|
||||
_UINT32 *cols) /* Indexes of columns to copy, from 0 */
|
||||
{
|
||||
of_mod2entry *e;
|
||||
INT32 j;
|
||||
_INT32 j;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
if (of_mod2sparse_rows (m) > of_mod2sparse_rows (r))
|
||||
@@ -352,12 +352,12 @@ void of_mod2sparse_copycols (of_mod2sparse *m, /* Matrix to copy */
|
||||
|
||||
void of_mod2sparse_copycols_opt (of_mod2sparse *m, /* Matrix to copy */
|
||||
of_mod2sparse *r, /* Place to store copy of matrix */
|
||||
UINT32 *cols) /* Indexes of columns to copy, from 0 */
|
||||
_UINT32 *cols) /* Indexes of columns to copy, from 0 */
|
||||
{
|
||||
of_mod2entry ** __parsing;
|
||||
of_mod2entry * __inserted;
|
||||
of_mod2entry * __e;
|
||||
INT32 j;
|
||||
_INT32 j;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
if (of_mod2sparse_rows (m) > of_mod2sparse_rows (r))
|
||||
@@ -401,35 +401,35 @@ void of_mod2sparse_copycols_opt (of_mod2sparse *m, /* Matrix to copy */
|
||||
/* PRINT matrix statistics: average number of 1's per row/line etc ...*/
|
||||
void of_mod2sparse_matrix_stats (FILE *f,
|
||||
of_mod2sparse *m,
|
||||
UINT32 nb_src ,
|
||||
UINT32 nb_par)
|
||||
_UINT32 nb_src ,
|
||||
_UINT32 nb_par)
|
||||
{
|
||||
of_mod2entry *e;
|
||||
INT32 i;
|
||||
_INT32 i;
|
||||
float density = 0;
|
||||
float row_density = 0;
|
||||
float col_density = 0;
|
||||
|
||||
/* rows stats*/
|
||||
float aver_nb_entry_per_row = 0;
|
||||
INT32 max_entry_per_row = 0;
|
||||
INT32 min_entry_per_row = 9999999;
|
||||
INT32 nb_entry_row[ROW_MAX_ENTRY];
|
||||
INT32 nb_entry_current_row = 0;
|
||||
INT32 ctr = 0;
|
||||
_INT32 max_entry_per_row = 0;
|
||||
_INT32 min_entry_per_row = 9999999;
|
||||
_INT32 nb_entry_row[ROW_MAX_ENTRY];
|
||||
_INT32 nb_entry_current_row = 0;
|
||||
_INT32 ctr = 0;
|
||||
|
||||
/* cols stats*/
|
||||
float aver_nb_entry_per_col = 0;
|
||||
INT32 max_entry_per_col = 0;
|
||||
INT32 min_entry_per_col = 9999999;
|
||||
INT32 nb_entry_col[COL_MAX_ENTRY];
|
||||
INT32 max_entry_per_data_col = 0;
|
||||
INT32 min_entry_per_data_col = 9999999;
|
||||
INT32 max_entry_per_parity_col = 0;
|
||||
INT32 min_entry_per_parity_col = 9999999;
|
||||
INT32 nb_entry_data_col[COL_MAX_ENTRY];
|
||||
INT32 nb_entry_parity_col[COL_MAX_ENTRY];
|
||||
INT32 nb_entry_current_col = 0;
|
||||
_INT32 max_entry_per_col = 0;
|
||||
_INT32 min_entry_per_col = 9999999;
|
||||
_INT32 nb_entry_col[COL_MAX_ENTRY];
|
||||
_INT32 max_entry_per_data_col = 0;
|
||||
_INT32 min_entry_per_data_col = 9999999;
|
||||
_INT32 max_entry_per_parity_col = 0;
|
||||
_INT32 min_entry_per_parity_col = 9999999;
|
||||
_INT32 nb_entry_data_col[COL_MAX_ENTRY];
|
||||
_INT32 nb_entry_parity_col[COL_MAX_ENTRY];
|
||||
_INT32 nb_entry_current_col = 0;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
/* rows stats*/
|
||||
@@ -589,12 +589,12 @@ void of_mod2sparse_matrix_stats (FILE *f,
|
||||
void of_mod2sparse_printf (FILE * fout,
|
||||
of_mod2sparse * m)
|
||||
{
|
||||
INT32 __row;
|
||||
_INT32 __row;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
for (__row = 0 ; __row < of_mod2sparse_rows (m) ; __row++)
|
||||
{
|
||||
INT32 __col;
|
||||
_INT32 __col;
|
||||
for (__col = 0 ; __col < of_mod2sparse_cols (m) ; __col++)
|
||||
{
|
||||
if (of_mod2sparse_find (m, __row, __col) != NULL)
|
||||
@@ -611,12 +611,12 @@ void of_mod2sparse_printf (FILE * fout,
|
||||
|
||||
void of_mod2sparse_print_bitmap (of_mod2sparse * m)
|
||||
{
|
||||
UINT32 i;
|
||||
UINT32 x;
|
||||
UINT32 y;
|
||||
UINT32 row;
|
||||
UINT32 col;
|
||||
UINT32 val = 1;
|
||||
_UINT32 i;
|
||||
_UINT32 x;
|
||||
_UINT32 y;
|
||||
_UINT32 row;
|
||||
_UINT32 col;
|
||||
_UINT32 val = 1;
|
||||
of_mod2entry *e;
|
||||
#ifdef IL_SUPPORT
|
||||
ILuint lImage;
|
||||
@@ -681,9 +681,9 @@ void of_mod2sparse_print
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
INT32 rdigits, cdigits;
|
||||
_INT32 rdigits, cdigits;
|
||||
of_mod2entry *e;
|
||||
INT32 i;
|
||||
_INT32 i;
|
||||
|
||||
rdigits = of_mod2sparse_rows (m) <= 10 ? 1
|
||||
: of_mod2sparse_rows (m) <= 100 ? 2
|
||||
@@ -719,14 +719,14 @@ void of_mod2sparse_print
|
||||
#if 0
|
||||
/* WRITE A SPARSE MOD2 MATRIX TO A FILE IN MACHINE-READABLE FORM. */
|
||||
|
||||
INT32 mod2sparse_write
|
||||
_INT32 mod2sparse_write
|
||||
(FILE *f,
|
||||
of_mod2sparse *m
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2entry *e;
|
||||
INT32 i;
|
||||
_INT32 i;
|
||||
|
||||
of_intio_write (f, m->n_rows);
|
||||
if (ferror (f))
|
||||
@@ -788,9 +788,9 @@ of_mod2sparse *mod2sparse_read
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
INT32 n_rows, n_cols;
|
||||
_INT32 n_rows, n_cols;
|
||||
of_mod2sparse *m;
|
||||
INT32 v, row, col;
|
||||
_INT32 v, row, col;
|
||||
|
||||
n_rows = of_intio_read (f);
|
||||
if (feof (f) || ferror (f) || n_rows <= 0)
|
||||
@@ -850,15 +850,15 @@ of_mod2sparse *mod2sparse_read
|
||||
|
||||
/* WRITE A SPARSE MOD2 MATRIX TO A FILE IN HUMAN-READABLE FORM. */
|
||||
|
||||
UINT32 of_mod2sparse_write_human_readable (FILE *f,
|
||||
_UINT32 of_mod2sparse_write_human_readable (FILE *f,
|
||||
of_mod2sparse *m,
|
||||
UINT32 nb_source,
|
||||
UINT32 nb_parity)
|
||||
_UINT32 nb_source,
|
||||
_UINT32 nb_parity)
|
||||
{
|
||||
of_mod2entry *e;
|
||||
INT32 i, col_idx, c;
|
||||
_INT32 i, col_idx, c;
|
||||
char buffer [20];
|
||||
INT32 str_length;
|
||||
_INT32 str_length;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
memset (buffer, 0, 5);
|
||||
@@ -969,15 +969,15 @@ UINT32 of_mod2sparse_write_human_readable (FILE *f,
|
||||
*/
|
||||
|
||||
of_mod2sparse *of_mod2sparse_read_human_readable (FILE *f,
|
||||
UINT32 *nb_source,
|
||||
UINT32 *nb_parity)
|
||||
_UINT32 *nb_source,
|
||||
_UINT32 *nb_parity)
|
||||
{
|
||||
UINT32 n_rows = 0;
|
||||
UINT32 n_cols = 0;
|
||||
_UINT32 n_rows = 0;
|
||||
_UINT32 n_cols = 0;
|
||||
of_mod2sparse *m;
|
||||
INT32 col;
|
||||
INT32 curent_line;
|
||||
INT32 tmp;
|
||||
_INT32 col;
|
||||
_INT32 curent_line;
|
||||
_INT32 tmp;
|
||||
char *pch;
|
||||
char line[1024];
|
||||
|
||||
@@ -1088,8 +1088,8 @@ of_mod2sparse *of_mod2sparse_read_human_readable (FILE *f,
|
||||
/* LOOK FOR AN ENTRY WITH GIVEN ROW AND COLUMN. */
|
||||
|
||||
of_mod2entry *of_mod2sparse_find (of_mod2sparse *m,
|
||||
UINT32 row,
|
||||
UINT32 col)
|
||||
_UINT32 row,
|
||||
_UINT32 col)
|
||||
{
|
||||
//OF_ENTER_FUNCTION
|
||||
of_mod2entry *re, *ce;
|
||||
@@ -1168,8 +1168,8 @@ of_mod2entry *of_mod2sparse_find (of_mod2sparse *m,
|
||||
/* INSERT AN ENTRY WITH GIVEN ROW AND COLUMN. */
|
||||
|
||||
of_mod2entry *of_mod2sparse_insert (of_mod2sparse *m,
|
||||
UINT32 row,
|
||||
UINT32 col)
|
||||
_UINT32 row,
|
||||
_UINT32 col)
|
||||
{
|
||||
//OF_ENTER_FUNCTION
|
||||
#ifndef SPARSE_MATRIX_OPT_FOR_LDPC_STAIRCASE
|
||||
@@ -1292,8 +1292,8 @@ of_mod2entry *of_mod2sparse_insert (of_mod2sparse *m,
|
||||
|
||||
|
||||
static of_mod2entry * of_mod2sparse_insert_opt (of_mod2sparse *m,
|
||||
UINT32 row,
|
||||
UINT32 col,
|
||||
_UINT32 row,
|
||||
_UINT32 col,
|
||||
of_mod2entry **__parsing)
|
||||
{
|
||||
of_mod2entry * __right_entry, * __col_entry, * __new_entry;
|
||||
@@ -1506,14 +1506,14 @@ void of_mod2sparse_delete_opt (of_mod2sparse * m,
|
||||
|
||||
/* TEST WHETHER TWO SPARSE MATRICES ARE EQUAL. */
|
||||
|
||||
INT32 mod2sparse_equal
|
||||
_INT32 mod2sparse_equal
|
||||
(of_mod2sparse *m1,
|
||||
of_mod2sparse *m2
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2entry *e1, *e2;
|
||||
INT32 i;
|
||||
_INT32 i;
|
||||
|
||||
if (of_mod2sparse_rows (m1) != of_mod2sparse_rows (m2)
|
||||
|| of_mod2sparse_cols (m1) != of_mod2sparse_cols (m2))
|
||||
@@ -1561,7 +1561,7 @@ void mod2sparse_transpose
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2entry *e;
|
||||
INT32 i;
|
||||
_INT32 i;
|
||||
|
||||
if (of_mod2sparse_rows (m) != of_mod2sparse_cols (r)
|
||||
|| of_mod2sparse_cols (m) != of_mod2sparse_rows (r))
|
||||
@@ -1606,7 +1606,7 @@ void mod2sparse_add
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2entry *e1, *e2;
|
||||
INT32 i;
|
||||
_INT32 i;
|
||||
|
||||
if (of_mod2sparse_rows (m1) != of_mod2sparse_rows (r)
|
||||
|| of_mod2sparse_cols (m1) != of_mod2sparse_cols (r)
|
||||
@@ -1681,7 +1681,7 @@ void mod2sparse_multiply
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2entry *e1, *e2;
|
||||
INT32 i, j, b;
|
||||
_INT32 i, j, b;
|
||||
|
||||
if (of_mod2sparse_cols (m1) != of_mod2sparse_rows (m2)
|
||||
|| of_mod2sparse_rows (m1) != of_mod2sparse_rows (r)
|
||||
@@ -1752,14 +1752,14 @@ void mod2sparse_multiply
|
||||
|
||||
void mod2sparse_mulvec
|
||||
(of_mod2sparse *m, /* The sparse matrix, with M rows and N columns */
|
||||
UINT8 *u, /* The input vector, N long */
|
||||
UINT8 *v /* Place to store the result, M long */
|
||||
_UINT8 *u, /* The input vector, N long */
|
||||
_UINT8 *v /* Place to store the result, M long */
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2entry *e;
|
||||
INT32 M, N;
|
||||
INT32 i, j;
|
||||
_INT32 M, N;
|
||||
_INT32 i, j;
|
||||
|
||||
M = of_mod2sparse_rows (m);
|
||||
N = of_mod2sparse_cols (m);
|
||||
@@ -1785,14 +1785,14 @@ void mod2sparse_mulvec
|
||||
|
||||
/* COUNT ENTRIES IN A ROW. */
|
||||
|
||||
UINT32 mod2sparse_count_row
|
||||
_UINT32 mod2sparse_count_row
|
||||
(of_mod2sparse *m,
|
||||
UINT32 row
|
||||
_UINT32 row
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2entry *e;
|
||||
INT32 count;
|
||||
_INT32 count;
|
||||
|
||||
if (row < 0 || row >= of_mod2sparse_rows (m))
|
||||
{
|
||||
@@ -1817,14 +1817,14 @@ UINT32 mod2sparse_count_row
|
||||
|
||||
/* COUNT ENTRIES IN A COLUMN. */
|
||||
|
||||
UINT32 mod2sparse_count_col
|
||||
_UINT32 mod2sparse_count_col
|
||||
(of_mod2sparse *m,
|
||||
UINT32 col
|
||||
_UINT32 col
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2entry *e;
|
||||
INT32 count;
|
||||
_INT32 count;
|
||||
|
||||
if (col < 0 || col >= of_mod2sparse_cols (m))
|
||||
{
|
||||
@@ -1851,9 +1851,9 @@ UINT32 mod2sparse_count_col
|
||||
|
||||
void mod2sparse_add_row
|
||||
(of_mod2sparse *m1, /* Matrix containing row to add to */
|
||||
UINT32 row1, /* Index in this matrix of row to add to */
|
||||
_UINT32 row1, /* Index in this matrix of row to add to */
|
||||
of_mod2sparse *m2, /* Matrix containing row to add from */
|
||||
UINT32 row2 /* Index in this matrix of row to add from */
|
||||
_UINT32 row2 /* Index in this matrix of row to add from */
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
@@ -1911,9 +1911,9 @@ void mod2sparse_add_row
|
||||
|
||||
void mod2sparse_add_col
|
||||
(of_mod2sparse *m1, /* Matrix containing column to add to */
|
||||
UINT32 col1, /* Index in this matrix of column to add to */
|
||||
_UINT32 col1, /* Index in this matrix of column to add to */
|
||||
of_mod2sparse *m2, /* Matrix containing column to add from */
|
||||
UINT32 col2 /* Index in this matrix of column to add from */
|
||||
_UINT32 col2 /* Index in this matrix of column to add from */
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
@@ -1969,26 +1969,26 @@ void mod2sparse_add_col
|
||||
|
||||
/* FIND AN LU DECOMPOSITION OF A SPARSE MATRIX. */
|
||||
|
||||
UINT32 mod2sparse_decomp
|
||||
_UINT32 mod2sparse_decomp
|
||||
(of_mod2sparse *A, /* Input matrix, M by N */
|
||||
UINT32 K, /* Size of sub-matrix to find LU decomposition of */
|
||||
_UINT32 K, /* Size of sub-matrix to find LU decomposition of */
|
||||
of_mod2sparse *L, /* Matrix in which L is stored, M by K */
|
||||
of_mod2sparse *U, /* Matrix in which U is stored, K by N */
|
||||
UINT32 *rows, /* Array where row indexes are stored, M long */
|
||||
UINT32 *cols, /* Array where column indexes are stored, N long */
|
||||
_UINT32 *rows, /* Array where row indexes are stored, M long */
|
||||
_UINT32 *cols, /* Array where column indexes are stored, N long */
|
||||
mod2sparse_strategy strategy, /* Strategy to follow in picking rows/columns */
|
||||
UINT32 abandon_number, /* Number of columns to abandon at some point */
|
||||
UINT32 abandon_when /* When to abandon these columns */
|
||||
_UINT32 abandon_number, /* Number of columns to abandon at some point */
|
||||
_UINT32 abandon_when /* When to abandon these columns */
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 *rinv = NULL, *cinv = NULL, *acnt = NULL, *rcnt = NULL;
|
||||
_UINT32 *rinv = NULL, *cinv = NULL, *acnt = NULL, *rcnt = NULL;
|
||||
of_mod2sparse *B = NULL;
|
||||
UINT32 M, N;
|
||||
_UINT32 M, N;
|
||||
|
||||
of_mod2entry *e = NULL, *f = NULL, *fn = NULL, *e2 = NULL;
|
||||
INT32 i = 0, j = 0, k = 0, cc = 0, cc2 = 0, cc3 = 0, cr2 = 0, pr = 0;
|
||||
INT32 found, nnf;
|
||||
_INT32 i = 0, j = 0, k = 0, cc = 0, cc2 = 0, cc3 = 0, cr2 = 0, pr = 0;
|
||||
_INT32 found, nnf;
|
||||
|
||||
M = of_mod2sparse_rows (A);
|
||||
N = of_mod2sparse_cols (A);
|
||||
@@ -2009,17 +2009,17 @@ UINT32 mod2sparse_decomp
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rinv = (UINT32*) of_calloc (M, sizeof * rinv);
|
||||
cinv = (UINT32*) of_calloc (N, sizeof * cinv);
|
||||
rinv = (_UINT32*) of_calloc (M, sizeof * rinv);
|
||||
cinv = (_UINT32*) of_calloc (N, sizeof * cinv);
|
||||
|
||||
if (abandon_number > 0)
|
||||
{
|
||||
acnt = (UINT32*) of_calloc (M + 1, sizeof * acnt);
|
||||
acnt = (_UINT32*) of_calloc (M + 1, sizeof * acnt);
|
||||
}
|
||||
|
||||
if (strategy == Mod2sparse_minprod)
|
||||
{
|
||||
rcnt = (UINT32*) of_calloc (M, sizeof * rcnt);
|
||||
rcnt = (_UINT32*) of_calloc (M, sizeof * rcnt);
|
||||
}
|
||||
|
||||
of_mod2sparse_clear (L);
|
||||
@@ -2299,15 +2299,15 @@ out_first:
|
||||
|
||||
/* SOLVE A LOWER-TRIANGULAR SYSTEM BY FORWARD SUBSTITUTION. */
|
||||
|
||||
UINT32 mod2sparse_forward_sub
|
||||
_UINT32 mod2sparse_forward_sub
|
||||
(of_mod2sparse *L, /* Matrix that is lower triangular after reordering */
|
||||
UINT32 *rows, /* Array of indexes (from 0) of rows for new order */
|
||||
UINT8 *x, /* Vector on right of equation, also reordered */
|
||||
UINT8 *y /* Place to store solution */
|
||||
_UINT32 *rows, /* Array of indexes (from 0) of rows for new order */
|
||||
_UINT8 *x, /* Vector on right of equation, also reordered */
|
||||
_UINT8 *y /* Place to store solution */
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
INT32 K, i, j, ii, b, d;
|
||||
_INT32 K, i, j, ii, b, d;
|
||||
of_mod2entry *e;
|
||||
|
||||
K = of_mod2sparse_cols (L);
|
||||
@@ -2375,15 +2375,15 @@ UINT32 mod2sparse_forward_sub
|
||||
|
||||
/* SOLVE AN UPPER-TRIANGULAR SYSTEM BY BACKWARD SUBSTITUTION. */
|
||||
|
||||
UINT32 mod2sparse_backward_sub
|
||||
_UINT32 mod2sparse_backward_sub
|
||||
(of_mod2sparse *U, /* Matrix that is upper triangular after reordering */
|
||||
UINT32 *cols, /* Array of indexes (from 0) of columns for new order */
|
||||
UINT8 *y, /* Vector on right of equation */
|
||||
UINT8 *z /* Place to store solution, also reordered */
|
||||
_UINT32 *cols, /* Array of indexes (from 0) of columns for new order */
|
||||
_UINT8 *y, /* Vector on right of equation */
|
||||
_UINT8 *z /* Place to store solution, also reordered */
|
||||
)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
INT32 K, i, j, ii, b, d;
|
||||
_INT32 K, i, j, ii, b, d;
|
||||
of_mod2entry *e;
|
||||
|
||||
K = of_mod2sparse_rows (U);
|
||||
@@ -2451,7 +2451,7 @@ UINT32 mod2sparse_backward_sub
|
||||
|
||||
#ifdef SPARSE_MATRIX_OPT_FOR_LDPC_STAIRCASE
|
||||
of_mod2entry * of_mod2sparse_last_in_col (of_mod2sparse *m,
|
||||
UINT32 i)
|
||||
_UINT32 i)
|
||||
{
|
||||
of_mod2entry *e;
|
||||
|
||||
@@ -2472,15 +2472,15 @@ of_mod2entry * of_mod2sparse_last_in_col (of_mod2sparse *m,
|
||||
//
|
||||
// Return the weight of the line row0
|
||||
//
|
||||
UINT32 of_mod2sparse_swap_rows (of_mod2sparse * m, // Matrix in which we swap two rows
|
||||
UINT32 row0, // swap row e0 and row e1
|
||||
UINT32 row1,
|
||||
_UINT32 of_mod2sparse_swap_rows (of_mod2sparse * m, // Matrix in which we swap two rows
|
||||
_UINT32 row0, // swap row e0 and row e1
|
||||
_UINT32 row1,
|
||||
of_mod2sparse *__swap,
|
||||
of_mod2entry ** __links,
|
||||
of_mod2entry **__parsing)
|
||||
{
|
||||
UINT32 row_weight;
|
||||
UINT32 __col;
|
||||
_UINT32 row_weight;
|
||||
_UINT32 __col;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
row_weight = 0;
|
||||
@@ -2488,7 +2488,7 @@ UINT32 of_mod2sparse_swap_rows (of_mod2sparse * m, // Matrix in which we swap t
|
||||
if (row0 != row1)
|
||||
{
|
||||
//of_mod2sparse * __swap;
|
||||
UINT32 __cpy[2];
|
||||
_UINT32 __cpy[2];
|
||||
of_mod2entry * e0;
|
||||
of_mod2entry * e1;
|
||||
of_mod2entry * __e, * __prev;
|
||||
@@ -2720,13 +2720,13 @@ UINT32 of_mod2sparse_swap_rows (of_mod2sparse * m, // Matrix in which we swap t
|
||||
//
|
||||
// Return the weight of the destination line
|
||||
//
|
||||
UINT32 of_mod2sparse_xor_rows (of_mod2sparse *m, // Matrix in which we swap two rows
|
||||
UINT32 row0, // xor row e0 and row e1, and set the result in row1
|
||||
UINT32 row1,
|
||||
_UINT32 of_mod2sparse_xor_rows (of_mod2sparse *m, // Matrix in which we swap two rows
|
||||
_UINT32 row0, // xor row e0 and row e1, and set the result in row1
|
||||
_UINT32 row1,
|
||||
of_mod2entry **__links,
|
||||
of_mod2entry **__parsing)
|
||||
{
|
||||
UINT32 __col;
|
||||
_UINT32 __col;
|
||||
of_mod2entry * __e0;
|
||||
of_mod2entry * __e1;
|
||||
of_mod2entry * __prev;
|
||||
@@ -2734,7 +2734,7 @@ UINT32 of_mod2sparse_xor_rows (of_mod2sparse *m, // Matrix in which we swap
|
||||
#ifdef SPARSE_MATRIX_OPT_FOR_LDPC_STAIRCASE
|
||||
of_mod2entry * __col_entry_;
|
||||
#endif
|
||||
INT32 row_weight;
|
||||
_INT32 row_weight;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
row_weight = 0;
|
||||
@@ -2965,7 +2965,7 @@ UINT32 of_mod2sparse_xor_rows (of_mod2sparse *m, // Matrix in which we swap
|
||||
}
|
||||
|
||||
|
||||
bool of_mod2sparse_empty_row (of_mod2sparse * m, UINT32 row)
|
||||
bool of_mod2sparse_empty_row (of_mod2sparse * m, _UINT32 row)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
if (of_mod2sparse_at_end_row (of_mod2sparse_first_in_row (m, row)))
|
||||
@@ -2979,7 +2979,7 @@ bool of_mod2sparse_empty_row (of_mod2sparse * m, UINT32 row)
|
||||
}
|
||||
|
||||
|
||||
bool of_mod2sparse_empty_col (of_mod2sparse * m, UINT32 col)
|
||||
bool of_mod2sparse_empty_col (of_mod2sparse * m, _UINT32 col)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
if (m != NULL)
|
||||
@@ -3001,11 +3001,11 @@ bool of_mod2sparse_empty_col (of_mod2sparse * m, UINT32 col)
|
||||
}
|
||||
|
||||
|
||||
UINT32 of_mod2sparse_weight_row (of_mod2sparse * m, UINT32 row)
|
||||
_UINT32 of_mod2sparse_weight_row (of_mod2sparse * m, _UINT32 row)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2entry * __e;
|
||||
INT32 row_weight;
|
||||
_INT32 row_weight;
|
||||
|
||||
row_weight = 0;
|
||||
|
||||
@@ -3021,11 +3021,11 @@ UINT32 of_mod2sparse_weight_row (of_mod2sparse * m, UINT32 row)
|
||||
|
||||
|
||||
#if 0
|
||||
UINT32 mod2sparse_weight_col (of_mod2sparse * m, UINT32 col)
|
||||
_UINT32 mod2sparse_weight_col (of_mod2sparse * m, _UINT32 col)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2entry * __e;
|
||||
INT32 col_weight;
|
||||
_INT32 col_weight;
|
||||
|
||||
col_weight = 0;
|
||||
__e = of_mod2sparse_first_in_col (m, col);
|
||||
@@ -3042,11 +3042,11 @@ UINT32 mod2sparse_weight_col (of_mod2sparse * m, UINT32 col)
|
||||
|
||||
void of_mod2sparse_copy_filled_matrix (of_mod2sparse *m,
|
||||
of_mod2sparse *r,
|
||||
UINT32 *index_rows,
|
||||
UINT32 *index_cols)
|
||||
_UINT32 *index_rows,
|
||||
_UINT32 *index_cols)
|
||||
{
|
||||
of_mod2entry *e;
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
|
||||
for (i = 0; i < of_mod2sparse_rows(m); i++)
|
||||
{
|
||||
|
||||
@@ -57,11 +57,11 @@ typedef struct of_mod2entry
|
||||
*/
|
||||
#ifdef SPARSE_MATRIX_OPT_SMALL_INDEXES /* memory optimization, see ldpc_profile.h */
|
||||
currently not used... otherwise remove this line...
|
||||
INT16 row;
|
||||
INT16 col;
|
||||
_INT16 row;
|
||||
_INT16 col;
|
||||
#else
|
||||
INT32 row;
|
||||
INT32 col;
|
||||
_INT32 row;
|
||||
_INT32 col;
|
||||
#endif
|
||||
/**
|
||||
* Pointers to entries adjacent in row and column, or to headers.
|
||||
@@ -96,8 +96,8 @@ typedef struct of_mod2block
|
||||
*/
|
||||
typedef struct of_mod2sparse
|
||||
{
|
||||
INT32 n_rows; /* Number of rows in the matrix */
|
||||
INT32 n_cols; /* Number of columns in the matrix */
|
||||
_INT32 n_rows; /* Number of rows in the matrix */
|
||||
_INT32 n_cols; /* Number of columns in the matrix */
|
||||
|
||||
of_mod2entry *rows; /* Pointer to array of row headers */
|
||||
of_mod2entry *cols; /* Pointer to array of column headers */
|
||||
@@ -106,7 +106,7 @@ typedef struct of_mod2sparse
|
||||
of_mod2entry *next_free; /* Next free entry */
|
||||
|
||||
#ifdef LDPC_QC
|
||||
INT32 exp_factor; /* expansion factor of the matrix, it is also the size of the circulant matrix */
|
||||
_INT32 exp_factor; /* expansion factor of the matrix, it is also the size of the circulant matrix */
|
||||
#endif
|
||||
} of_mod2sparse;
|
||||
|
||||
@@ -123,7 +123,7 @@ typedef struct of_mod2sparse
|
||||
#ifndef SPARSE_MATRIX_OPT_FOR_LDPC_STAIRCASE
|
||||
#define of_mod2sparse_last_in_col(m,j) ((m)->cols[j].up)
|
||||
#else
|
||||
of_mod2entry * of_mod2sparse_last_in_col (of_mod2sparse * m, UINT32 i); /* a bit more complex if we don't have the "up" pointer */
|
||||
of_mod2entry * of_mod2sparse_last_in_col (of_mod2sparse * m, _UINT32 i); /* a bit more complex if we don't have the "up" pointer */
|
||||
#endif
|
||||
|
||||
#define of_mod2sparse_next_in_row(e) ((e)->right) /* Move from one entry to */
|
||||
@@ -157,7 +157,7 @@ typedef enum mod2sparse_strategy_enum
|
||||
|
||||
|
||||
/* PROCEDURES TO MANIPULATE SPARSE MATRICES. */
|
||||
of_mod2sparse *of_mod2sparse_allocate (UINT32, UINT32);
|
||||
of_mod2sparse *of_mod2sparse_allocate (_UINT32, _UINT32);
|
||||
|
||||
void of_mod2sparse_free (of_mod2sparse *);
|
||||
|
||||
@@ -169,8 +169,8 @@ void of_mod2sparse_copy (of_mod2sparse *, of_mod2sparse *);
|
||||
|
||||
#if defined(ML_DECODING)
|
||||
|
||||
void of_mod2sparse_copyrows (of_mod2sparse *, of_mod2sparse *, UINT32 *);
|
||||
void of_mod2sparse_copycols (of_mod2sparse *, of_mod2sparse *, UINT32 *);
|
||||
void of_mod2sparse_copyrows (of_mod2sparse *, of_mod2sparse *, _UINT32 *);
|
||||
void of_mod2sparse_copycols (of_mod2sparse *, of_mod2sparse *, _UINT32 *);
|
||||
|
||||
/**
|
||||
* Copy a list of rows from one matrix to another.
|
||||
@@ -184,7 +184,7 @@ void of_mod2sparse_copycols (of_mod2sparse *, of_mod2sparse *, UINT32 *);
|
||||
*/
|
||||
void of_mod2sparse_copyrows_opt (of_mod2sparse * m,
|
||||
of_mod2sparse * r,
|
||||
UINT32 * rows,
|
||||
_UINT32 * rows,
|
||||
of_mod2entry ** __parsing);
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ void of_mod2sparse_copyrows_opt (of_mod2sparse * m,
|
||||
*/
|
||||
void of_mod2sparse_copycols_opt (of_mod2sparse * m,
|
||||
of_mod2sparse * r,
|
||||
UINT32 * cols);
|
||||
_UINT32 * cols);
|
||||
|
||||
#endif // #if defined(ML_DECODING)
|
||||
|
||||
@@ -216,34 +216,34 @@ void of_mod2sparse_print_bitmap (of_mod2sparse *m);
|
||||
|
||||
|
||||
#if 0
|
||||
UINT32 mod2sparse_write (FILE *, of_mod2sparse *);
|
||||
_UINT32 mod2sparse_write (FILE *, of_mod2sparse *);
|
||||
of_mod2sparse *mod2sparse_read (FILE *);
|
||||
#endif // #if 0
|
||||
|
||||
UINT32 of_mod2sparse_write_human_readable (FILE *,
|
||||
_UINT32 of_mod2sparse_write_human_readable (FILE *,
|
||||
of_mod2sparse *,
|
||||
UINT32 nb_source,
|
||||
UINT32 nb_parity);
|
||||
_UINT32 nb_source,
|
||||
_UINT32 nb_parity);
|
||||
|
||||
of_mod2sparse *of_mod2sparse_read_human_readable (FILE *f,
|
||||
UINT32 *nb_source,
|
||||
UINT32 *nb_parity);
|
||||
_UINT32 *nb_source,
|
||||
_UINT32 *nb_parity);
|
||||
|
||||
/* PRINT matrix statistics: average number of 1's per row/line etc ...*/
|
||||
|
||||
void of_mod2sparse_matrix_stats (FILE *,
|
||||
of_mod2sparse *,
|
||||
UINT32 nb_src,
|
||||
UINT32 nb_par);
|
||||
_UINT32 nb_src,
|
||||
_UINT32 nb_par);
|
||||
|
||||
|
||||
of_mod2entry *of_mod2sparse_find (of_mod2sparse *,
|
||||
UINT32,
|
||||
UINT32);
|
||||
_UINT32,
|
||||
_UINT32);
|
||||
|
||||
of_mod2entry *of_mod2sparse_insert (of_mod2sparse *,
|
||||
UINT32,
|
||||
UINT32);
|
||||
_UINT32,
|
||||
_UINT32);
|
||||
|
||||
void of_mod2sparse_delete (of_mod2sparse *,
|
||||
of_mod2entry *);
|
||||
@@ -272,9 +272,9 @@ void of_mod2sparse_delete (of_mod2sparse *,
|
||||
*
|
||||
* @return The hamming weight of the new row0 line
|
||||
*/
|
||||
UINT32 of_mod2sparse_swap_rows (of_mod2sparse * m,
|
||||
UINT32 row0,
|
||||
UINT32 row1,
|
||||
_UINT32 of_mod2sparse_swap_rows (of_mod2sparse * m,
|
||||
_UINT32 row0,
|
||||
_UINT32 row1,
|
||||
of_mod2sparse * __swapMatrix,
|
||||
of_mod2entry ** __links,
|
||||
of_mod2entry ** __parsing);
|
||||
@@ -295,8 +295,8 @@ UINT32 of_mod2sparse_swap_rows (of_mod2sparse * m,
|
||||
*
|
||||
* @return The hamming weight of the new row1 line
|
||||
*/
|
||||
UINT32 of_mod2sparse_xor_rows (of_mod2sparse * m,
|
||||
UINT32 row0, UINT32 row1,
|
||||
_UINT32 of_mod2sparse_xor_rows (of_mod2sparse * m,
|
||||
_UINT32 row0, _UINT32 row1,
|
||||
of_mod2entry ** __links,
|
||||
of_mod2entry ** __parsing);
|
||||
|
||||
@@ -308,7 +308,7 @@ UINT32 of_mod2sparse_xor_rows (of_mod2sparse * m,
|
||||
*
|
||||
* @return TRUE if the row is empty, else FALSE
|
||||
*/
|
||||
bool of_mod2sparse_empty_row (of_mod2sparse * m, UINT32 row);
|
||||
bool of_mod2sparse_empty_row (of_mod2sparse * m, _UINT32 row);
|
||||
|
||||
|
||||
/**
|
||||
@@ -319,7 +319,7 @@ bool of_mod2sparse_empty_row (of_mod2sparse * m, UINT32 row);
|
||||
*
|
||||
* @return TRUE if the row is empty, else FALSE
|
||||
*/
|
||||
bool of_mod2sparse_empty_col (of_mod2sparse * m, UINT32 col);
|
||||
bool of_mod2sparse_empty_col (of_mod2sparse * m, _UINT32 col);
|
||||
|
||||
|
||||
/**
|
||||
@@ -330,7 +330,7 @@ bool of_mod2sparse_empty_col (of_mod2sparse * m, UINT32 col);
|
||||
*
|
||||
* @return The weight of the row
|
||||
*/
|
||||
UINT32 of_mod2sparse_weight_row (of_mod2sparse * m, UINT32 row);
|
||||
_UINT32 of_mod2sparse_weight_row (of_mod2sparse * m, _UINT32 row);
|
||||
|
||||
|
||||
#if 0
|
||||
@@ -342,7 +342,7 @@ UINT32 of_mod2sparse_weight_row (of_mod2sparse * m, UINT32 row);
|
||||
*
|
||||
* @return The weight of the col
|
||||
*/
|
||||
UINT32 mod2sparse_weight_col (of_mod2sparse * m, UINT32 col);
|
||||
_UINT32 mod2sparse_weight_col (of_mod2sparse * m, _UINT32 col);
|
||||
#endif
|
||||
|
||||
#endif // defined(ML_DECODING)
|
||||
@@ -351,28 +351,28 @@ UINT32 mod2sparse_weight_col (of_mod2sparse * m, UINT32 col);
|
||||
void mod2sparse_transpose (of_mod2sparse *, of_mod2sparse *);
|
||||
void mod2sparse_add (of_mod2sparse *, of_mod2sparse *, of_mod2sparse *);
|
||||
void mod2sparse_multiply (of_mod2sparse *, of_mod2sparse *, of_mod2sparse *);
|
||||
void mod2sparse_mulvec (of_mod2sparse *, UINT8 *, UINT8 *);
|
||||
void mod2sparse_mulvec (of_mod2sparse *, _UINT8 *, _UINT8 *);
|
||||
|
||||
UINT32 mod2sparse_equal (of_mod2sparse *, of_mod2sparse *);
|
||||
_UINT32 mod2sparse_equal (of_mod2sparse *, of_mod2sparse *);
|
||||
|
||||
UINT32 mod2sparse_count_row (of_mod2sparse *, UINT32);
|
||||
UINT32 mod2sparse_count_col (of_mod2sparse *, UINT32);
|
||||
_UINT32 mod2sparse_count_row (of_mod2sparse *, _UINT32);
|
||||
_UINT32 mod2sparse_count_col (of_mod2sparse *, _UINT32);
|
||||
|
||||
void mod2sparse_add_row (of_mod2sparse *, UINT32, of_mod2sparse *, UINT32);
|
||||
void mod2sparse_add_col (of_mod2sparse *, UINT32, of_mod2sparse *, UINT32);
|
||||
void mod2sparse_add_row (of_mod2sparse *, _UINT32, of_mod2sparse *, _UINT32);
|
||||
void mod2sparse_add_col (of_mod2sparse *, _UINT32, of_mod2sparse *, _UINT32);
|
||||
|
||||
UINT32 mod2sparse_decomp (of_mod2sparse *, UINT32, of_mod2sparse *, of_mod2sparse *,
|
||||
UINT32 *, UINT32 *, mod2sparse_strategy,UINT32, UINT32);
|
||||
_UINT32 mod2sparse_decomp (of_mod2sparse *, _UINT32, of_mod2sparse *, of_mod2sparse *,
|
||||
_UINT32 *, _UINT32 *, mod2sparse_strategy,_UINT32, _UINT32);
|
||||
|
||||
UINT32 mod2sparse_forward_sub (of_mod2sparse *, UINT32 *, UINT8 *, UINT8 *);
|
||||
UINT32 mod2sparse_backward_sub (of_mod2sparse *, UINT32 *, UINT8 *, UINT8 *);
|
||||
_UINT32 mod2sparse_forward_sub (of_mod2sparse *, _UINT32 *, _UINT8 *, _UINT8 *);
|
||||
_UINT32 mod2sparse_backward_sub (of_mod2sparse *, _UINT32 *, _UINT8 *, _UINT8 *);
|
||||
#endif
|
||||
|
||||
/* copy only filled rows and cols from m to r */
|
||||
void of_mod2sparse_copy_filled_matrix (of_mod2sparse *m,
|
||||
of_mod2sparse *r,
|
||||
UINT32 *index_rows,
|
||||
UINT32 *index_cols);
|
||||
_UINT32 *index_rows,
|
||||
_UINT32 *index_cols);
|
||||
|
||||
#endif /* #ifndef OF_LDPC_MATRIX_SPARSE__ */
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
and then displays an error message and exits if the space couldn't be
|
||||
found. */
|
||||
|
||||
void *of_chk_alloc (UINT32 n, /* Number of elements */
|
||||
UINT32 size) /* Size of each element */
|
||||
void *of_chk_alloc (_UINT32 n, /* Number of elements */
|
||||
_UINT32 size) /* Size of each element */
|
||||
{
|
||||
void *p;
|
||||
|
||||
@@ -78,11 +78,11 @@ void *of_chk_alloc (UINT32 n, /* Number of elements */
|
||||
The file read from should have been opened as "binary".
|
||||
*/
|
||||
|
||||
INT32 of_intio_read (FILE *f) /* File to read from */
|
||||
_INT32 of_intio_read (FILE *f) /* File to read from */
|
||||
{
|
||||
UINT8 b[4];
|
||||
INT32 top;
|
||||
INT32 i;
|
||||
_UINT8 b[4];
|
||||
_INT32 top;
|
||||
_INT32 i;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
for (i = 0; i < 4; i++)
|
||||
@@ -93,7 +93,7 @@ INT32 of_intio_read (FILE *f) /* File to read from */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
top = b[3] > 127 ? (INT32) b[3] - 256 : b[3];
|
||||
top = b[3] > 127 ? (_INT32) b[3] - 256 : b[3];
|
||||
OF_EXIT_FUNCTION
|
||||
return (top << 24) + (b[2] << 16) + (b[1] << 8) + b[0];
|
||||
}
|
||||
@@ -108,10 +108,10 @@ INT32 of_intio_read (FILE *f) /* File to read from */
|
||||
*/
|
||||
|
||||
void of_intio_write (FILE *f, /* File to write to */
|
||||
INT32 v) /* Value to write to file */
|
||||
_INT32 v) /* Value to write to file */
|
||||
{
|
||||
UINT8 b;
|
||||
INT32 i;
|
||||
_UINT8 b;
|
||||
_INT32 i;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
for (i = 0; i < 3; i++)
|
||||
@@ -127,9 +127,9 @@ void of_intio_write (FILE *f, /* File to write to */
|
||||
#endif
|
||||
|
||||
|
||||
void of_print_composition (char* symbol, UINT32 size)
|
||||
void of_print_composition (char* symbol, _UINT32 size)
|
||||
{
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
for (i = 0;i < size;i++)
|
||||
|
||||
@@ -47,23 +47,23 @@
|
||||
/**
|
||||
* Call calloc and exits with an error if it fails
|
||||
*/
|
||||
void * of_chk_alloc (UINT32 n,
|
||||
UINT32 size);
|
||||
void * of_chk_alloc (_UINT32 n,
|
||||
_UINT32 size);
|
||||
|
||||
/**
|
||||
*/
|
||||
void of_print_composition (char* symbol,
|
||||
UINT32 size);
|
||||
_UINT32 size);
|
||||
|
||||
/**
|
||||
* Read an integer
|
||||
*/
|
||||
INT32 of_intio_read (FILE *);
|
||||
_INT32 of_intio_read (FILE *);
|
||||
|
||||
/**
|
||||
* Write an integer
|
||||
*/
|
||||
void of_intio_write (FILE *, INT32);
|
||||
void of_intio_write (FILE *, _INT32);
|
||||
|
||||
|
||||
#endif //OF_USE_LINEAR_BINARY_CODES_UTILS
|
||||
|
||||
@@ -39,18 +39,18 @@
|
||||
|
||||
of_status_t of_linear_binary_code_decode_with_new_symbol (of_linear_binary_code_cb_t* ofcb,
|
||||
void* new_symbol,
|
||||
UINT32 new_symbol_esi)
|
||||
_UINT32 new_symbol_esi)
|
||||
{
|
||||
of_mod2entry *e = NULL; // entry ("1") in parity check matrix
|
||||
of_mod2entry *mod_entry_to_delete; // temp: entry to delete in row/column
|
||||
void *const_term; // temp: pointer to constant term, containing the sum of
|
||||
// all the known symbols of this equation
|
||||
UINT32 row; // temp: current row value
|
||||
UINT32 *table_of_check_deg_1 = NULL; // table of check nodes of degree
|
||||
_UINT32 row; // temp: current row value
|
||||
_UINT32 *table_of_check_deg_1 = NULL; // table of check nodes of degree
|
||||
// one after the processing of new_symbol
|
||||
INT32 table_of_check_deg_1_nb = 0; // number of entries in table
|
||||
UINT32 size_of_table_of_check_deg_1 = 0; // size of the memory block
|
||||
UINT32 decoded_symbol_esi; // sequence number of decoded symbol
|
||||
_INT32 table_of_check_deg_1_nb = 0; // number of entries in table
|
||||
_UINT32 size_of_table_of_check_deg_1 = 0; // size of the memory block
|
||||
_UINT32 decoded_symbol_esi; // sequence number of decoded symbol
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
ASSERT(ofcb);
|
||||
@@ -139,7 +139,7 @@ of_status_t of_linear_binary_code_decode_with_new_symbol (of_linear_binary_code_
|
||||
{
|
||||
mod_entry_to_delete = e;
|
||||
of_mod2entry *tmp_e; // current symbol in this equation
|
||||
UINT32 tmp_esi; // corresponding esi
|
||||
_UINT32 tmp_esi; // corresponding esi
|
||||
void *tmp_symbol; // corresponding symbol pointer
|
||||
|
||||
// there's a partial sum for this row...
|
||||
@@ -219,7 +219,7 @@ of_status_t of_linear_binary_code_decode_with_new_symbol (of_linear_binary_code_
|
||||
{
|
||||
// allocate memory for the table first
|
||||
size_of_table_of_check_deg_1 = 4;
|
||||
if ((table_of_check_deg_1 = (UINT32*) of_calloc (size_of_table_of_check_deg_1, sizeof (UINT32*))) == NULL)
|
||||
if ((table_of_check_deg_1 = (_UINT32*) of_calloc (size_of_table_of_check_deg_1, sizeof (_UINT32*))) == NULL)
|
||||
{
|
||||
goto no_mem;
|
||||
}
|
||||
@@ -228,7 +228,7 @@ of_status_t of_linear_binary_code_decode_with_new_symbol (of_linear_binary_code_
|
||||
{
|
||||
// not enough size in table, add some more
|
||||
size_of_table_of_check_deg_1 += 4;
|
||||
if ((table_of_check_deg_1 = (UINT32*) of_realloc (table_of_check_deg_1, size_of_table_of_check_deg_1 * sizeof (UINT32*))) == NULL)
|
||||
if ((table_of_check_deg_1 = (_UINT32*) of_realloc (table_of_check_deg_1, size_of_table_of_check_deg_1 * sizeof (_UINT32*))) == NULL)
|
||||
{
|
||||
goto no_mem;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_linear_binary_code_decode_with_new_symbol (of_linear_binary_code_cb_t* ofcb, void* const new_symbol_buf, UINT32 new_symbol_esi)
|
||||
* @fn of_status_t of_linear_binary_code_decode_with_new_symbol (of_linear_binary_code_cb_t* ofcb, void* const new_symbol_buf, _UINT32 new_symbol_esi)
|
||||
* @brief (try to) decode with a newly received symbol
|
||||
* @param ofcb (IN) Pointer to the linear binary code control block.
|
||||
* @param new_symbol (IN) Pointer to the encoding symbol now available (i.e. a new
|
||||
@@ -49,7 +49,7 @@
|
||||
* @param new_symbol_esi (IN) Encoding symbol ID of the newly symbol available, in {0..n-1}.
|
||||
* @return Error status (NB: this function does not return OF_STATUS_FAILURE).
|
||||
*/
|
||||
of_status_t of_linear_binary_code_decode_with_new_symbol(of_linear_binary_code_cb_t* ofcb,void* new_symbol,UINT32 new_symbol_esi);
|
||||
of_status_t of_linear_binary_code_decode_with_new_symbol(of_linear_binary_code_cb_t* ofcb,void* new_symbol,_UINT32 new_symbol_esi);
|
||||
|
||||
#endif //OF_USE_LINEAR_BINARY_CODES_UTILS
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ of_linear_binary_code_prepar_linear_system (of_linear_binary_code_cb_t *ofcb);
|
||||
static of_status_t
|
||||
of_linear_binary_code_simplify_linear_system_with_a_symbol (of_linear_binary_code_cb_t *ofcb,
|
||||
const void *new_symbol,
|
||||
UINT32 new_symbol_esi);
|
||||
_UINT32 new_symbol_esi);
|
||||
|
||||
/**
|
||||
* This function creates the simplified linear system, considering only the non empty columns.
|
||||
@@ -88,13 +88,13 @@ of_linear_binary_code_create_simplified_linear_system (of_linear_binary_code_cb_
|
||||
of_status_t
|
||||
of_linear_binary_code_finish_decoding_with_ml (of_linear_binary_code_cb_t *ofcb)
|
||||
{
|
||||
INT32 i;
|
||||
UINT32 *permutation_array = NULL;
|
||||
_INT32 i;
|
||||
_UINT32 *permutation_array = NULL;
|
||||
of_mod2dense *dense_pchk_matrix_simplified = NULL;
|
||||
INT32 *column_idx = NULL;
|
||||
_INT32 *column_idx = NULL;
|
||||
void **const_term = NULL;
|
||||
void **variable_member = NULL;
|
||||
UINT32 nb_computed_repair_in_ml;
|
||||
_UINT32 nb_computed_repair_in_ml;
|
||||
#ifdef DEBUG
|
||||
struct timeval gdtv0; /* start */
|
||||
struct timeval gdtv1; /* end */
|
||||
@@ -147,15 +147,15 @@ of_linear_binary_code_finish_decoding_with_ml (of_linear_binary_code_cb_t *ofcb)
|
||||
* Inject all known repair symbols
|
||||
*/
|
||||
/* Randomize the repair symbols order before injecting them (it makes the decoding process more efficient). */
|
||||
permutation_array = (UINT32 *) of_malloc (ofcb->nb_repair_symbols * sizeof(UINT32));
|
||||
permutation_array = (_UINT32 *) of_malloc (ofcb->nb_repair_symbols * sizeof(_UINT32));
|
||||
for (i = 0 ; i < ofcb->nb_repair_symbols ; i++)
|
||||
{
|
||||
permutation_array[i] = i;
|
||||
}
|
||||
for (i = 0 ; i < ofcb->nb_repair_symbols ; i++)
|
||||
{
|
||||
INT32 backup;
|
||||
INT32 rand_val;
|
||||
_INT32 backup;
|
||||
_INT32 rand_val;
|
||||
|
||||
backup = permutation_array[i];
|
||||
rand_val = rand() % ofcb->nb_repair_symbols;
|
||||
@@ -200,7 +200,7 @@ of_linear_binary_code_finish_decoding_with_ml (of_linear_binary_code_cb_t *ofcb)
|
||||
gettimeofday (&gdtv0, NULL);
|
||||
OF_TRACE_LVL (1, ("gauss_decoding_start=%ld.%ld\n", gdtv0.tv_sec, gdtv0.tv_usec))
|
||||
#endif
|
||||
if ((column_idx = (INT32 *) of_malloc (of_mod2dense_cols (dense_pchk_matrix_simplified) * sizeof (INT32))) == NULL)
|
||||
if ((column_idx = (_INT32 *) of_malloc (of_mod2dense_cols (dense_pchk_matrix_simplified) * sizeof (_INT32))) == NULL)
|
||||
{
|
||||
goto no_mem;
|
||||
}
|
||||
@@ -327,17 +327,17 @@ no_mem:
|
||||
of_status_t
|
||||
of_linear_binary_code_prepar_linear_system (of_linear_binary_code_cb_t *ofcb)
|
||||
{
|
||||
INT32 _row;
|
||||
INT32 _col;
|
||||
_INT32 _row;
|
||||
_INT32 _col;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
if (ofcb->index_rows == NULL)
|
||||
{
|
||||
ofcb->index_rows = (UINT32*) of_calloc (ofcb->nb_repair_symbols, sizeof (UINT32));
|
||||
ofcb->index_rows = (_UINT32*) of_calloc (ofcb->nb_repair_symbols, sizeof (_UINT32));
|
||||
}
|
||||
if (ofcb->index_cols == NULL)
|
||||
{
|
||||
ofcb->index_cols = (UINT32*) of_calloc (ofcb->nb_total_symbols, sizeof (UINT32));
|
||||
ofcb->index_cols = (_UINT32*) of_calloc (ofcb->nb_total_symbols, sizeof (_UINT32));
|
||||
}
|
||||
for (_row = 0; _row < ofcb->nb_repair_symbols; _row++)
|
||||
{
|
||||
@@ -370,11 +370,11 @@ of_linear_binary_code_prepar_linear_system (of_linear_binary_code_cb_t *ofcb)
|
||||
static of_status_t
|
||||
of_linear_binary_code_simplify_linear_system_with_a_symbol (of_linear_binary_code_cb_t *ofcb,
|
||||
const void *new_symbol,
|
||||
UINT32 new_symbol_esi)
|
||||
_UINT32 new_symbol_esi)
|
||||
{
|
||||
of_mod2entry *_e; // entry ("1") in parity check matrix and entry to delete in row/column (temp)
|
||||
of_mod2entry *_del_me;
|
||||
INT32 _row;
|
||||
_INT32 _row;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
if (of_mod2sparse_empty_col (ofcb->pchk_matrix, of_get_symbol_col((of_cb_t*)ofcb, new_symbol_esi)))
|
||||
@@ -422,7 +422,7 @@ of_linear_binary_code_simplify_linear_system_with_a_symbol (of_linear_binary_cod
|
||||
if (ofcb->tab_nb_unknown_symbols[_row] == 1)
|
||||
{
|
||||
of_mod2entry *__r;
|
||||
UINT32 decoded_symbol_seqno;
|
||||
_UINT32 decoded_symbol_seqno;
|
||||
|
||||
// Get the only one symbol in the equation
|
||||
__r = of_mod2sparse_first_in_row (ofcb->pchk_matrix, _row);
|
||||
@@ -512,32 +512,32 @@ no_mem:
|
||||
|
||||
of_status_t of_linear_binary_code_create_simplified_linear_system (of_linear_binary_code_cb_t *ofcb)
|
||||
{
|
||||
INT32 _row;
|
||||
INT32 _col;
|
||||
_INT32 _row;
|
||||
_INT32 _col;
|
||||
of_mod2sparse *__pchk_matrix_simplified_cols;
|
||||
UINT32 *index_rows;
|
||||
UINT32 *index_cols;
|
||||
_UINT32 *index_rows;
|
||||
_UINT32 *index_cols;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
ofcb->remain_rows = 0;
|
||||
ofcb->remain_cols = 0;
|
||||
if (ofcb->index_rows == NULL)
|
||||
{
|
||||
if ((ofcb->index_rows = (UINT32 *) of_calloc (ofcb->nb_repair_symbols, sizeof (UINT32))) == NULL)
|
||||
if ((ofcb->index_rows = (_UINT32 *) of_calloc (ofcb->nb_repair_symbols, sizeof (_UINT32))) == NULL)
|
||||
{
|
||||
goto no_mem;
|
||||
}
|
||||
}
|
||||
if (ofcb->index_cols == NULL)
|
||||
{
|
||||
if ((ofcb->index_cols = (UINT32 *) of_calloc (ofcb->nb_total_symbols - ofcb->nb_repair_symbol_ready - ofcb->nb_source_symbol_ready,
|
||||
sizeof (UINT32))) == NULL)
|
||||
if ((ofcb->index_cols = (_UINT32 *) of_calloc (ofcb->nb_total_symbols - ofcb->nb_repair_symbol_ready - ofcb->nb_source_symbol_ready,
|
||||
sizeof (_UINT32))) == NULL)
|
||||
{
|
||||
goto no_mem;
|
||||
}
|
||||
}
|
||||
index_rows = (UINT32*) of_malloc(ofcb->nb_repair_symbols * sizeof(UINT32));
|
||||
index_cols = (UINT32*) of_malloc(ofcb->nb_total_symbols * sizeof(UINT32));
|
||||
index_rows = (_UINT32*) of_malloc(ofcb->nb_repair_symbols * sizeof(_UINT32));
|
||||
index_cols = (_UINT32*) of_malloc(ofcb->nb_total_symbols * sizeof(_UINT32));
|
||||
if ((index_rows == NULL) || (index_cols == NULL))
|
||||
{
|
||||
goto no_mem;
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
* @param ofcb (IN) Linear-Binary-Code control-block.
|
||||
* @return 1 if it's OK, or 0 if an error took place.
|
||||
*/
|
||||
static INT32
|
||||
static _INT32
|
||||
of_linear_binary_code_triangularize_dense_system (of_linear_binary_code_cb_t *ofcb,
|
||||
of_mod2dense *m,
|
||||
void **constant_tab);
|
||||
@@ -68,11 +68,11 @@ of_linear_binary_code_triangularize_dense_system (of_linear_binary_code_cb_t *of
|
||||
* @param stats (IN)
|
||||
* @return 1 if it's OK, or 0 if an error took place.
|
||||
*/
|
||||
static INT32
|
||||
static _INT32
|
||||
of_linear_binary_code_col_forward_elimination (of_linear_binary_code_cb_t *ofcb,
|
||||
of_mod2dense *m,
|
||||
void **constant_tab,
|
||||
INT32 col_idx);
|
||||
_INT32 col_idx);
|
||||
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,7 @@ of_linear_binary_code_col_forward_elimination (of_linear_binary_code_cb_t *ofcb
|
||||
* @param ofcb (IN/OUT) Linear-Binary-Code control-block.
|
||||
* @return 1 if it's OK, or 0 if an error took place.
|
||||
*/
|
||||
static INT32
|
||||
static _INT32
|
||||
of_linear_binary_code_backward_substitution (of_linear_binary_code_cb_t *ofcb,
|
||||
of_mod2dense *m,
|
||||
void *variable_tab[],
|
||||
@@ -131,11 +131,11 @@ of_linear_binary_code_solve_dense_system (of_linear_binary_code_cb_t *ofcb,
|
||||
|
||||
|
||||
static
|
||||
INT32 of_linear_binary_code_triangularize_dense_system (of_linear_binary_code_cb_t *ofcb,
|
||||
_INT32 of_linear_binary_code_triangularize_dense_system (of_linear_binary_code_cb_t *ofcb,
|
||||
of_mod2dense *m,
|
||||
void **constant_tab)
|
||||
{
|
||||
INT32 i, n;
|
||||
_INT32 i, n;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
n = of_mod2dense_cols (m);
|
||||
@@ -154,19 +154,19 @@ INT32 of_linear_binary_code_triangularize_dense_system (of_linear_binary_code_cb
|
||||
|
||||
|
||||
static
|
||||
INT32 of_linear_binary_code_col_forward_elimination (of_linear_binary_code_cb_t *ofcb,
|
||||
_INT32 of_linear_binary_code_col_forward_elimination (of_linear_binary_code_cb_t *ofcb,
|
||||
of_mod2dense *m,
|
||||
void **constant_tab,
|
||||
INT32 col_idx)
|
||||
_INT32 col_idx)
|
||||
{
|
||||
of_mod2word *s;
|
||||
of_mod2word *t;
|
||||
INT32 i, j, k;
|
||||
INT32 n, p;
|
||||
INT32 w;
|
||||
INT32 w0;
|
||||
INT32 b0;
|
||||
INT32 symbol_size;
|
||||
_INT32 i, j, k;
|
||||
_INT32 n, p;
|
||||
_INT32 w;
|
||||
_INT32 w0;
|
||||
_INT32 b0;
|
||||
_INT32 symbol_size;
|
||||
void *tmp_buffer;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
@@ -271,16 +271,16 @@ INT32 of_linear_binary_code_col_forward_elimination (of_linear_binary_code_cb_t
|
||||
|
||||
/* old trivial backward substitution algorithm. */
|
||||
static
|
||||
INT32 of_linear_binary_code_backward_substitution (of_linear_binary_code_cb_t *ofcb,
|
||||
_INT32 of_linear_binary_code_backward_substitution (of_linear_binary_code_cb_t *ofcb,
|
||||
of_mod2dense *m,
|
||||
void *variable_tab[],
|
||||
void *constant_tab[])
|
||||
{
|
||||
INT32 i; /* current variable index for which we apply backward substition. It's also the row index. */
|
||||
INT32 j; /* */
|
||||
INT32 n;
|
||||
INT32 w0; /* dense matrix word index for variable j */
|
||||
INT32 b0; /* dense matrix bit index in word of index w0 */
|
||||
_INT32 i; /* current variable index for which we apply backward substition. It's also the row index. */
|
||||
_INT32 j; /* */
|
||||
_INT32 n;
|
||||
_INT32 w0; /* dense matrix word index for variable j */
|
||||
_INT32 b0; /* dense matrix bit index in word of index w0 */
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
n = of_mod2dense_cols (m);
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#ifdef ML_DECODING
|
||||
|
||||
#ifdef OF_DEBUG
|
||||
#define OP_ARGS ,UINT32* op
|
||||
#define OP_ARGS ,_UINT32* op
|
||||
#define OP_ARG_VAL ,&(ofcb->stats_xor->nb_xor_for_ML)
|
||||
#else
|
||||
#define OP_ARGS
|
||||
@@ -52,7 +52,7 @@
|
||||
* This function solves the system: first triangularize the system, then for each column,
|
||||
* do a forward elimination, then do the backward elimination.
|
||||
*
|
||||
* @fn INT32 of_linear_binary_code_solve_dense_system (of_mod2dense *m,void ** constant_member,void **variables,of_linear_binary_code_cb_t *ofcb)
|
||||
* @fn _INT32 of_linear_binary_code_solve_dense_system (of_mod2dense *m,void ** constant_member,void **variables,of_linear_binary_code_cb_t *ofcb)
|
||||
* @brief solves the system
|
||||
* @param m (IN/OUT) address of the dense matrix.
|
||||
* @param variables
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
#include "of_linear_binary_code.h"
|
||||
|
||||
|
||||
of_mod2sparse* of_create_pchk_matrix (UINT32 nb_rows,
|
||||
UINT32 nb_cols,
|
||||
of_mod2sparse* of_create_pchk_matrix (_UINT32 nb_rows,
|
||||
_UINT32 nb_cols,
|
||||
make_method make_method,
|
||||
UINT32 left_degree,
|
||||
UINT32 seed,
|
||||
_UINT32 left_degree,
|
||||
_UINT32 seed,
|
||||
bool no4cycle,
|
||||
of_session_type type,
|
||||
UINT8 verbosity)
|
||||
_UINT8 verbosity)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2sparse* m;
|
||||
@@ -48,20 +48,20 @@ of_mod2sparse* of_create_pchk_matrix (UINT32 nb_rows,
|
||||
}
|
||||
|
||||
|
||||
of_mod2sparse* of_create_pchk_matrix_general (UINT32 nb_rows,
|
||||
UINT32 nb_cols,
|
||||
of_mod2sparse* of_create_pchk_matrix_general (_UINT32 nb_rows,
|
||||
_UINT32 nb_cols,
|
||||
make_method make_method,
|
||||
UINT32 left_degree,
|
||||
UINT32 seed,
|
||||
_UINT32 left_degree,
|
||||
_UINT32 seed,
|
||||
bool no4cycle,
|
||||
of_session_type type,
|
||||
UINT8 verbosity)
|
||||
_UINT8 verbosity)
|
||||
{
|
||||
UINT32 row_start = 0;
|
||||
UINT32 row_end = 0;
|
||||
UINT32 col_start = 0;
|
||||
UINT32 col_end = 0;
|
||||
INT32 i;
|
||||
_UINT32 row_start = 0;
|
||||
_UINT32 row_end = 0;
|
||||
_UINT32 col_start = 0;
|
||||
_UINT32 col_end = 0;
|
||||
_INT32 i;
|
||||
of_mod2sparse *pchkMatrix = NULL;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
@@ -129,10 +129,10 @@ of_mod2sparse* of_create_pchk_matrix_general (UINT32 nb_rows,
|
||||
}
|
||||
|
||||
|
||||
of_mod2sparse* of_create_2D_pchk_matrix (UINT32 nb_rows,
|
||||
UINT32 nb_cols,
|
||||
of_mod2sparse* of_create_2D_pchk_matrix (_UINT32 nb_rows,
|
||||
_UINT32 nb_cols,
|
||||
of_session_type type,
|
||||
UINT8 verbosity)
|
||||
_UINT8 verbosity)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2sparse *pchkMatrix;
|
||||
@@ -163,12 +163,12 @@ error:
|
||||
|
||||
|
||||
of_mod2sparse* of_fill_2D_pchk_matrix (of_mod2sparse *m,
|
||||
UINT32 d,
|
||||
UINT32 l,
|
||||
UINT8 verbosity)
|
||||
_UINT32 d,
|
||||
_UINT32 l,
|
||||
_UINT8 verbosity)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 i, j;
|
||||
_UINT32 i, j;
|
||||
|
||||
for (i = 0; i < (l+d); i++)
|
||||
{
|
||||
@@ -197,21 +197,21 @@ of_mod2sparse* of_fill_2D_pchk_matrix (of_mod2sparse *m,
|
||||
|
||||
|
||||
of_mod2sparse* of_fill_regular_pchk_matrix (of_mod2sparse *m,
|
||||
UINT32 row_start,
|
||||
UINT32 row_end,
|
||||
UINT32 col_start,
|
||||
UINT32 col_end,
|
||||
_UINT32 row_start,
|
||||
_UINT32 row_end,
|
||||
_UINT32 col_start,
|
||||
_UINT32 col_end,
|
||||
make_method make_method,
|
||||
UINT32 left_degree,
|
||||
_UINT32 left_degree,
|
||||
bool no4cycle,
|
||||
UINT8 verbosity)
|
||||
_UINT8 verbosity)
|
||||
{
|
||||
of_mod2entry *e;
|
||||
UINT32 added, uneven;
|
||||
INT32 i, j, k, t;
|
||||
UINT32 *u;
|
||||
_UINT32 added, uneven;
|
||||
_INT32 i, j, k, t;
|
||||
_UINT32 *u;
|
||||
of_mod2sparse *pchkMatrix = m;
|
||||
UINT32 nb_col, nb_row;
|
||||
_UINT32 nb_col, nb_row;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
nb_col = col_end - col_start;
|
||||
@@ -236,7 +236,7 @@ of_mod2sparse* of_fill_regular_pchk_matrix (of_mod2sparse *m,
|
||||
break;
|
||||
|
||||
case Evenboth:
|
||||
u = (UINT32*) of_calloc (left_degree * nb_col, sizeof * u);
|
||||
u = (_UINT32*) of_calloc (left_degree * nb_col, sizeof * u);
|
||||
|
||||
/* initialize a list of possible choices to guarantee a homogeneous "1" distribution */
|
||||
for (k = left_degree * nb_col - 1; k >= 0; k--)
|
||||
@@ -325,7 +325,7 @@ of_mod2sparse* of_fill_regular_pchk_matrix (of_mod2sparse *m,
|
||||
/* Add extra bits to try to avoid problems with even column counts. */
|
||||
if (left_degree % 2 == 0 && left_degree < nb_row && nb_col > 1 && added < 2)
|
||||
{
|
||||
UINT32 a;
|
||||
_UINT32 a;
|
||||
for (a = 0; added + a < 2; a++)
|
||||
{
|
||||
do
|
||||
|
||||
@@ -61,14 +61,14 @@ typedef enum SessionType_enum
|
||||
* @param stats (IN/OUT) memory statistics (can be NULL)
|
||||
* @return pointer to the matrix
|
||||
*/
|
||||
of_mod2sparse* of_create_pchk_matrix (UINT32 nb_rows,
|
||||
UINT32 nb_cols,
|
||||
of_mod2sparse* of_create_pchk_matrix (_UINT32 nb_rows,
|
||||
_UINT32 nb_cols,
|
||||
make_method make_method,
|
||||
UINT32 left_degree,
|
||||
UINT32 seed,
|
||||
_UINT32 left_degree,
|
||||
_UINT32 seed,
|
||||
bool no4cycle,
|
||||
of_session_type type,
|
||||
UINT8 verbosity);
|
||||
_UINT8 verbosity);
|
||||
|
||||
/**
|
||||
* This function creates a generic parity check matrix.
|
||||
@@ -85,14 +85,14 @@ of_mod2sparse* of_create_pchk_matrix (UINT32 nb_rows,
|
||||
* @param stats (IN/OUT) memory statistics (can be NULL)
|
||||
* @return pointer to the matrix
|
||||
*/
|
||||
of_mod2sparse* of_create_pchk_matrix_general (UINT32 nb_rows,
|
||||
UINT32 nb_cols,
|
||||
of_mod2sparse* of_create_pchk_matrix_general (_UINT32 nb_rows,
|
||||
_UINT32 nb_cols,
|
||||
make_method make_method,
|
||||
UINT32 left_degree,
|
||||
UINT32 seed,
|
||||
_UINT32 left_degree,
|
||||
_UINT32 seed,
|
||||
bool no4cycle,
|
||||
of_session_type type,
|
||||
UINT8 verbosity);
|
||||
_UINT8 verbosity);
|
||||
|
||||
/**
|
||||
* This function fills a parity check matrix.
|
||||
@@ -111,14 +111,14 @@ of_mod2sparse* of_create_pchk_matrix_general (UINT32 nb_rows,
|
||||
* @return pointer to the matrix
|
||||
*/
|
||||
of_mod2sparse* of_fill_regular_pchk_matrix (of_mod2sparse* m,
|
||||
UINT32 row_start,
|
||||
UINT32 row_end,
|
||||
UINT32 col_start,
|
||||
UINT32 col_end,
|
||||
_UINT32 row_start,
|
||||
_UINT32 row_end,
|
||||
_UINT32 col_start,
|
||||
_UINT32 col_end,
|
||||
make_method make_method,
|
||||
UINT32 left_degree,
|
||||
_UINT32 left_degree,
|
||||
bool no4cycle,
|
||||
UINT8 verbosity);
|
||||
_UINT8 verbosity);
|
||||
|
||||
/**
|
||||
* This function creates a parity check matrix for 2D codec.
|
||||
@@ -131,10 +131,10 @@ of_mod2sparse* of_fill_regular_pchk_matrix (of_mod2sparse* m,
|
||||
* @param stats (IN/OUT) memory statistics (can be NULL)
|
||||
* @return pointer to the matrix
|
||||
*/
|
||||
of_mod2sparse* of_create_2D_pchk_matrix (UINT32 nb_rows,
|
||||
UINT32 nb_cols,
|
||||
of_mod2sparse* of_create_2D_pchk_matrix (_UINT32 nb_rows,
|
||||
_UINT32 nb_cols,
|
||||
of_session_type type,
|
||||
UINT8 verbosity);
|
||||
_UINT8 verbosity);
|
||||
|
||||
/**
|
||||
* This function fills a 2D parity check matrix.
|
||||
@@ -148,8 +148,8 @@ of_mod2sparse* of_create_2D_pchk_matrix (UINT32 nb_rows,
|
||||
* @return pointer to the matrix
|
||||
*/
|
||||
of_mod2sparse* of_fill_2D_pchk_matrix (of_mod2sparse* m,
|
||||
UINT32 d,
|
||||
UINT32 l,
|
||||
UINT8 verbosity);
|
||||
_UINT32 d,
|
||||
_UINT32 l,
|
||||
_UINT8 verbosity);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -77,12 +77,12 @@ typedef struct of_linear_binary_code_cb
|
||||
******************************************************************************/
|
||||
of_codec_id_t codec_id; /* must begin with fec_codec_id */
|
||||
of_codec_type_t codec_type; /* must be 2nd item */
|
||||
UINT32 nb_source_symbols; /** k parameter (AKA code dimension). */
|
||||
UINT32 nb_repair_symbols; /** r = n - k parameter. */
|
||||
UINT32 encoding_symbol_length; /** symbol length. */
|
||||
_UINT32 nb_source_symbols; /** k parameter (AKA code dimension). */
|
||||
_UINT32 nb_repair_symbols; /** r = n - k parameter. */
|
||||
_UINT32 encoding_symbol_length; /** symbol length. */
|
||||
/*****************************************************************************/
|
||||
|
||||
UINT32 nb_total_symbols; /** n parameter (AKA code length). */
|
||||
_UINT32 nb_total_symbols; /** n parameter (AKA code length). */
|
||||
/* parity check matrix */
|
||||
of_mod2sparse* pchk_matrix;
|
||||
|
||||
@@ -92,21 +92,21 @@ typedef struct of_linear_binary_code_cb
|
||||
of_symbols_stats_t *stats_symbols;
|
||||
#endif
|
||||
|
||||
UINT32 nb_source_symbol_ready; // Number of source symbols ready
|
||||
UINT32 nb_repair_symbol_ready; // Number of parity symbols ready
|
||||
_UINT32 nb_source_symbol_ready; // Number of source symbols ready
|
||||
_UINT32 nb_repair_symbol_ready; // Number of parity symbols ready
|
||||
|
||||
#ifdef ML_DECODING
|
||||
UINT32 *index_rows; // Indirection index to access initial m_chekValues array
|
||||
UINT32 *index_cols; // Indirection index to access initial symbol array
|
||||
UINT32 remain_cols; // Nb of non empty remaining cols in the future simplified matrix
|
||||
UINT32 remain_rows; // Nb of non empty remaining rows in the future simplified matrix
|
||||
_UINT32 *index_rows; // Indirection index to access initial m_chekValues array
|
||||
_UINT32 *index_cols; // Indirection index to access initial symbol array
|
||||
_UINT32 remain_cols; // Nb of non empty remaining cols in the future simplified matrix
|
||||
_UINT32 remain_rows; // Nb of non empty remaining rows in the future simplified matrix
|
||||
|
||||
of_mod2sparse *pchk_matrix_simplified; // Simplified Parity Check Matrix in sparse mode format
|
||||
of_mod2sparse *original_pchkMatrix;
|
||||
of_mod2sparse *pchk_matrix_gauss; // Parity Check matrix in sparse mode format.
|
||||
|
||||
UINT32 dec_step; // Current step in the Gauss decoding algorithm
|
||||
UINT32 threshold_simplification;// threshold (number of symbols) above which we
|
||||
_UINT32 dec_step; // Current step in the Gauss decoding algorithm
|
||||
_UINT32 threshold_simplification;// threshold (number of symbols) above which we
|
||||
// run the Gaussian Elimination algorithm
|
||||
#endif
|
||||
|
||||
@@ -114,27 +114,27 @@ typedef struct of_linear_binary_code_cb
|
||||
/** table of all check values, i.e. that contain the constant term of each equation. */
|
||||
void** tab_const_term_of_equ;
|
||||
/** table containing the number of encoding symbols of each equation. */
|
||||
UINT16* tab_nb_enc_symbols_per_equ;
|
||||
_UINT16* tab_nb_enc_symbols_per_equ;
|
||||
/** table containing the number of unknow symbols (i.e. neither received nor decoded
|
||||
* at that time) of each equation. */
|
||||
UINT16* tab_nb_unknown_symbols;
|
||||
_UINT16* tab_nb_unknown_symbols;
|
||||
/** table containing the number of equations in which a repair symbol is included. */
|
||||
UINT16* tab_nb_equ_for_repair;
|
||||
_UINT16* tab_nb_equ_for_repair;
|
||||
|
||||
void ** repair_symbols_values;
|
||||
void ** tmp_tab_symbols;
|
||||
UINT16 nb_tmp_symbols;
|
||||
_UINT16 nb_tmp_symbols;
|
||||
#endif /* } OF_USE_DECODER */
|
||||
|
||||
void **encoding_symbols_tab;
|
||||
|
||||
/** callbacks registered by the application. */
|
||||
void* (*decoded_source_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded source symbol */
|
||||
UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded source symbol */
|
||||
_UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
void* (*decoded_repair_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded repair symbol */
|
||||
UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded repair symbol */
|
||||
_UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
void* context_4_callback;
|
||||
} of_linear_binary_code_cb_t;
|
||||
|
||||
|
||||
@@ -40,14 +40,14 @@
|
||||
#ifndef OF_DEBUG
|
||||
void of_add_from_multiple_symbols (void *to,
|
||||
const void **from,
|
||||
UINT32 from_size,
|
||||
UINT32 symbol_size)
|
||||
_UINT32 from_size,
|
||||
_UINT32 symbol_size)
|
||||
#else
|
||||
void of_add_from_multiple_symbols (void *to,
|
||||
const void **from,
|
||||
UINT32 from_size,
|
||||
UINT32 symbol_size,
|
||||
UINT32 *op)
|
||||
_UINT32 from_size,
|
||||
_UINT32 symbol_size,
|
||||
_UINT32 *op)
|
||||
#endif
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
@@ -55,10 +55,10 @@ void of_add_from_multiple_symbols (void *to,
|
||||
if (op != NULL)
|
||||
(*op)+=from_size;
|
||||
#endif
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
//#ifndef ASSEMBLY_SSE_OPT /* { */
|
||||
UINT32 symbolSize32;
|
||||
UINT32 symbolSize32rem;
|
||||
_UINT32 symbolSize32;
|
||||
_UINT32 symbolSize32rem;
|
||||
//printf("%i\n",from_size);
|
||||
|
||||
symbolSize32 = symbol_size >> 2;
|
||||
@@ -70,21 +70,21 @@ void of_add_from_multiple_symbols (void *to,
|
||||
* 64-bit machines
|
||||
*/
|
||||
|
||||
UINT32 symbolSize64; // Size of symbols in 64-bit unit
|
||||
_UINT32 symbolSize64; // Size of symbols in 64-bit unit
|
||||
// symbol_size is not necessarily a multiple of 8, but >> 3 will divide
|
||||
// it by 8 and keep the integral part automatically.
|
||||
symbolSize64 = symbol_size >> 3;
|
||||
while (from_size >=8)
|
||||
{
|
||||
UINT64* t = (UINT64*) to; // to pointer to 64-bit integers
|
||||
UINT64* ps1 = (UINT64*)from[0];
|
||||
UINT64* ps2 = (UINT64*)from[1];
|
||||
UINT64* ps3 = (UINT64*)from[2];
|
||||
UINT64* ps4 = (UINT64*)from[3];
|
||||
UINT64* ps5 = (UINT64*)from[4];
|
||||
UINT64* ps6 = (UINT64*)from[5];
|
||||
UINT64* ps7 = (UINT64*)from[6];
|
||||
UINT64* ps8 = (UINT64*)from[7];
|
||||
_UINT64* t = (_UINT64*) to; // to pointer to 64-bit integers
|
||||
_UINT64* ps1 = (_UINT64*)from[0];
|
||||
_UINT64* ps2 = (_UINT64*)from[1];
|
||||
_UINT64* ps3 = (_UINT64*)from[2];
|
||||
_UINT64* ps4 = (_UINT64*)from[3];
|
||||
_UINT64* ps5 = (_UINT64*)from[4];
|
||||
_UINT64* ps6 = (_UINT64*)from[5];
|
||||
_UINT64* ps7 = (_UINT64*)from[6];
|
||||
_UINT64* ps8 = (_UINT64*)from[7];
|
||||
from_size-=8;
|
||||
from+=8;
|
||||
for (i = symbolSize64; i > 0; i--)
|
||||
@@ -100,21 +100,21 @@ void of_add_from_multiple_symbols (void *to,
|
||||
ps7++;
|
||||
ps8++;
|
||||
}
|
||||
UINT32* t32 = (UINT32*) t; // to pointer to 32-bit integers
|
||||
UINT32* ps1_32 = (UINT32*) ps1; // from pointer to 32-bit integers
|
||||
UINT32* ps2_32 = (UINT32*) ps2; // from pointer to 32-bit integers
|
||||
UINT32* ps3_32 = (UINT32*) ps3; // from pointer to 32-bit integers
|
||||
UINT32* ps4_32 = (UINT32*) ps4; // from pointer to 32-bit integers
|
||||
UINT32* ps5_32 = (UINT32*) ps5; // from pointer to 32-bit integers
|
||||
UINT32* ps6_32 = (UINT32*) ps6; // from pointer to 32-bit integers
|
||||
UINT32* ps7_32 = (UINT32*) ps7; // from pointer to 32-bit integers
|
||||
UINT32* ps8_32 = (UINT32*) ps8; // from pointer to 32-bit integers
|
||||
_UINT32* t32 = (_UINT32*) t; // to pointer to 32-bit integers
|
||||
_UINT32* ps1_32 = (_UINT32*) ps1; // from pointer to 32-bit integers
|
||||
_UINT32* ps2_32 = (_UINT32*) ps2; // from pointer to 32-bit integers
|
||||
_UINT32* ps3_32 = (_UINT32*) ps3; // from pointer to 32-bit integers
|
||||
_UINT32* ps4_32 = (_UINT32*) ps4; // from pointer to 32-bit integers
|
||||
_UINT32* ps5_32 = (_UINT32*) ps5; // from pointer to 32-bit integers
|
||||
_UINT32* ps6_32 = (_UINT32*) ps6; // from pointer to 32-bit integers
|
||||
_UINT32* ps7_32 = (_UINT32*) ps7; // from pointer to 32-bit integers
|
||||
_UINT32* ps8_32 = (_UINT32*) ps8; // from pointer to 32-bit integers
|
||||
|
||||
/* then perform a 32-bit XOR if needed... */
|
||||
if ( (symbolSize64 << 1) < symbolSize32)
|
||||
{
|
||||
* (UINT32*) t32 ^= (* (UINT32*) ps1_32 ^ * (UINT32*) ps2_32 ^ * (UINT32*) ps3_32 ^ * (UINT32*) ps4_32 ^
|
||||
* (UINT32*) ps5_32 ^ * (UINT32*) ps6_32 ^ * (UINT32*) ps7_32 ^ * (UINT32*) ps8_32);
|
||||
* (_UINT32*) t32 ^= (* (_UINT32*) ps1_32 ^ * (_UINT32*) ps2_32 ^ * (_UINT32*) ps3_32 ^ * (_UINT32*) ps4_32 ^
|
||||
* (_UINT32*) ps5_32 ^ * (_UINT32*) ps6_32 ^ * (_UINT32*) ps7_32 ^ * (_UINT32*) ps8_32);
|
||||
ps1_32++;
|
||||
ps2_32++;
|
||||
ps3_32++;
|
||||
@@ -129,20 +129,20 @@ void of_add_from_multiple_symbols (void *to,
|
||||
{
|
||||
for (i = 0; i < symbolSize32rem; i++)
|
||||
{
|
||||
* (UINT8*) ( (UINT8*) t32 + i) ^= ((* (UINT8*) ( (UINT8*) ps1_32 + i)) ^ (* (UINT8*) ( (UINT8*) ps2_32 + i) ) ^
|
||||
(* (UINT8*) ( (UINT8*) ps3_32 + i) ) ^ (* (UINT8*) ( (UINT8*) ps4_32 + i) ) ^
|
||||
(* (UINT8*) ( (UINT8*) ps5_32 + i) ) ^ (* (UINT8*) ( (UINT8*) ps6_32 + i) ) ^
|
||||
(* (UINT8*) ( (UINT8*) ps7_32 + i) ) ^ (* (UINT8*) ( (UINT8*) ps8_32 + i) ) );
|
||||
* (_UINT8*) ( (_UINT8*) t32 + i) ^= ((* (_UINT8*) ( (_UINT8*) ps1_32 + i)) ^ (* (_UINT8*) ( (_UINT8*) ps2_32 + i) ) ^
|
||||
(* (_UINT8*) ( (_UINT8*) ps3_32 + i) ) ^ (* (_UINT8*) ( (_UINT8*) ps4_32 + i) ) ^
|
||||
(* (_UINT8*) ( (_UINT8*) ps5_32 + i) ) ^ (* (_UINT8*) ( (_UINT8*) ps6_32 + i) ) ^
|
||||
(* (_UINT8*) ( (_UINT8*) ps7_32 + i) ) ^ (* (_UINT8*) ( (_UINT8*) ps8_32 + i) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
while (from_size >=4)
|
||||
{
|
||||
UINT64* t = (UINT64*) to; // to pointer to 64-bit integers
|
||||
UINT64* ps1 = (UINT64*)from[0];
|
||||
UINT64* ps2 = (UINT64*)from[1];
|
||||
UINT64* ps3 = (UINT64*)from[2];
|
||||
UINT64* ps4 = (UINT64*)from[3];
|
||||
_UINT64* t = (_UINT64*) to; // to pointer to 64-bit integers
|
||||
_UINT64* ps1 = (_UINT64*)from[0];
|
||||
_UINT64* ps2 = (_UINT64*)from[1];
|
||||
_UINT64* ps3 = (_UINT64*)from[2];
|
||||
_UINT64* ps4 = (_UINT64*)from[3];
|
||||
from_size-=4;
|
||||
from+=4;
|
||||
for (i = symbolSize64; i > 0; i--)
|
||||
@@ -154,16 +154,16 @@ void of_add_from_multiple_symbols (void *to,
|
||||
ps3++;
|
||||
ps4++;
|
||||
}
|
||||
UINT32* t32 = (UINT32*) t; // to pointer to 32-bit integers
|
||||
UINT32* ps1_32 = (UINT32*) ps1; // from pointer to 32-bit integers
|
||||
UINT32* ps2_32 = (UINT32*) ps2; // from pointer to 32-bit integers
|
||||
UINT32* ps3_32 = (UINT32*) ps3; // from pointer to 32-bit integers
|
||||
UINT32* ps4_32 = (UINT32*) ps4; // from pointer to 32-bit integers
|
||||
_UINT32* t32 = (_UINT32*) t; // to pointer to 32-bit integers
|
||||
_UINT32* ps1_32 = (_UINT32*) ps1; // from pointer to 32-bit integers
|
||||
_UINT32* ps2_32 = (_UINT32*) ps2; // from pointer to 32-bit integers
|
||||
_UINT32* ps3_32 = (_UINT32*) ps3; // from pointer to 32-bit integers
|
||||
_UINT32* ps4_32 = (_UINT32*) ps4; // from pointer to 32-bit integers
|
||||
|
||||
/* then perform a 32-bit XOR if needed... */
|
||||
if ( (symbolSize64 << 1) < symbolSize32)
|
||||
{
|
||||
* (UINT32*) t32 ^= (* (UINT32*) ps1_32 ^ * (UINT32*) ps2_32 ^ * (UINT32*) ps3_32 ^ * (UINT32*) ps4_32 );
|
||||
* (_UINT32*) t32 ^= (* (_UINT32*) ps1_32 ^ * (_UINT32*) ps2_32 ^ * (_UINT32*) ps3_32 ^ * (_UINT32*) ps4_32 );
|
||||
ps1_32++;
|
||||
ps2_32++;
|
||||
ps3_32++;
|
||||
@@ -174,16 +174,16 @@ void of_add_from_multiple_symbols (void *to,
|
||||
{
|
||||
for (i = 0; i < symbolSize32rem; i++)
|
||||
{
|
||||
* (UINT8*) ( (UINT8*) t32 + i) ^= ((* (UINT8*) ( (UINT8*) ps1_32 + i)) ^ (* (UINT8*) ( (UINT8*) ps2_32 + i) ) ^
|
||||
(* (UINT8*) ( (UINT8*) ps3_32 + i) ) ^ (* (UINT8*) ( (UINT8*) ps4_32 + i) ) );
|
||||
* (_UINT8*) ( (_UINT8*) t32 + i) ^= ((* (_UINT8*) ( (_UINT8*) ps1_32 + i)) ^ (* (_UINT8*) ( (_UINT8*) ps2_32 + i) ) ^
|
||||
(* (_UINT8*) ( (_UINT8*) ps3_32 + i) ) ^ (* (_UINT8*) ( (_UINT8*) ps4_32 + i) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
while (from_size >=2)
|
||||
{
|
||||
UINT64* t = (UINT64*) to; // to pointer to 64-bit integers
|
||||
UINT64* ps1 = (UINT64*)from[0];
|
||||
UINT64* ps2 = (UINT64*)from[1];
|
||||
_UINT64* t = (_UINT64*) to; // to pointer to 64-bit integers
|
||||
_UINT64* ps1 = (_UINT64*)from[0];
|
||||
_UINT64* ps2 = (_UINT64*)from[1];
|
||||
from+=2;
|
||||
from_size-=2;
|
||||
for (i = symbolSize64; i > 0; i--)
|
||||
@@ -193,13 +193,13 @@ void of_add_from_multiple_symbols (void *to,
|
||||
ps1++;
|
||||
ps2++;
|
||||
}
|
||||
UINT32* t32 = (UINT32*) t; // to pointer to 32-bit integers
|
||||
UINT32* ps1_32 = (UINT32*) ps1; // from pointer to 32-bit integers
|
||||
UINT32* ps2_32 = (UINT32*) ps2; // from pointer to 32-bit integers
|
||||
_UINT32* t32 = (_UINT32*) t; // to pointer to 32-bit integers
|
||||
_UINT32* ps1_32 = (_UINT32*) ps1; // from pointer to 32-bit integers
|
||||
_UINT32* ps2_32 = (_UINT32*) ps2; // from pointer to 32-bit integers
|
||||
/* then perform a 32-bit XOR if needed... */
|
||||
if ( (symbolSize64 << 1) < symbolSize32)
|
||||
{
|
||||
* (UINT32*) t32 ^= (* (UINT32*) ps1_32 ^ * (UINT32*) ps2_32);
|
||||
* (_UINT32*) t32 ^= (* (_UINT32*) ps1_32 ^ * (_UINT32*) ps2_32);
|
||||
ps1_32++;
|
||||
ps2_32++;
|
||||
t32++;
|
||||
@@ -208,27 +208,27 @@ void of_add_from_multiple_symbols (void *to,
|
||||
{
|
||||
for (i = 0; i < symbolSize32rem; i++)
|
||||
{
|
||||
* (UINT8*) ( (UINT8*) t32 + i) ^= ((* (UINT8*) ( (UINT8*) ps1_32 + i)) ^ (* (UINT8*) ( (UINT8*) ps2_32 + i) ));
|
||||
* (_UINT8*) ( (_UINT8*) t32 + i) ^= ((* (_UINT8*) ( (_UINT8*) ps1_32 + i)) ^ (* (_UINT8*) ( (_UINT8*) ps2_32 + i) ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (from_size == 0) return;
|
||||
|
||||
UINT64 *t = (UINT64*) to; // to pointer to 64-bit integers
|
||||
UINT64 *f = (UINT64*) from[0]; // from pointer to 64-bit integers
|
||||
_UINT64 *t = (_UINT64*) to; // to pointer to 64-bit integers
|
||||
_UINT64 *f = (_UINT64*) from[0]; // from pointer to 64-bit integers
|
||||
for (i = symbolSize64; i > 0; i--)
|
||||
{
|
||||
*t ^= *f;
|
||||
t++;
|
||||
f++;
|
||||
}
|
||||
UINT32 *t32 = (UINT32*) t; // to pointer to 32-bit integers
|
||||
UINT32 *f32 = (UINT32*) f; // from pointer to 32-bit integers
|
||||
_UINT32 *t32 = (_UINT32*) t; // to pointer to 32-bit integers
|
||||
_UINT32 *f32 = (_UINT32*) f; // from pointer to 32-bit integers
|
||||
/* then perform a 32-bit XOR if needed... */
|
||||
if ( (symbolSize64 << 1) < symbolSize32)
|
||||
{
|
||||
* (UINT32*) t32 ^= * (UINT32*) f32;
|
||||
* (_UINT32*) t32 ^= * (_UINT32*) f32;
|
||||
t32++;
|
||||
f32++;
|
||||
}
|
||||
@@ -238,7 +238,7 @@ void of_add_from_multiple_symbols (void *to,
|
||||
{
|
||||
for (i = 0; i < symbolSize32rem; i++)
|
||||
{
|
||||
* (UINT8*) ( (UINT8*) t32 + i) ^= * (UINT8*) ( (UINT8*) f32 + i);
|
||||
* (_UINT8*) ( (_UINT8*) t32 + i) ^= * (_UINT8*) ( (_UINT8*) f32 + i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,8 +247,8 @@ void of_add_from_multiple_symbols (void *to,
|
||||
/*
|
||||
* 32-bit machines
|
||||
*/
|
||||
UINT32 *t32 = (UINT32*) to; // to pointer to 32-bit integers
|
||||
UINT32 *f32 = (UINT32*) from; // from pointer to 32-bit integers
|
||||
_UINT32 *t32 = (_UINT32*) to; // to pointer to 32-bit integers
|
||||
_UINT32 *f32 = (_UINT32*) from; // from pointer to 32-bit integers
|
||||
/* First perform as many 32-bit XORs as needed... */
|
||||
for (i = symbolSize32; i > 0; i--)
|
||||
{
|
||||
@@ -262,7 +262,7 @@ void of_add_from_multiple_symbols (void *to,
|
||||
{
|
||||
for (i = 0; i < symbolSize32rem; i++)
|
||||
{
|
||||
* (UINT8*) ( (UINT8*) t32 + i) ^= * (UINT8*) ( (UINT8*) f32 + i);
|
||||
* (_UINT8*) ( (_UINT8*) t32 + i) ^= * (_UINT8*) ( (_UINT8*) f32 + i);
|
||||
}
|
||||
}
|
||||
#endif //defined (__LP64__) || (__WORDSIZE == 64) }
|
||||
@@ -276,14 +276,14 @@ void of_add_from_multiple_symbols (void *to,
|
||||
#ifndef OF_DEBUG
|
||||
void of_add_to_multiple_symbols (void **to,
|
||||
const void *from,
|
||||
UINT32 to_size,
|
||||
UINT32 symbol_size)
|
||||
_UINT32 to_size,
|
||||
_UINT32 symbol_size)
|
||||
#else
|
||||
void of_add_to_multiple_symbols (void **to,
|
||||
const void *from,
|
||||
UINT32 to_size,
|
||||
UINT32 symbol_size,
|
||||
UINT32 *op)
|
||||
_UINT32 to_size,
|
||||
_UINT32 symbol_size,
|
||||
_UINT32 *op)
|
||||
#endif
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
@@ -291,10 +291,10 @@ void of_add_to_multiple_symbols (void **to,
|
||||
if (op != NULL)
|
||||
(*op) += to_size;
|
||||
#endif
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
//#ifndef ASSEMBLY_SSE_OPT /* { */
|
||||
UINT32 symbolSize32;
|
||||
UINT32 symbolSize32rem;
|
||||
_UINT32 symbolSize32;
|
||||
_UINT32 symbolSize32rem;
|
||||
|
||||
symbolSize32 = symbol_size >> 2;
|
||||
symbolSize32rem = symbol_size % 4; // Remaining bytes when the symbol
|
||||
@@ -303,23 +303,23 @@ void of_add_to_multiple_symbols (void **to,
|
||||
/*
|
||||
* 64-bit machines
|
||||
*/
|
||||
UINT32 symbolSize64; // Size of symbols in 64-bit unit
|
||||
_UINT32 symbolSize64; // Size of symbols in 64-bit unit
|
||||
// symbol_size is not necessarily a multiple of 8, but >> 3 will divide
|
||||
// it by 8 and keep the integral part automatically.
|
||||
symbolSize64 = symbol_size >> 3;
|
||||
UINT64 *pt1, *pt2, *pt3, *pt4, *pt5, *pt6, *pt7, *pt8, *from_s, from_value;
|
||||
_UINT64 *pt1, *pt2, *pt3, *pt4, *pt5, *pt6, *pt7, *pt8, *from_s, from_value;
|
||||
|
||||
while (to_size >= 8)
|
||||
{
|
||||
from_s = (UINT64*) from; // to pointer to 64-bit integers
|
||||
pt1 = (UINT64*)to[0];
|
||||
pt2 = (UINT64*)to[1];
|
||||
pt3 = (UINT64*)to[2];
|
||||
pt4 = (UINT64*)to[3];
|
||||
pt5 = (UINT64*)to[4];
|
||||
pt6 = (UINT64*)to[5];
|
||||
pt7 = (UINT64*)to[6];
|
||||
pt8 = (UINT64*)to[7];
|
||||
from_s = (_UINT64*) from; // to pointer to 64-bit integers
|
||||
pt1 = (_UINT64*)to[0];
|
||||
pt2 = (_UINT64*)to[1];
|
||||
pt3 = (_UINT64*)to[2];
|
||||
pt4 = (_UINT64*)to[3];
|
||||
pt5 = (_UINT64*)to[4];
|
||||
pt6 = (_UINT64*)to[5];
|
||||
pt7 = (_UINT64*)to[6];
|
||||
pt8 = (_UINT64*)to[7];
|
||||
to += 8;
|
||||
to_size -= 8;
|
||||
for (i = symbolSize64; i > 0; i--)
|
||||
@@ -343,47 +343,47 @@ void of_add_to_multiple_symbols (void **to,
|
||||
pt7++;
|
||||
pt8++;
|
||||
}
|
||||
UINT32* from_s32 = (UINT32*) from_s; // to pointer to 32-bit integers
|
||||
_UINT32* from_s32 = (_UINT32*) from_s; // to pointer to 32-bit integers
|
||||
/* then perform a 32-bit XOR if needed... */
|
||||
from_s32 = (UINT32*) from_s; // pointer to 32-bit integers
|
||||
from_s32 = (_UINT32*) from_s; // pointer to 32-bit integers
|
||||
if ( (symbolSize64 << 1) < symbolSize32)
|
||||
{
|
||||
(* (UINT32*) pt1++) ^= *from_s32;
|
||||
(* (UINT32*) pt2++) ^= *from_s32;
|
||||
(* (UINT32*) pt3++) ^= *from_s32;
|
||||
(* (UINT32*) pt4++) ^= *from_s32;
|
||||
(* (UINT32*) pt5++) ^= *from_s32;
|
||||
(* (UINT32*) pt6++) ^= *from_s32;
|
||||
(* (UINT32*) pt7++) ^= *from_s32;
|
||||
(* (UINT32*) pt8++) ^= *from_s32;
|
||||
(* (_UINT32*) pt1++) ^= *from_s32;
|
||||
(* (_UINT32*) pt2++) ^= *from_s32;
|
||||
(* (_UINT32*) pt3++) ^= *from_s32;
|
||||
(* (_UINT32*) pt4++) ^= *from_s32;
|
||||
(* (_UINT32*) pt5++) ^= *from_s32;
|
||||
(* (_UINT32*) pt6++) ^= *from_s32;
|
||||
(* (_UINT32*) pt7++) ^= *from_s32;
|
||||
(* (_UINT32*) pt8++) ^= *from_s32;
|
||||
from_s32++;
|
||||
}
|
||||
if (symbolSize32rem > 0)
|
||||
{
|
||||
UINT8* s8;
|
||||
_UINT8* s8;
|
||||
for (i = 0; i < symbolSize32rem; i++)
|
||||
{
|
||||
s8 = ( (UINT8*) from_s32 + i);
|
||||
(* (UINT8*) ( (UINT8*) pt1 + i)) ^= * (UINT8*) s8;
|
||||
(* (UINT8*) ( (UINT8*) pt2 + i)) ^= * (UINT8*) s8;
|
||||
(* (UINT8*) ( (UINT8*) pt3 + i)) ^= * (UINT8*) s8;
|
||||
(* (UINT8*) ( (UINT8*) pt4 + i)) ^= * (UINT8*) s8;
|
||||
(* (UINT8*) ( (UINT8*) pt5 + i)) ^= * (UINT8*) s8;
|
||||
(* (UINT8*) ( (UINT8*) pt6 + i)) ^= * (UINT8*) s8;
|
||||
(* (UINT8*) ( (UINT8*) pt7 + i)) ^= * (UINT8*) s8;
|
||||
(* (UINT8*) ( (UINT8*) pt8 + i)) ^= * (UINT8*) s8;
|
||||
s8 = ( (_UINT8*) from_s32 + i);
|
||||
(* (_UINT8*) ( (_UINT8*) pt1 + i)) ^= * (_UINT8*) s8;
|
||||
(* (_UINT8*) ( (_UINT8*) pt2 + i)) ^= * (_UINT8*) s8;
|
||||
(* (_UINT8*) ( (_UINT8*) pt3 + i)) ^= * (_UINT8*) s8;
|
||||
(* (_UINT8*) ( (_UINT8*) pt4 + i)) ^= * (_UINT8*) s8;
|
||||
(* (_UINT8*) ( (_UINT8*) pt5 + i)) ^= * (_UINT8*) s8;
|
||||
(* (_UINT8*) ( (_UINT8*) pt6 + i)) ^= * (_UINT8*) s8;
|
||||
(* (_UINT8*) ( (_UINT8*) pt7 + i)) ^= * (_UINT8*) s8;
|
||||
(* (_UINT8*) ( (_UINT8*) pt8 + i)) ^= * (_UINT8*) s8;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (to_size >= 4)
|
||||
{
|
||||
UINT32 *from_s32; // to pointer to 32-bit integers
|
||||
_UINT32 *from_s32; // to pointer to 32-bit integers
|
||||
|
||||
from_s = (UINT64*) from; // to pointer to 64-bit integers
|
||||
pt1 = (UINT64*)to[0];
|
||||
pt2 = (UINT64*)to[1];
|
||||
pt3 = (UINT64*)to[2];
|
||||
pt4 = (UINT64*)to[3];
|
||||
from_s = (_UINT64*) from; // to pointer to 64-bit integers
|
||||
pt1 = (_UINT64*)to[0];
|
||||
pt2 = (_UINT64*)to[1];
|
||||
pt3 = (_UINT64*)to[2];
|
||||
pt4 = (_UINT64*)to[3];
|
||||
to += 4;
|
||||
to_size -= 4;
|
||||
for (i = symbolSize64; i > 0; i--)
|
||||
@@ -400,35 +400,35 @@ void of_add_to_multiple_symbols (void **to,
|
||||
pt4++;
|
||||
}
|
||||
/* then perform a 32-bit XOR if needed... */
|
||||
from_s32 = (UINT32*) from_s;
|
||||
from_s32 = (_UINT32*) from_s;
|
||||
if ( (symbolSize64 << 1) < symbolSize32)
|
||||
{
|
||||
(* (UINT32*) pt1++) ^= *from_s32;
|
||||
(* (UINT32*) pt2++) ^= *from_s32;
|
||||
(* (UINT32*) pt3++) ^= *from_s32;
|
||||
(* (UINT32*) pt4++) ^= *from_s32;
|
||||
(* (_UINT32*) pt1++) ^= *from_s32;
|
||||
(* (_UINT32*) pt2++) ^= *from_s32;
|
||||
(* (_UINT32*) pt3++) ^= *from_s32;
|
||||
(* (_UINT32*) pt4++) ^= *from_s32;
|
||||
from_s32++;
|
||||
}
|
||||
if (symbolSize32rem > 0)
|
||||
{
|
||||
UINT8 *s8;
|
||||
_UINT8 *s8;
|
||||
for (i = 0; i < symbolSize32rem; i++)
|
||||
{
|
||||
s8 = ( (UINT8*) from_s32 + i);
|
||||
(* (UINT8*) ( (UINT8*) pt1 + i)) ^= * (UINT8*) s8;
|
||||
(* (UINT8*) ( (UINT8*) pt2 + i)) ^= * (UINT8*) s8;
|
||||
(* (UINT8*) ( (UINT8*) pt3 + i)) ^= * (UINT8*) s8;
|
||||
(* (UINT8*) ( (UINT8*) pt4 + i)) ^= * (UINT8*) s8;
|
||||
s8 = ( (_UINT8*) from_s32 + i);
|
||||
(* (_UINT8*) ( (_UINT8*) pt1 + i)) ^= * (_UINT8*) s8;
|
||||
(* (_UINT8*) ( (_UINT8*) pt2 + i)) ^= * (_UINT8*) s8;
|
||||
(* (_UINT8*) ( (_UINT8*) pt3 + i)) ^= * (_UINT8*) s8;
|
||||
(* (_UINT8*) ( (_UINT8*) pt4 + i)) ^= * (_UINT8*) s8;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (to_size >= 2)
|
||||
{
|
||||
UINT32 *from_s32; // to pointer to 32-bit integers
|
||||
_UINT32 *from_s32; // to pointer to 32-bit integers
|
||||
|
||||
from_s = (UINT64*) from; // to pointer to 64-bit integers
|
||||
pt1 = (UINT64*)to[0];
|
||||
pt2 = (UINT64*)to[1];
|
||||
from_s = (_UINT64*) from; // to pointer to 64-bit integers
|
||||
pt1 = (_UINT64*)to[0];
|
||||
pt2 = (_UINT64*)to[1];
|
||||
|
||||
to += 2;
|
||||
to_size -= 2;
|
||||
@@ -441,41 +441,41 @@ void of_add_to_multiple_symbols (void **to,
|
||||
pt2++;
|
||||
}
|
||||
/* then perform a 32-bit XOR if needed... */
|
||||
from_s32 = (UINT32*) from_s; // pointer to 32-bit integers
|
||||
from_s32 = (_UINT32*) from_s; // pointer to 32-bit integers
|
||||
if ( (symbolSize64 << 1) < symbolSize32)
|
||||
{
|
||||
(* (UINT32*) pt1++) ^= *from_s32;
|
||||
(* (UINT32*) pt2++) ^= *from_s32;
|
||||
(* (_UINT32*) pt1++) ^= *from_s32;
|
||||
(* (_UINT32*) pt2++) ^= *from_s32;
|
||||
from_s32++;
|
||||
}
|
||||
if (symbolSize32rem > 0)
|
||||
{
|
||||
UINT8 *s8;
|
||||
_UINT8 *s8;
|
||||
for (i = 0; i < symbolSize32rem; i++)
|
||||
{
|
||||
s8 = ( (UINT8*) from_s32 + i);
|
||||
(* (UINT8*) ( (UINT8*) pt1 + i)) ^= * (UINT8*) s8;
|
||||
(* (UINT8*) ( (UINT8*) pt2 + i)) ^= * (UINT8*) s8;
|
||||
s8 = ( (_UINT8*) from_s32 + i);
|
||||
(* (_UINT8*) ( (_UINT8*) pt1 + i)) ^= * (_UINT8*) s8;
|
||||
(* (_UINT8*) ( (_UINT8*) pt2 + i)) ^= * (_UINT8*) s8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (to_size == 0) return;
|
||||
|
||||
UINT64 *t = (UINT64*) to[0]; // to pointer to 64-bit integers
|
||||
UINT64 *f = (UINT64*) from; // from pointer to 64-bit integers
|
||||
_UINT64 *t = (_UINT64*) to[0]; // to pointer to 64-bit integers
|
||||
_UINT64 *f = (_UINT64*) from; // from pointer to 64-bit integers
|
||||
for (i = symbolSize64; i > 0; i--)
|
||||
{
|
||||
*t ^= *f;
|
||||
t++;
|
||||
f++;
|
||||
}
|
||||
UINT32* t32 = (UINT32*) t; // to pointer to 32-bit integers
|
||||
UINT32 *f32 = (UINT32*) f; // from pointer to 32-bit integers
|
||||
_UINT32* t32 = (_UINT32*) t; // to pointer to 32-bit integers
|
||||
_UINT32 *f32 = (_UINT32*) f; // from pointer to 32-bit integers
|
||||
/* then perform a 32-bit XOR if needed... */
|
||||
if ( (symbolSize64 << 1) < symbolSize32)
|
||||
{
|
||||
* (UINT32*) t32 ^= * (UINT32*) f32;
|
||||
* (_UINT32*) t32 ^= * (_UINT32*) f32;
|
||||
t32++;
|
||||
f32++;
|
||||
}
|
||||
@@ -485,7 +485,7 @@ void of_add_to_multiple_symbols (void **to,
|
||||
{
|
||||
for (i = 0; i < symbolSize32rem; i++)
|
||||
{
|
||||
* (UINT8*) ( (UINT8*) t32 + i) ^= * (UINT8*) ( (UINT8*) f32 + i);
|
||||
* (_UINT8*) ( (_UINT8*) t32 + i) ^= * (_UINT8*) ( (_UINT8*) f32 + i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,8 +494,8 @@ void of_add_to_multiple_symbols (void **to,
|
||||
/*
|
||||
* 32-bit machines
|
||||
*/
|
||||
UINT32 *t32 = (UINT32*) to; // to pointer to 32-bit integers
|
||||
UINT32 *f32 = (UINT32*) from; // from pointer to 32-bit integers
|
||||
_UINT32 *t32 = (_UINT32*) to; // to pointer to 32-bit integers
|
||||
_UINT32 *f32 = (_UINT32*) from; // from pointer to 32-bit integers
|
||||
/* First perform as many 32-bit XORs as needed... */
|
||||
for (i = symbolSize32; i > 0; i--)
|
||||
{
|
||||
@@ -509,7 +509,7 @@ void of_add_to_multiple_symbols (void **to,
|
||||
{
|
||||
for (i = 0; i < symbolSize32rem; i++)
|
||||
{
|
||||
* (UINT8*) ( (UINT8*) t32 + i) ^= * (UINT8*) ( (UINT8*) f32 + i);
|
||||
* (_UINT8*) ( (_UINT8*) t32 + i) ^= * (_UINT8*) ( (_UINT8*) f32 + i);
|
||||
}
|
||||
}
|
||||
#endif //defined (__LP64__) || (__WORDSIZE == 64) }
|
||||
@@ -524,23 +524,23 @@ void of_add_to_multiple_symbols (void **to,
|
||||
#ifdef OF_DEBUG
|
||||
void of_add_to_symbol (void *to,
|
||||
const void *from,
|
||||
UINT32 symbol_size,
|
||||
UINT32 *op)
|
||||
_UINT32 symbol_size,
|
||||
_UINT32 *op)
|
||||
#else
|
||||
void of_add_to_symbol (void *to,
|
||||
const void *from,
|
||||
UINT32 symbol_size)
|
||||
_UINT32 symbol_size)
|
||||
#endif
|
||||
{
|
||||
//OF_ENTER_FUNCTION
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
#ifdef OF_DEBUG
|
||||
if (op != NULL)
|
||||
(*op)++;
|
||||
#endif
|
||||
#ifndef ASSEMBLY_SSE_OPT /* { */
|
||||
UINT32 symbolSize32;
|
||||
UINT32 symbolSize32rem;
|
||||
_UINT32 symbolSize32;
|
||||
_UINT32 symbolSize32rem;
|
||||
|
||||
symbolSize32 = symbol_size >> 2;
|
||||
symbolSize32rem = symbol_size % 4; // Remaining bytes when the symbol
|
||||
@@ -551,25 +551,25 @@ void of_add_to_symbol (void *to,
|
||||
* 64-bit machines
|
||||
*/
|
||||
|
||||
UINT32 symbolSize64; // Size of symbols in 64-bit unit
|
||||
_UINT32 symbolSize64; // Size of symbols in 64-bit unit
|
||||
// symbol_size is not necessarily a multiple of 8, but >> 3 will divide
|
||||
// it by 8 and keep the integral part automatically.
|
||||
symbolSize64 = symbol_size >> 3;
|
||||
/* First perform as many 64-bit XORs as needed... */
|
||||
UINT64 *t = (UINT64*) to; // to pointer to 64-bit integers
|
||||
UINT64 *f = (UINT64*) from; // from pointer to 64-bit integers
|
||||
_UINT64 *t = (_UINT64*) to; // to pointer to 64-bit integers
|
||||
_UINT64 *f = (_UINT64*) from; // from pointer to 64-bit integers
|
||||
for (i = symbolSize64; i > 0; i--)
|
||||
{
|
||||
*t ^= *f;
|
||||
t++;
|
||||
f++;
|
||||
}
|
||||
UINT32 *t32 = (UINT32*) t; // to pointer to 32-bit integers
|
||||
UINT32 *f32 = (UINT32*) f; // from pointer to 32-bit integers
|
||||
_UINT32 *t32 = (_UINT32*) t; // to pointer to 32-bit integers
|
||||
_UINT32 *f32 = (_UINT32*) f; // from pointer to 32-bit integers
|
||||
/* then perform a 32-bit XOR if needed... */
|
||||
if ( (symbolSize64 << 1) < symbolSize32)
|
||||
{
|
||||
* (UINT32*) t32 ^= * (UINT32*) f32;
|
||||
* (_UINT32*) t32 ^= * (_UINT32*) f32;
|
||||
t32++;
|
||||
f32++;
|
||||
}
|
||||
@@ -579,7 +579,7 @@ void of_add_to_symbol (void *to,
|
||||
{
|
||||
for (i = 0; i < symbolSize32rem; i++)
|
||||
{
|
||||
* (UINT8*) ( (UINT8*) t32 + i) ^= * (UINT8*) ( (UINT8*) f32 + i);
|
||||
* (_UINT8*) ( (_UINT8*) t32 + i) ^= * (_UINT8*) ( (_UINT8*) f32 + i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -588,8 +588,8 @@ void of_add_to_symbol (void *to,
|
||||
/*
|
||||
* 32-bit machines
|
||||
*/
|
||||
UINT32 *t32 = (UINT32*) to; // to pointer to 32-bit integers
|
||||
UINT32 *f32 = (UINT32*) from; // from pointer to 32-bit integers
|
||||
_UINT32 *t32 = (_UINT32*) to; // to pointer to 32-bit integers
|
||||
_UINT32 *f32 = (_UINT32*) from; // from pointer to 32-bit integers
|
||||
/* First perform as many 32-bit XORs as needed... */
|
||||
for (i = symbolSize32; i > 0; i--)
|
||||
{
|
||||
@@ -603,7 +603,7 @@ void of_add_to_symbol (void *to,
|
||||
{
|
||||
for (i = 0; i < symbolSize32rem; i++)
|
||||
{
|
||||
* (UINT8*) ( (UINT8*) t32 + i) ^= * (UINT8*) ( (UINT8*) f32 + i);
|
||||
* (_UINT8*) ( (_UINT8*) t32 + i) ^= * (_UINT8*) ( (_UINT8*) f32 + i);
|
||||
}
|
||||
}
|
||||
#endif //defined (__LP64__) || (__WORDSIZE == 64) }
|
||||
@@ -614,9 +614,9 @@ void of_add_to_symbol (void *to,
|
||||
* machine with SSE capable CPU
|
||||
* Use assembly language to XOR two 128 bit registers at a time.
|
||||
*/
|
||||
UINT32 symbolSize32rem = symbol_size % 16; // Remaining bytes when the symbol
|
||||
_UINT32 symbolSize32rem = symbol_size % 16; // Remaining bytes when the symbol
|
||||
// size is not multiple of 32 bits.
|
||||
UINT32 symbolSize128;
|
||||
_UINT32 symbolSize128;
|
||||
symbolSize128 = symbol_size >> 4;
|
||||
float *dst128;
|
||||
float *src128;
|
||||
@@ -637,7 +637,7 @@ void of_add_to_symbol (void *to,
|
||||
{
|
||||
for (i = 0; i < symbolSize32rem; i++)
|
||||
{
|
||||
* (UINT8*) ( (UINT8*) dst128 + i) ^= * (UINT8*) ( (UINT8*) src128 + i);
|
||||
* (_UINT8*) ( (_UINT8*) dst128 + i) ^= * (_UINT8*) ( (_UINT8*) src128 + i);
|
||||
}
|
||||
}
|
||||
#endif /* } ASSEMBLY_SSE_OPT */
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
|
||||
typedef struct of_symbol_stats_op
|
||||
{
|
||||
UINT32 nb_xor_for_IT;
|
||||
UINT32 nb_xor_for_ML;
|
||||
_UINT32 nb_xor_for_IT;
|
||||
_UINT32 nb_xor_for_ML;
|
||||
} of_symbol_stats_op_t;
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ typedef struct of_symbol_stats_op
|
||||
* @param matrix_col (IN) number of the matrix column
|
||||
* @return Error status.
|
||||
*/
|
||||
#define of_get_symbol_esi(ofcb,matrix_col) (((matrix_col) < (ofcb)->nb_repair_symbols) ? (INT32)((matrix_col) + (ofcb)->nb_source_symbols) : (INT32)((matrix_col) - (ofcb)->nb_repair_symbols))
|
||||
#define of_get_symbol_esi(ofcb,matrix_col) (((matrix_col) < (ofcb)->nb_repair_symbols) ? (_INT32)((matrix_col) + (ofcb)->nb_source_symbols) : (_INT32)((matrix_col) - (ofcb)->nb_repair_symbols))
|
||||
|
||||
/**
|
||||
* @brief get symbol matrix column
|
||||
@@ -75,7 +75,7 @@ typedef struct of_symbol_stats_op
|
||||
* @param esi (IN) encoding symbol ID
|
||||
* @return Error status.
|
||||
*/
|
||||
#define of_get_symbol_col(ofcb,esi) (((esi) < (ofcb)->nb_source_symbols) ? (INT32)((esi) + (ofcb)->nb_repair_symbols) : (INT32)((esi) - (ofcb)->nb_source_symbols))
|
||||
#define of_get_symbol_col(ofcb,esi) (((esi) < (ofcb)->nb_source_symbols) ? (_INT32)((esi) + (ofcb)->nb_repair_symbols) : (_INT32)((esi) - (ofcb)->nb_source_symbols))
|
||||
|
||||
/**
|
||||
* Compute the XOR sum of two symbols: to = to + from.
|
||||
@@ -90,12 +90,12 @@ typedef struct of_symbol_stats_op
|
||||
#ifdef OF_DEBUG
|
||||
void of_add_to_symbol (void *to,
|
||||
const void *from,
|
||||
UINT32 symbol_size,
|
||||
UINT32*);
|
||||
_UINT32 symbol_size,
|
||||
_UINT32*);
|
||||
#else
|
||||
void of_add_to_symbol (void *to,
|
||||
const void *from,
|
||||
UINT32 symbol_size);
|
||||
_UINT32 symbol_size);
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -112,14 +112,14 @@ void of_add_to_symbol (void *to,
|
||||
#ifdef OF_DEBUG
|
||||
void of_add_from_multiple_symbols (void *to,
|
||||
const void **from,
|
||||
UINT32 from_size,
|
||||
UINT32 symbol_size,
|
||||
UINT32*);
|
||||
_UINT32 from_size,
|
||||
_UINT32 symbol_size,
|
||||
_UINT32*);
|
||||
#else
|
||||
void of_add_from_multiple_symbols (void *to,
|
||||
const void **from,
|
||||
UINT32 from_size,
|
||||
UINT32 symbol_size);
|
||||
_UINT32 from_size,
|
||||
_UINT32 symbol_size);
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -136,14 +136,14 @@ void of_add_from_multiple_symbols (void *to,
|
||||
#ifdef OF_DEBUG
|
||||
void of_add_to_multiple_symbols (void **to,
|
||||
const void *from,
|
||||
UINT32 to_size,
|
||||
UINT32 symbol_size,
|
||||
UINT32*);
|
||||
_UINT32 to_size,
|
||||
_UINT32 symbol_size,
|
||||
_UINT32*);
|
||||
#else
|
||||
void of_add_to_multiple_symbols (void **to,
|
||||
const void *from,
|
||||
UINT32 to_size,
|
||||
UINT32 symbol_size);
|
||||
_UINT32 to_size,
|
||||
_UINT32 symbol_size);
|
||||
#endif
|
||||
|
||||
#ifdef OF_DEBUG
|
||||
|
||||
6
thirdparty/openfec/src/lib_common/of_cb.h
vendored
6
thirdparty/openfec/src/lib_common/of_cb.h
vendored
@@ -46,9 +46,9 @@ typedef struct of_cb
|
||||
{
|
||||
of_codec_id_t codec_id;
|
||||
of_codec_type_t codec_type;
|
||||
UINT32 nb_source_symbols;
|
||||
UINT32 nb_repair_symbols;
|
||||
UINT32 encoding_symbol_length;
|
||||
_UINT32 nb_source_symbols;
|
||||
_UINT32 nb_repair_symbols;
|
||||
_UINT32 encoding_symbol_length;
|
||||
} of_cb_t;
|
||||
|
||||
#endif //OF_CB
|
||||
|
||||
8
thirdparty/openfec/src/lib_common/of_mem.c
vendored
8
thirdparty/openfec/src/lib_common/of_mem.c
vendored
@@ -65,16 +65,16 @@ void of_free (void* ptr)
|
||||
|
||||
|
||||
#if 0
|
||||
void of_dump_buffer (char* buf, UINT32 size)
|
||||
void of_dump_buffer (char* buf, _UINT32 size)
|
||||
{
|
||||
UINT32 i;
|
||||
UINT32 *s32;
|
||||
_UINT32 i;
|
||||
_UINT32 *s32;
|
||||
|
||||
if (size % 4 != 0)
|
||||
{
|
||||
size = (size % 4) * 4;
|
||||
}
|
||||
for (i = 0, s32 = (UINT32*)buf; i < size; i += 4, s32++)
|
||||
for (i = 0, s32 = (_UINT32*)buf; i < size; i += 4, s32++)
|
||||
{
|
||||
printf ("%08x ", *s32);
|
||||
}
|
||||
|
||||
@@ -48,11 +48,11 @@
|
||||
#include "../lib_advanced/ldpc_from_file/of_ldpc_ff_includes.h"
|
||||
#endif
|
||||
|
||||
UINT32 of_verbosity;
|
||||
_UINT32 of_verbosity;
|
||||
|
||||
of_status_t of_create_codec_instance(of_session_t** ses, of_codec_id_t codec_id,
|
||||
of_codec_type_t codec_type,
|
||||
UINT32 verbosity) {
|
||||
_UINT32 verbosity) {
|
||||
of_status_t status;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
@@ -232,10 +232,10 @@ error:
|
||||
|
||||
of_status_t of_set_callback_functions(
|
||||
of_session_t* ses,
|
||||
void* (*decoded_source_symbol_callback)(void* context, UINT32 size,
|
||||
UINT32 esi),
|
||||
void* (*decoded_repair_symbol_callback)(void* context, UINT32 size,
|
||||
UINT32 esi),
|
||||
void* (*decoded_source_symbol_callback)(void* context, _UINT32 size,
|
||||
_UINT32 esi),
|
||||
void* (*decoded_repair_symbol_callback)(void* context, _UINT32 size,
|
||||
_UINT32 esi),
|
||||
void* context_4_callback) {
|
||||
of_status_t status;
|
||||
|
||||
@@ -338,7 +338,7 @@ of_status_t of_more_about(of_session_t* ses, char** version_str,
|
||||
|
||||
of_status_t of_build_repair_symbol(of_session_t* ses,
|
||||
void* encoding_symbols_tab[],
|
||||
UINT32 esi_of_symbol_to_build) {
|
||||
_UINT32 esi_of_symbol_to_build) {
|
||||
of_status_t status;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
@@ -402,7 +402,7 @@ error:
|
||||
|
||||
of_status_t of_decode_with_new_symbol(of_session_t* ses,
|
||||
void* const new_symbol_buf,
|
||||
UINT32 new_symbol_esi) {
|
||||
_UINT32 new_symbol_esi) {
|
||||
of_status_t status;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
@@ -691,8 +691,8 @@ error:
|
||||
return OF_STATUS_FATAL_ERROR;
|
||||
}
|
||||
|
||||
of_status_t of_set_control_parameter(of_session_t* ses, UINT32 type,
|
||||
void* value, UINT32 length) {
|
||||
of_status_t of_set_control_parameter(of_session_t* ses, _UINT32 type,
|
||||
void* value, _UINT32 length) {
|
||||
of_status_t status;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
@@ -744,8 +744,8 @@ error:
|
||||
return OF_STATUS_FATAL_ERROR;
|
||||
}
|
||||
|
||||
of_status_t of_get_control_parameter(of_session_t* ses, UINT32 type,
|
||||
void* value, UINT32 length) {
|
||||
of_status_t of_get_control_parameter(of_session_t* ses, _UINT32 type,
|
||||
void* value, _UINT32 length) {
|
||||
of_status_t status;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
|
||||
@@ -124,7 +124,7 @@ typedef enum {
|
||||
* Specifies if this codec instance is a pure encoder, a pure decoder, or a
|
||||
* codec capable of both encoding and decoding.
|
||||
*/
|
||||
typedef UINT8 of_codec_type_t;
|
||||
typedef _UINT8 of_codec_type_t;
|
||||
|
||||
#define OF_ENCODER 0x1
|
||||
#define OF_DECODER 0x2
|
||||
@@ -178,13 +178,13 @@ typedef struct of_session {
|
||||
* happen.
|
||||
*/
|
||||
typedef struct of_parameters {
|
||||
UINT32 nb_source_symbols;
|
||||
UINT32 nb_repair_symbols;
|
||||
UINT32 encoding_symbol_length;
|
||||
_UINT32 nb_source_symbols;
|
||||
_UINT32 nb_repair_symbols;
|
||||
_UINT32 encoding_symbol_length;
|
||||
} of_parameters_t;
|
||||
|
||||
/** Verbosity level for the whole library. */
|
||||
extern UINT32 of_verbosity;
|
||||
extern _UINT32 of_verbosity;
|
||||
|
||||
/****** OpenFEC.org general methods/functions
|
||||
* *****************************************************/
|
||||
@@ -200,7 +200,7 @@ extern UINT32 of_verbosity;
|
||||
*current codec instance.
|
||||
*
|
||||
* @fn of_status_t of_create_codec_instance (of_session_t** ses,
|
||||
*of_codec_id_t codec_id, of_codec_type_t codec_type, UINT32 verbosity)
|
||||
*of_codec_id_t codec_id, of_codec_type_t codec_type, _UINT32 verbosity)
|
||||
* @brief create a codec instance
|
||||
*02@param ses (IN/OUT) address of the pointer to a session. This
|
||||
*pointer is updated by this function. In case of success, it points to a
|
||||
@@ -215,7 +215,7 @@ extern UINT32 of_verbosity;
|
||||
*/
|
||||
of_status_t of_create_codec_instance(of_session_t** ses, of_codec_id_t codec_id,
|
||||
of_codec_type_t codec_type,
|
||||
UINT32 verbosity);
|
||||
_UINT32 verbosity);
|
||||
|
||||
/**
|
||||
* This function releases all the internal resources used by this FEC codec
|
||||
@@ -280,9 +280,9 @@ of_status_t of_set_fec_parameters(of_session_t* ses, of_parameters_t* params);
|
||||
* initialized accordingly by the application, since it is application specific.
|
||||
*
|
||||
* @fn of_status_t of_set_callback_functions (of_session_t *ses,void*
|
||||
*(*decoded_source_symbol_callback) (void *context,UINT32 size,UINT32
|
||||
*esi), void* (*decoded_repair_symbol_callback) (void *context,UINT32
|
||||
*size,UINT32 esi),void* context_4_callback)
|
||||
*(*decoded_source_symbol_callback) (void *context,_UINT32 size,_UINT32
|
||||
*esi), void* (*decoded_repair_symbol_callback) (void *context,_UINT32
|
||||
*size,_UINT32 esi),void* context_4_callback)
|
||||
* @brief set various callbock functions (see header
|
||||
*of_open_fec_api.h) 02@param ses (IN) Pointer to the session.
|
||||
*
|
||||
@@ -305,11 +305,11 @@ of_status_t of_set_fec_parameters(of_session_t* ses, of_parameters_t* params);
|
||||
of_status_t of_set_callback_functions(
|
||||
of_session_t* ses,
|
||||
void* (*decoded_source_symbol_callback)(
|
||||
void* context, UINT32 size, /* size of decoded source symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
void* context, _UINT32 size, /* size of decoded source symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
void* (*decoded_repair_symbol_callback)(
|
||||
void* context, UINT32 size, /* size of decoded repair symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {k..n-1} */
|
||||
void* context, _UINT32 size, /* size of decoded repair symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {k..n-1} */
|
||||
void* context_4_callback);
|
||||
|
||||
#ifdef OF_USE_ENCODER
|
||||
@@ -332,7 +332,7 @@ of_status_t of_set_callback_functions(
|
||||
*in which case the library only copies the newly built symbol to it.
|
||||
*
|
||||
* @fn of_status_t of_build_repair_symbol (of_session_t* ses, void*
|
||||
*encoding_symbols_tab[], UINT32 esi_of_symbol_to_build)
|
||||
*encoding_symbols_tab[], _UINT32 esi_of_symbol_to_build)
|
||||
* @brief build a repair symbol (encoder only)
|
||||
*02@param ses (IN) Pointer to the session.
|
||||
* @param encoding_symbols_tab (IN/OUT) table of source and repair symbols.
|
||||
@@ -346,7 +346,7 @@ of_status_t of_set_callback_functions(
|
||||
*/
|
||||
of_status_t of_build_repair_symbol(of_session_t* ses,
|
||||
void* encoding_symbols_tab[],
|
||||
UINT32 esi_of_symbol_to_build);
|
||||
_UINT32 esi_of_symbol_to_build);
|
||||
|
||||
#endif /* OF_USE_ENCODER */
|
||||
|
||||
@@ -373,7 +373,7 @@ of_status_t of_build_repair_symbol(of_session_t* ses,
|
||||
*received symbols.
|
||||
*
|
||||
* @fn of_status_t of_decode_with_new_symbol (of_session_t* ses,
|
||||
*void* const new_symbol_buf, UINT32 new_symbol_esi)
|
||||
*void* const new_symbol_buf, _UINT32 new_symbol_esi)
|
||||
* @brief (try to) decode with a newly received symbol
|
||||
*02@param ses (IN) Pointer to the session.
|
||||
* @param new_symbol_buf (IN) Pointer to the encoding symbol now
|
||||
@@ -386,7 +386,7 @@ of_status_t of_build_repair_symbol(of_session_t* ses,
|
||||
*/
|
||||
of_status_t of_decode_with_new_symbol(of_session_t* ses,
|
||||
void* const new_symbol_buf,
|
||||
UINT32 new_symbol_esi);
|
||||
_UINT32 new_symbol_esi);
|
||||
|
||||
/**
|
||||
* Inform the decoder of all the available (e.g. received from the network)
|
||||
@@ -513,8 +513,8 @@ of_status_t of_more_about(of_session_t* ses, char** version_str,
|
||||
* @param length (IN) length of pointer value
|
||||
* @return Error status.
|
||||
*/
|
||||
of_status_t of_set_control_parameter(of_session_t* ses, UINT32 type,
|
||||
void* value, UINT32 length);
|
||||
of_status_t of_set_control_parameter(of_session_t* ses, _UINT32 type,
|
||||
void* value, _UINT32 length);
|
||||
|
||||
/**
|
||||
* This function gets a FEC scheme/FEC codec specific control parameter, in
|
||||
@@ -530,8 +530,8 @@ of_status_t of_set_control_parameter(of_session_t* ses, UINT32 type,
|
||||
* @param length (IN) length of pointer value
|
||||
* @return Error status.
|
||||
*/
|
||||
of_status_t of_get_control_parameter(of_session_t* ses, UINT32 type,
|
||||
void* value, UINT32 length);
|
||||
of_status_t of_get_control_parameter(of_session_t* ses, _UINT32 type,
|
||||
void* value, _UINT32 length);
|
||||
|
||||
/**
|
||||
* Control parameters for of_set_control_parameter()/of_get_control_parameter()
|
||||
@@ -549,7 +549,7 @@ of_status_t of_get_control_parameter(of_session_t* ses, UINT32 type,
|
||||
* may add some practical additional limits, e.g. caused by memory management
|
||||
* aspects (maximum working memory), or by internal codec implementation
|
||||
* details, e.g. the fact an index is stored in 16-bit integers. This is true
|
||||
* both for k and n. Argument: UINT32
|
||||
* both for k and n. Argument: _UINT32
|
||||
*/
|
||||
#define OF_CTRL_GET_MAX_K 1
|
||||
|
||||
@@ -559,7 +559,7 @@ of_status_t of_get_control_parameter(of_session_t* ses, UINT32 type,
|
||||
* may add some practical additional limits, e.g. caused by memory management
|
||||
* aspects (maximum working memory), or by internal codec implementation
|
||||
* details, e.g. the fact an index is stored in 16-bit integers. This is true
|
||||
* both for k and n. Argument: UINT32
|
||||
* both for k and n. Argument: _UINT32
|
||||
*/
|
||||
#define OF_CTRL_GET_MAX_N 2
|
||||
|
||||
@@ -581,8 +581,8 @@ of_status_t of_get_control_parameter(of_session_t* ses, UINT32 type,
|
||||
* @return Error status.
|
||||
*/
|
||||
bool of_get_decoding_success_proba (of_session_t* ses,
|
||||
UINT32 nb_available_source_symbols,
|
||||
UINT32 nb_available_repair_symbols);
|
||||
_UINT32 nb_available_source_symbols,
|
||||
_UINT32 nb_available_repair_symbols);
|
||||
#endif
|
||||
|
||||
#endif /* OPENFEC_API_H */
|
||||
|
||||
18
thirdparty/openfec/src/lib_common/of_rand.c
vendored
18
thirdparty/openfec/src/lib_common/of_rand.c
vendored
@@ -206,7 +206,7 @@
|
||||
#include "of_rand.h"
|
||||
|
||||
|
||||
UINT64 of_seed;
|
||||
_UINT64 of_seed;
|
||||
|
||||
/**
|
||||
* Set this constant to check the conformity for this prng.
|
||||
@@ -222,8 +222,8 @@ void
|
||||
of_check_prng (void)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
INT32 i;
|
||||
UINT64 val;
|
||||
_INT32 i;
|
||||
_UINT64 val;
|
||||
|
||||
of_seed = 1;
|
||||
for (i = 0; i < 10000; i++)
|
||||
@@ -249,7 +249,7 @@ of_check_prng (void)
|
||||
* Initialize the PRNG with a of_seed between 1 and 0x7FFFFFFE
|
||||
* (2^^31-2) inclusive.
|
||||
*/
|
||||
void of_rfc5170_srand (UINT64 s)
|
||||
void of_rfc5170_srand (_UINT64 s)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
if ( (s >= 1) && (s <= 0x7FFFFFFE))
|
||||
@@ -279,20 +279,20 @@ void of_rfc5170_srand (UINT64 s)
|
||||
* This value is then scaled between 0 and maxv-1 inclusive.
|
||||
* This is the PRNG required by the LDPC-staircase RFC 5170.
|
||||
*/
|
||||
UINT64
|
||||
of_rfc5170_rand (UINT64 maxv)
|
||||
_UINT64
|
||||
of_rfc5170_rand (_UINT64 maxv)
|
||||
{
|
||||
//OF_ENTER_FUNCTION
|
||||
UINT64 hi, lo;
|
||||
_UINT64 hi, lo;
|
||||
lo = 16807 * (of_seed & 0xFFFF);
|
||||
hi = 16807 * (of_seed >> 16);
|
||||
lo += (hi & 0x7FFF) << 16;
|
||||
lo += hi >> 15;
|
||||
if (lo > 0x7FFFFFFF)
|
||||
lo -= 0x7FFFFFFF;
|
||||
of_seed = (UINT64) lo;
|
||||
of_seed = (_UINT64) lo;
|
||||
//OF_EXIT_FUNCTION
|
||||
return ( (UINT64)
|
||||
return ( (_UINT64)
|
||||
( (double) of_seed * (double) maxv / (double) 0x7FFFFFFF));
|
||||
}
|
||||
|
||||
|
||||
8
thirdparty/openfec/src/lib_common/of_rand.h
vendored
8
thirdparty/openfec/src/lib_common/of_rand.h
vendored
@@ -36,17 +36,17 @@
|
||||
|
||||
|
||||
/**
|
||||
* \fn void of_rfc5170_srand (UINT64 s)
|
||||
* \fn void of_rfc5170_srand (_UINT64 s)
|
||||
* \brief Initialize the PRNG with a of_seed between 1 and 0x7FFFFFFE
|
||||
* (2^^31-2) inclusive.
|
||||
* \param s (IN) seed
|
||||
* \return void
|
||||
*/
|
||||
void of_rfc5170_srand (UINT64 s);
|
||||
void of_rfc5170_srand (_UINT64 s);
|
||||
|
||||
|
||||
/**
|
||||
* \fn UINT64 of_rfc5170_rand (UINT64 maxv)
|
||||
* \fn _UINT64 of_rfc5170_rand (_UINT64 maxv)
|
||||
* \brief Derived from rand31pmc, Robin Whittle, Sept 20th 2005.
|
||||
* http://www.firstpr.com.au/dsp/rand31/
|
||||
* 16807 multiplier constant (7^^5)
|
||||
@@ -57,6 +57,6 @@ void of_rfc5170_srand (UINT64 s);
|
||||
* This is the PRNG required by the LDPC-staircase RFC 5170.
|
||||
* \return Returns a random integer between 0 and maxv-1 inclusive.
|
||||
*/
|
||||
UINT64 of_rfc5170_rand (UINT64 maxv);
|
||||
_UINT64 of_rfc5170_rand (_UINT64 maxv);
|
||||
|
||||
#endif //OF_RAND
|
||||
|
||||
139
thirdparty/openfec/src/lib_common/of_types.h
vendored
139
thirdparty/openfec/src/lib_common/of_types.h
vendored
@@ -38,39 +38,39 @@
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifndef bool
|
||||
#define bool UINT32
|
||||
#define bool _UINT32
|
||||
#define true 1
|
||||
#define false 0
|
||||
#endif
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
#ifndef UINT32
|
||||
#define INT8 char
|
||||
#define INT16 short
|
||||
#define UINT8 unsigned char
|
||||
#define UINT16 unsigned short
|
||||
#ifndef _UINT32
|
||||
#define _INT8 char
|
||||
#define _INT16 short
|
||||
#define _UINT8 unsigned char
|
||||
#define _UINT16 unsigned short
|
||||
|
||||
#if defined(__LP64__) || (__WORDSIZE == 64) /* 64 bit architectures */
|
||||
#define INT32 int /* yes, it's also true in LP64! */
|
||||
#define UINT32 unsigned int /* yes, it's also true in LP64! */
|
||||
#define _INT32 int /* yes, it's also true in LP64! */
|
||||
#define _UINT32 unsigned int /* yes, it's also true in LP64! */
|
||||
|
||||
#else /* 32 bit architectures */
|
||||
|
||||
#define INT32 int /* int creates fewer compilations pbs than long */
|
||||
#define UINT32 unsigned int /* int creates fewer compilations pbs than long */
|
||||
#define _INT32 int /* int creates fewer compilations pbs than long */
|
||||
#define _UINT32 unsigned int /* int creates fewer compilations pbs than long */
|
||||
#endif /* 32/64 architectures */
|
||||
|
||||
#endif /* !UINT32 */
|
||||
#endif /* !_UINT32 */
|
||||
|
||||
#ifndef UINT64
|
||||
#ifdef WIN32
|
||||
#define INT64 __int64
|
||||
#define UINT64 __uint64
|
||||
#else /* UNIX */
|
||||
#define INT64 long long
|
||||
#define UINT64 unsigned long long
|
||||
#endif /* OS */
|
||||
#endif /* !UINT64 */
|
||||
#ifndef _UINT64
|
||||
// #ifdef _WIN32
|
||||
// #define _INT64 __int64
|
||||
// #define _UINT64 __uint64
|
||||
// #else /* UNIX */
|
||||
#define _INT64 long long
|
||||
#define _UINT64 unsigned long long
|
||||
// #endif /* OS */
|
||||
#endif /* !_UINT64 */
|
||||
|
||||
|
||||
/**
|
||||
@@ -79,4 +79,103 @@
|
||||
*/
|
||||
typedef unsigned char gf;
|
||||
|
||||
/* VR: added for WIN CE support */
|
||||
#ifdef _WIN32_WCE
|
||||
#define bzero(to,sz) memset((to), 0, (sz))
|
||||
|
||||
#define bcmp(a,b,sz) memcmp((a), (b), (sz))
|
||||
#endif /* WIN32_WCE */
|
||||
|
||||
/*
|
||||
* compatibility stuff
|
||||
*/
|
||||
#if defined(_WIN32) /* but also for others, e.g. sun... */
|
||||
#define NEED_BCOPY
|
||||
#define bcmp(a,b,n) memcmp(a,b,n)
|
||||
#endif
|
||||
|
||||
#ifdef NEED_BCOPY
|
||||
#define bcopy(s, d, siz) memcpy((d), (s), (siz))
|
||||
#define bzero(d, siz) memset((d), '\0', (siz))
|
||||
#endif
|
||||
|
||||
#ifndef _UINT32
|
||||
#define _UINT32 unsigned long
|
||||
#endif
|
||||
|
||||
/*
|
||||
* stuff used for testing purposes only
|
||||
*/
|
||||
|
||||
#ifdef TICK /* VR: avoid a warning under Solaris */
|
||||
#undef TICK
|
||||
#endif
|
||||
|
||||
//#define TEST
|
||||
#ifdef TEST /* { */
|
||||
|
||||
#define DEB(x) x
|
||||
#define DDB(x) x
|
||||
#define OF_RS_DEBUG 4 /* minimal debugging */
|
||||
#if defined(_WIN32)
|
||||
#include <time.h>
|
||||
struct timeval
|
||||
{
|
||||
unsigned long ticks;
|
||||
};
|
||||
#define gettimeofday(x, dummy) { (x)->ticks = clock() ; }
|
||||
#define DIFF_T(a,b) (1+ 1000000*(a.ticks - b.ticks) / CLOCKS_PER_SEC )
|
||||
typedef unsigned long _UINT32 ;
|
||||
typedef unsigned short u_short ;
|
||||
#else /* typically, unix systems */
|
||||
#include <sys/time.h>
|
||||
#define DIFF_T(a,b) \
|
||||
(1+ 1000000*(a.tv_sec - b.tv_sec) + (a.tv_usec - b.tv_usec) )
|
||||
#endif
|
||||
|
||||
#define TICK(t) \
|
||||
{struct timeval x ; \
|
||||
gettimeofday(&x, NULL) ; \
|
||||
t = x.tv_usec + 1000000* (x.tv_sec & 0xff ) ; \
|
||||
}
|
||||
#define TOCK(t) \
|
||||
{ _UINT32 t1 ; TICK(t1) ; \
|
||||
if (t1 < t) t = 256000000 + t1 - t ; \
|
||||
else t = t1 - t ; \
|
||||
if (t == 0) t = 1 ;}
|
||||
|
||||
_UINT32 ticks[10]; /* vars for timekeeping */
|
||||
|
||||
#else /* } { */
|
||||
|
||||
#define DEB(x)
|
||||
#define DDB(x)
|
||||
#define TICK(x)
|
||||
#define TOCK(x)
|
||||
|
||||
#endif /* } TEST */
|
||||
|
||||
|
||||
/*
|
||||
* You should not need to change anything beyond this point.
|
||||
* The first part of the file implements linear algebra in GF.
|
||||
*
|
||||
* gf is the type used to store an element of the Galois Field.
|
||||
* Must constain at least GF_BITS bits.
|
||||
*
|
||||
* Note: unsigned char will work up to GF(256) but int seems to run
|
||||
* faster on the Pentium. We use int whenever have to deal with an
|
||||
* index, since they are generally faster.
|
||||
*/
|
||||
#if (GF_BITS < 2 && GF_BITS >16)
|
||||
#error "GF_BITS must be 2 .. 16"
|
||||
#endif
|
||||
/*#if (GF_BITS <= 8)
|
||||
typedef unsigned char gf;
|
||||
#else
|
||||
typedef unsigned short gf;
|
||||
#endif*/
|
||||
|
||||
#define GF_SIZE ((1 << GF_BITS) - 1) /* powers of \alpha */
|
||||
|
||||
#endif //OF_TYPES
|
||||
|
||||
@@ -44,21 +44,21 @@
|
||||
typedef struct of_symbols_stats
|
||||
{
|
||||
/** Number of source symbols received by decoder (they havn't been decoded). */
|
||||
UINT32 nb_source_symbols_received;
|
||||
_UINT32 nb_source_symbols_received;
|
||||
/** Number of repair symbols received by decoder (they havn't been decoded). */
|
||||
UINT32 nb_repair_symbols_received;
|
||||
_UINT32 nb_repair_symbols_received;
|
||||
/** Number of source symbols decoded during IT decoding. */
|
||||
UINT32 nb_source_symbols_built_with_it;
|
||||
_UINT32 nb_source_symbols_built_with_it;
|
||||
/** Number of source symbols decoded during ML decoding. */
|
||||
UINT32 nb_source_symbols_built_with_ml;
|
||||
_UINT32 nb_source_symbols_built_with_ml;
|
||||
/** Number of repair symbols decoded during IT decoding. */
|
||||
UINT32 nb_repair_symbols_built_with_it;
|
||||
_UINT32 nb_repair_symbols_built_with_it;
|
||||
/** Number of repair symbols decoded during ML decoding. */
|
||||
UINT32 nb_repair_symbols_built_with_ml;
|
||||
_UINT32 nb_repair_symbols_built_with_ml;
|
||||
/** Number of source symbols ...... */
|
||||
UINT32 nb_source_symbols_ignored;
|
||||
_UINT32 nb_source_symbols_ignored;
|
||||
/** Number of repair symbols ...... */
|
||||
UINT32 nb_repair_symbols_ignored;
|
||||
_UINT32 nb_repair_symbols_ignored;
|
||||
} of_symbols_stats_t;
|
||||
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
|
||||
typedef struct of_2d_symbol_stats_op
|
||||
{
|
||||
UINT32 nb_xor_for_IT;
|
||||
UINT32 nb_xor_for_ML;
|
||||
_UINT32 nb_xor_for_IT;
|
||||
_UINT32 nb_xor_for_ML;
|
||||
} of_2d_symbol_stats_op_t;
|
||||
|
||||
/**
|
||||
@@ -56,12 +56,12 @@ typedef struct of_2d_parity_cb
|
||||
************************************************************************** */
|
||||
of_codec_id_t codec_id; /* must begin with fec_codec_id * */
|
||||
of_codec_type_t codec_type; /* must be 2nd item * */
|
||||
UINT32 nb_source_symbols; /** k parameter (AKA code dimension).* */
|
||||
UINT32 nb_repair_symbols; /** r = n - k parameter. * */
|
||||
UINT32 encoding_symbol_length; /** symbol length. * */
|
||||
_UINT32 nb_source_symbols; /** k parameter (AKA code dimension).* */
|
||||
_UINT32 nb_repair_symbols; /** r = n - k parameter. * */
|
||||
_UINT32 encoding_symbol_length; /** symbol length. * */
|
||||
/************************************************************************* */
|
||||
|
||||
UINT32 nb_total_symbols; /** n parameter (AKA code length). */
|
||||
_UINT32 nb_total_symbols; /** n parameter (AKA code length). */
|
||||
|
||||
/* parity check matrix */
|
||||
of_mod2sparse* pchk_matrix;
|
||||
@@ -71,21 +71,21 @@ typedef struct of_2d_parity_cb
|
||||
#ifdef OF_DEBUG
|
||||
of_symbols_stats_t* stats_symbols;
|
||||
#endif
|
||||
UINT32 nb_source_symbol_ready; // Number of source symbols ready
|
||||
UINT32 nb_repair_symbol_ready; // Number of parity symbols ready
|
||||
_UINT32 nb_source_symbol_ready; // Number of source symbols ready
|
||||
_UINT32 nb_repair_symbol_ready; // Number of parity symbols ready
|
||||
|
||||
#ifdef ML_DECODING /* { */
|
||||
UINT32 *index_rows; // Indirection index to access initial m_chekValues array
|
||||
UINT32 *index_cols; // Indirection index to access initial symbol array
|
||||
UINT32 remain_cols; // Nb of non empty remaining cols in the future simplified matrix
|
||||
UINT32 remain_rows; // Nb of non empty remaining rows in the future simplified matrix
|
||||
_UINT32 *index_rows; // Indirection index to access initial m_chekValues array
|
||||
_UINT32 *index_cols; // Indirection index to access initial symbol array
|
||||
_UINT32 remain_cols; // Nb of non empty remaining cols in the future simplified matrix
|
||||
_UINT32 remain_rows; // Nb of non empty remaining rows in the future simplified matrix
|
||||
|
||||
of_mod2sparse *pchk_matrix_simplified; // Simplified Parity Check Matrix in sparse mode format
|
||||
of_mod2sparse *original_pchkMatrix;
|
||||
of_mod2sparse* pchk_matrix_gauss; // Parity Check matrix in sparse mode format.
|
||||
// This matrix is also used as a generator matrix
|
||||
UINT32 dec_step; // Current step in the Gauss decoding algorithm
|
||||
UINT32 threshold_simplification; // threshold (number of symbols) above which we
|
||||
_UINT32 dec_step; // Current step in the Gauss decoding algorithm
|
||||
_UINT32 threshold_simplification; // threshold (number of symbols) above which we
|
||||
// run the Gaussian Elimination algorithm
|
||||
#endif /* } ML_DECODING */
|
||||
|
||||
@@ -93,12 +93,12 @@ typedef struct of_2d_parity_cb
|
||||
/** table of all check values, i.e. that contain the constant term of each equation. */
|
||||
void** tab_const_term_of_equ;
|
||||
/** table containing the number of encoding symbols of each equation. */
|
||||
UINT16* tab_nb_enc_symbols_per_equ;
|
||||
_UINT16* tab_nb_enc_symbols_per_equ;
|
||||
/** table containing the number of unknow symbols (i.e. neither received nor decoded
|
||||
* at that time) of each equation. */
|
||||
UINT16* tab_nb_unknown_symbols;
|
||||
_UINT16* tab_nb_unknown_symbols;
|
||||
/** table containing the number of equations in which a repair symbol is included. */
|
||||
UINT16* tab_nb_equ_for_repair;
|
||||
_UINT16* tab_nb_equ_for_repair;
|
||||
|
||||
void** repair_symbols_values;
|
||||
#endif /* } OF_USE_DECODER */
|
||||
@@ -107,22 +107,22 @@ typedef struct of_2d_parity_cb
|
||||
|
||||
/** callbacks registered by the application. */
|
||||
void* (*decoded_source_symbol_callback) (void *context,/* */
|
||||
UINT32 size, /* size of decoded source symbol */
|
||||
UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded source symbol */
|
||||
_UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
void* (*decoded_repair_symbol_callback) (void *context,/* */
|
||||
UINT32 size, /* size of decoded repair symbol */
|
||||
UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded repair symbol */
|
||||
_UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
void* context_4_callback;/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Maximum number of source symbols supported by this codec for practical reasons. */
|
||||
UINT32 max_nb_source_symbols;
|
||||
_UINT32 max_nb_source_symbols;
|
||||
/** Maximum number of encoding symbols supported by this codec for practical reasons. */
|
||||
UINT32 max_nb_encoding_symbols;
|
||||
_UINT32 max_nb_encoding_symbols;
|
||||
|
||||
/** ESI of first non decoded source symbol.
|
||||
* Used by is_decoding_complete function. */
|
||||
UINT32 first_non_decoded;
|
||||
_UINT32 first_non_decoded;
|
||||
|
||||
} of_2d_parity_cb_t;
|
||||
|
||||
@@ -171,8 +171,8 @@ of_status_t of_2d_parity_set_fec_parameters (of_2d_parity_cb_t* ofcb,
|
||||
of_2d_parity_parameters_t* params);
|
||||
/**
|
||||
* @fn of_status_t of_2d_parity_set_callback_functions (of_2d_parity_cb_t *ofcb,void* (*decoded_source_symbol_callback)
|
||||
* (void *context,UINT32 size,UINT32 esi), void* (*decoded_repair_symbol_callback)
|
||||
* (void *context,UINT32 size,UINT32 esi),void* context_4_callback)
|
||||
* (void *context,_UINT32 size,_UINT32 esi), void* (*decoded_repair_symbol_callback)
|
||||
* (void *context,_UINT32 size,_UINT32 esi),void* context_4_callback)
|
||||
* @brief set various callbock functions (see header of_open_fec_api.h)
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
*
|
||||
@@ -196,16 +196,16 @@ of_status_t of_2d_parity_set_fec_parameters (of_2d_parity_cb_t* ofcb,
|
||||
*/
|
||||
of_status_t of_2d_parity_set_callback_functions (of_2d_parity_cb_t* ofcb,
|
||||
void* (*decoded_source_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded source symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded source symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
void* (*decoded_repair_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded repair symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded repair symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
void* context_4_callback);
|
||||
|
||||
#ifdef OF_USE_ENCODER
|
||||
/**
|
||||
* @fn of_status_t of_2d_parity_build_repair_symbol (of_2d_parity_cb_t* ofcb, void* encoding_symbols_tab[], UINT32 esi_of_symbol_to_build)
|
||||
* @fn of_status_t of_2d_parity_build_repair_symbol (of_2d_parity_cb_t* ofcb, void* encoding_symbols_tab[], _UINT32 esi_of_symbol_to_build)
|
||||
* @brief build a repair symbol (encoder only)
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param encoding_symbols_tab (IN/OUT) table of source and repair symbols.
|
||||
@@ -219,12 +219,12 @@ of_status_t of_2d_parity_set_callback_functions (of_2d_parity_cb_t* ofcb,
|
||||
*/
|
||||
of_status_t of_2d_parity_build_repair_symbol (of_2d_parity_cb_t* ofcb,
|
||||
void* encoding_symbols_tab[],
|
||||
UINT32 esi_of_symbol_to_build);
|
||||
_UINT32 esi_of_symbol_to_build);
|
||||
#endif //OF_USE_ENCODER
|
||||
|
||||
#ifdef OF_USE_DECODER
|
||||
/**
|
||||
* @fn of_status_t of_2d_parity_decode_with_new_symbol (of_2d_parity_cb_t* ofcb, void* const new_symbol_buf, UINT32 new_symbol_esi)
|
||||
* @fn of_status_t of_2d_parity_decode_with_new_symbol (of_2d_parity_cb_t* ofcb, void* const new_symbol_buf, _UINT32 new_symbol_esi)
|
||||
* @brief (try to) decode with a newly received symbol
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param new_symbol (IN) Pointer to the encoding symbol now available (i.e. a new
|
||||
@@ -235,7 +235,7 @@ of_status_t of_2d_parity_build_repair_symbol (of_2d_parity_cb_t* ofcb,
|
||||
*/
|
||||
of_status_t of_2d_parity_decode_with_new_symbol (of_2d_parity_cb_t* ofcb,
|
||||
void* new_symbol,
|
||||
UINT32 new_symbol_esi);
|
||||
_UINT32 new_symbol_esi);
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_2d_parity_set_available_symbols (of_2d_parity_cb_t* ofcb, void* const encoding_symbols_tab[]);
|
||||
@@ -281,7 +281,7 @@ of_status_t of_2d_parity_get_source_symbols_tab (of_2d_parity_cb_t* ofcb,
|
||||
void* source_symbols_tab[]);
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_2d_parity_set_control_parameter (of_2d_parity_cb_t* ofcb,UINT32 type,void* value,UINT32 length)
|
||||
* @fn of_status_t of_2d_parity_set_control_parameter (of_2d_parity_cb_t* ofcb,_UINT32 type,void* value,_UINT32 length)
|
||||
* @brief set a specific FEC parameter
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param type (IN) Type of parameter. This type is FEC codec ID specific.
|
||||
@@ -291,12 +291,12 @@ of_status_t of_2d_parity_get_source_symbols_tab (of_2d_parity_cb_t* ofcb,
|
||||
* @return Error status.
|
||||
*/
|
||||
of_status_t of_2d_parity_set_control_parameter(of_2d_parity_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length);
|
||||
_UINT32 length);
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_2d_parity_get_control_parameter (of_2d_parity_cb_t* ofcb,UINT32 type,void* value,UINT32 length)
|
||||
* @fn of_status_t of_2d_parity_get_control_parameter (of_2d_parity_cb_t* ofcb,_UINT32 type,void* value,_UINT32 length)
|
||||
* @brief get a specific FEC parameter
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param type (IN) Type of parameter. This type is FEC codec ID specific.
|
||||
@@ -308,9 +308,9 @@ of_status_t of_2d_parity_set_control_parameter(of_2d_parity_cb_t* ofcb,
|
||||
* @return Error status.
|
||||
*/
|
||||
of_status_t of_2d_parity_get_control_parameter(of_2d_parity_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length);
|
||||
_UINT32 length);
|
||||
|
||||
#endif //OF_USE_DECODER
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ of_status_t of_2d_parity_create_codec_instance (of_2d_parity_cb_t** of_cb)
|
||||
|
||||
of_status_t of_2d_parity_release_codec_instance (of_2d_parity_cb_t* ofcb)
|
||||
{
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
if (ofcb->pchk_matrix != NULL)
|
||||
@@ -161,8 +161,8 @@ of_status_t of_2d_parity_set_fec_parameters (of_2d_parity_cb_t* ofcb,
|
||||
of_2d_parity_parameters_t* params)
|
||||
{
|
||||
of_mod2entry *e;
|
||||
UINT32 row;
|
||||
UINT32 seq;
|
||||
_UINT32 row;
|
||||
_UINT32 seq;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
|
||||
@@ -210,14 +210,14 @@ of_status_t of_2d_parity_set_fec_parameters (of_2d_parity_cb_t* ofcb,
|
||||
#ifdef OF_USE_DECODER
|
||||
if (ofcb->codec_type & OF_DECODER)
|
||||
{
|
||||
ofcb->tab_nb_unknown_symbols = (UINT16*)
|
||||
of_calloc (ofcb->nb_repair_symbols, sizeof (UINT16));
|
||||
ofcb->tab_nb_unknown_symbols = (_UINT16*)
|
||||
of_calloc (ofcb->nb_repair_symbols, sizeof (_UINT16));
|
||||
ofcb->tab_const_term_of_equ = (void**)
|
||||
of_calloc (ofcb->nb_repair_symbols, sizeof (void*));
|
||||
ofcb->tab_nb_equ_for_repair = (UINT16*)
|
||||
of_calloc (ofcb->nb_repair_symbols, sizeof (UINT16));
|
||||
ofcb->tab_nb_enc_symbols_per_equ = (UINT16*)
|
||||
of_calloc (ofcb->nb_repair_symbols, sizeof (UINT16));
|
||||
ofcb->tab_nb_equ_for_repair = (_UINT16*)
|
||||
of_calloc (ofcb->nb_repair_symbols, sizeof (_UINT16));
|
||||
ofcb->tab_nb_enc_symbols_per_equ = (_UINT16*)
|
||||
of_calloc (ofcb->nb_repair_symbols, sizeof (_UINT16));
|
||||
if (ofcb->tab_nb_unknown_symbols == NULL || ofcb->tab_const_term_of_equ == NULL ||
|
||||
ofcb->tab_nb_equ_for_repair == NULL || ofcb->tab_nb_enc_symbols_per_equ == NULL) {
|
||||
goto no_mem;
|
||||
@@ -275,12 +275,12 @@ of_status_t of_2d_parity_set_callback_functions (
|
||||
of_2d_parity_cb_t* ofcb,
|
||||
void* (*decoded_source_symbol_callback) (
|
||||
void *context,
|
||||
UINT32 size, /* size of decoded source symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded source symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
void* (*decoded_repair_symbol_callback) (
|
||||
void *context,
|
||||
UINT32 size, /* size of decoded repair symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {k..n-1} */
|
||||
_UINT32 size, /* size of decoded repair symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {k..n-1} */
|
||||
void* context_4_callback)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
@@ -295,11 +295,11 @@ of_status_t of_2d_parity_set_callback_functions (
|
||||
|
||||
of_status_t of_2d_parity_build_repair_symbol (of_2d_parity_cb_t* ofcb,
|
||||
void* encoding_symbols_tab[],
|
||||
UINT32 esi_of_symbol_to_build)
|
||||
_UINT32 esi_of_symbol_to_build)
|
||||
{
|
||||
of_mod2entry *e;
|
||||
UINT32 col_to_build;
|
||||
UINT32 esi;
|
||||
_UINT32 col_to_build;
|
||||
_UINT32 esi;
|
||||
void *to_add_buf;
|
||||
void *parity_symbol;
|
||||
OF_ENTER_FUNCTION
|
||||
@@ -348,7 +348,7 @@ error:
|
||||
|
||||
of_status_t of_2d_parity_decode_with_new_symbol (of_2d_parity_cb_t* ofcb,
|
||||
void* new_symbol,
|
||||
UINT32 new_symbol_esi)
|
||||
_UINT32 new_symbol_esi)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
return of_linear_binary_code_decode_with_new_symbol((of_linear_binary_code_cb_t*)ofcb,new_symbol,new_symbol_esi);
|
||||
@@ -359,7 +359,7 @@ of_status_t of_2d_parity_set_available_symbols (of_2d_parity_cb_t* ofcb,
|
||||
void* const encoding_symbols_tab[])
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
for (i = 0; i < ofcb->nb_total_symbols; i++)
|
||||
{
|
||||
if (encoding_symbols_tab[i] != NULL)
|
||||
@@ -413,9 +413,9 @@ of_status_t of_2d_parity_get_source_symbols_tab(of_2d_parity_cb_t* ofcb,
|
||||
#endif //OF_USE_DECODER
|
||||
|
||||
of_status_t of_2d_parity_set_control_parameter (of_2d_parity_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length)
|
||||
_UINT32 length)
|
||||
{
|
||||
OF_PRINT_ERROR(("of_2d_parity_set_control_parameter: ERROR, not implemented...\n"))
|
||||
return OF_STATUS_ERROR;
|
||||
@@ -423,30 +423,30 @@ of_status_t of_2d_parity_set_control_parameter (of_2d_parity_cb_t* ofcb,
|
||||
|
||||
|
||||
of_status_t of_2d_parity_get_control_parameter (of_2d_parity_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length)
|
||||
_UINT32 length)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
switch (type) {
|
||||
case OF_CTRL_GET_MAX_K:
|
||||
if (value == NULL || length != sizeof(UINT32)) {
|
||||
if (value == NULL || length != sizeof(_UINT32)) {
|
||||
OF_PRINT_ERROR(("%s: OF_CTRL_GET_MAX_K ERROR: null value or bad length (got %d, expected %zu)\n",
|
||||
__FUNCTION__, length, sizeof(UINT32)))
|
||||
__FUNCTION__, length, sizeof(_UINT32)))
|
||||
goto error;
|
||||
}
|
||||
*(UINT32*)value = ofcb->max_nb_source_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_K (%d)\n", __FUNCTION__, *(UINT32*)value))
|
||||
*(_UINT32*)value = ofcb->max_nb_source_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_K (%d)\n", __FUNCTION__, *(_UINT32*)value))
|
||||
break;
|
||||
|
||||
case OF_CTRL_GET_MAX_N:
|
||||
if (value == NULL || length != sizeof(UINT32)) {
|
||||
if (value == NULL || length != sizeof(_UINT32)) {
|
||||
OF_PRINT_ERROR(("%s: OF_CTRL_GET_MAX_N ERROR: null value or bad length (got %d, expected %zu)\n",
|
||||
__FUNCTION__, length, sizeof(UINT32)))
|
||||
__FUNCTION__, length, sizeof(_UINT32)))
|
||||
goto error;
|
||||
}
|
||||
*(UINT32*)value = ofcb->max_nb_encoding_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_N (%d)\n", __FUNCTION__, *(UINT32*)value))
|
||||
*(_UINT32*)value = ofcb->max_nb_encoding_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_N (%d)\n", __FUNCTION__, *(_UINT32*)value))
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -48,9 +48,9 @@
|
||||
*/
|
||||
typedef struct of_2d_parity_parameters
|
||||
{
|
||||
UINT32 nb_source_symbols; /* must be 1st item */
|
||||
UINT32 nb_repair_symbols; /* must be 2nd item */
|
||||
UINT32 encoding_symbol_length; /* must be 3rd item */
|
||||
_UINT32 nb_source_symbols; /* must be 1st item */
|
||||
_UINT32 nb_repair_symbols; /* must be 2nd item */
|
||||
_UINT32 encoding_symbol_length; /* must be 3rd item */
|
||||
/*
|
||||
* FEC codec id specific attributes follow...
|
||||
*/
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
* Default maximum number of source and encoding symbols for this codec.
|
||||
* This value depends in particular on the kind of decoder used. To this
|
||||
* limit, codec implementation details might add other limits (e.g. if
|
||||
* the ESI values are stored in UINT16 instead of UINT32...).
|
||||
* the ESI values are stored in _UINT16 instead of _UINT32...).
|
||||
*
|
||||
* Hints:
|
||||
* If ML decoding is enabled and used, then limit yourself to a value
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
* Default maximum number of source and encoding symbols for this codec.
|
||||
* This value depends in particular on the kind of decoder used. To this
|
||||
* limit, codec implementation details might add other limits (e.g. if
|
||||
* the ESI values are stored in UINT16 instead of UINT32...).
|
||||
* the ESI values are stored in _UINT16 instead of _UINT32...).
|
||||
*
|
||||
* Hints:
|
||||
* If ML decoding is enabled and used, then limit yourself to a value
|
||||
|
||||
@@ -45,12 +45,12 @@ typedef struct of_ldpc_staircase_cb
|
||||
/****** of_cb part { **************************************************/
|
||||
of_codec_id_t codec_id;
|
||||
of_codec_type_t codec_type;
|
||||
UINT32 nb_source_symbols; /** k parameter (AKA code dimension). */
|
||||
UINT32 nb_repair_symbols; /** r = n - k parameter. */
|
||||
UINT32 encoding_symbol_length; /** symbol length. */
|
||||
_UINT32 nb_source_symbols; /** k parameter (AKA code dimension). */
|
||||
_UINT32 nb_repair_symbols; /** r = n - k parameter. */
|
||||
_UINT32 encoding_symbol_length; /** symbol length. */
|
||||
/****** } of_cb part **************************************************/
|
||||
|
||||
UINT32 nb_total_symbols; /** n parameter (AKA code length). */
|
||||
_UINT32 nb_total_symbols; /** n parameter (AKA code length). */
|
||||
|
||||
/* parity check matrix */
|
||||
of_mod2sparse *pchk_matrix;
|
||||
@@ -60,20 +60,20 @@ typedef struct of_ldpc_staircase_cb
|
||||
#ifdef OF_DEBUG
|
||||
of_symbols_stats_t *stats_symbols;
|
||||
#endif
|
||||
UINT32 nb_source_symbol_ready; // Number of source symbols ready
|
||||
UINT32 nb_repair_symbol_ready; // Number of parity symbols ready
|
||||
_UINT32 nb_source_symbol_ready; // Number of source symbols ready
|
||||
_UINT32 nb_repair_symbol_ready; // Number of parity symbols ready
|
||||
|
||||
#ifdef ML_DECODING /* { */
|
||||
UINT32 *index_rows; // Indirection index to access initial m_chekValues array
|
||||
UINT32 *index_cols; // Indirection index to access initial symbol array
|
||||
UINT32 remain_cols; // Nb of non empty remaining cols in the future simplified matrix
|
||||
UINT32 remain_rows; // Nb of non empty remaining rows in the future simplified matrix
|
||||
_UINT32 *index_rows; // Indirection index to access initial m_chekValues array
|
||||
_UINT32 *index_cols; // Indirection index to access initial symbol array
|
||||
_UINT32 remain_cols; // Nb of non empty remaining cols in the future simplified matrix
|
||||
_UINT32 remain_rows; // Nb of non empty remaining rows in the future simplified matrix
|
||||
|
||||
of_mod2sparse *pchk_matrix_simplified; // Simplified Parity Check Matrix in sparse mode format
|
||||
of_mod2sparse *original_pchkMatrix;
|
||||
of_mod2sparse *pchk_matrix_gauss; // Parity Check matrix in sparse mode format.
|
||||
UINT32 dec_step; // Current step in the Gauss decoding algorithm
|
||||
UINT32 threshold_simplification; // threshold (number of symbols) above which we
|
||||
_UINT32 dec_step; // Current step in the Gauss decoding algorithm
|
||||
_UINT32 threshold_simplification; // threshold (number of symbols) above which we
|
||||
// run the Gaussian Elimination algorithm
|
||||
#endif /* } ML_DECODING */
|
||||
|
||||
@@ -81,43 +81,43 @@ typedef struct of_ldpc_staircase_cb
|
||||
/** table of all check values, i.e. that contain the constant term of each equation. */
|
||||
void** tab_const_term_of_equ;
|
||||
/** table containing the number of encoding symbols of each equation. */
|
||||
UINT16* tab_nb_enc_symbols_per_equ;
|
||||
_UINT16* tab_nb_enc_symbols_per_equ;
|
||||
/** table containing the number of unknow symbols (i.e. neither received nor decoded
|
||||
* at that time) of each equation. */
|
||||
UINT16* tab_nb_unknown_symbols;
|
||||
_UINT16* tab_nb_unknown_symbols;
|
||||
/** table containing the number of equations in which a repair symbol is included. */
|
||||
UINT16* tab_nb_equ_for_repair;
|
||||
_UINT16* tab_nb_equ_for_repair;
|
||||
|
||||
void** repair_symbols_values;
|
||||
void** tmp_tab_symbols;
|
||||
UINT16 nb_tmp_symbols;
|
||||
_UINT16 nb_tmp_symbols;
|
||||
#endif /* } OF_USE_DECODER */
|
||||
|
||||
void **encoding_symbols_tab;
|
||||
|
||||
/** callbacks registered by the application. */
|
||||
void* (*decoded_source_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded source symbol */
|
||||
UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded source symbol */
|
||||
_UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
void* (*decoded_repair_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded repair symbol */
|
||||
UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded repair symbol */
|
||||
_UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
void* context_4_callback;
|
||||
|
||||
/****** } of_linear_binary_code_cb part *******************************/
|
||||
|
||||
/** Maximum number of source symbols supported by this codec for practical reasons. */
|
||||
UINT32 max_nb_source_symbols;
|
||||
_UINT32 max_nb_source_symbols;
|
||||
/** Maximum number of encoding symbols supported by this codec for practical reasons. */
|
||||
UINT32 max_nb_encoding_symbols;
|
||||
_UINT32 max_nb_encoding_symbols;
|
||||
/** Seed used to build this code. */
|
||||
UINT32 prng_seed;
|
||||
_UINT32 prng_seed;
|
||||
/** Target number or "1s" per column for H1 (see RFC5170). */
|
||||
UINT8 N1;
|
||||
_UINT8 N1;
|
||||
/** During H1 creation, have extra entries been added per row to make the row hamming weight at least two? */
|
||||
bool extra_entries_added_in_pchk;
|
||||
/** ESI of first non decoded source symbol. Used by is_decoding_complete function. */
|
||||
UINT32 first_non_decoded;
|
||||
_UINT32 first_non_decoded;
|
||||
} of_ldpc_staircase_cb_t;
|
||||
|
||||
|
||||
@@ -165,8 +165,8 @@ of_status_t of_ldpc_staircase_set_fec_parameters (of_ldpc_staircase_cb_t* ofcb,
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_ldpc_staircase_set_callback_functions (of_ldpc_staircase_cb_t *ofcb,void* (*decoded_source_symbol_callback)
|
||||
* (void *context,UINT32 size,UINT32 esi), void* (*decoded_repair_symbol_callback)
|
||||
* (void *context,UINT32 size,UINT32 esi),void* context_4_callback)
|
||||
* (void *context,_UINT32 size,_UINT32 esi), void* (*decoded_repair_symbol_callback)
|
||||
* (void *context,_UINT32 size,_UINT32 esi),void* context_4_callback)
|
||||
* @brief set various callbock functions (see header of_open_fec_api.h)
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
*
|
||||
@@ -190,16 +190,16 @@ of_status_t of_ldpc_staircase_set_fec_parameters (of_ldpc_staircase_cb_t* ofcb,
|
||||
*/
|
||||
of_status_t of_ldpc_staircase_set_callback_functions (of_ldpc_staircase_cb_t* ofcb,
|
||||
void* (*decoded_source_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded source symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded source symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
void* (*decoded_repair_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded repair symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded repair symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
void* context_4_callback);
|
||||
|
||||
#ifdef OF_USE_ENCODER
|
||||
/**
|
||||
* @fn of_status_t of_ldpc_staircase_build_repair_symbol (of_ldpc_staircase_cb_t* ofcb, void* encoding_symbols_tab[], UINT32 esi_of_symbol_to_build)
|
||||
* @fn of_status_t of_ldpc_staircase_build_repair_symbol (of_ldpc_staircase_cb_t* ofcb, void* encoding_symbols_tab[], _UINT32 esi_of_symbol_to_build)
|
||||
* @brief build a repair symbol (encoder only)
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param encoding_symbols_tab (IN/OUT) table of source and repair symbols.
|
||||
@@ -213,12 +213,12 @@ of_status_t of_ldpc_staircase_set_callback_functions (of_ldpc_staircase_cb_t* o
|
||||
*/
|
||||
of_status_t of_ldpc_staircase_build_repair_symbol (of_ldpc_staircase_cb_t* ofcb,
|
||||
void* encoding_symbols_tab[],
|
||||
UINT32 esi_of_symbol_to_build);
|
||||
_UINT32 esi_of_symbol_to_build);
|
||||
#endif //OF_USE_ENCODER
|
||||
|
||||
#ifdef OF_USE_DECODER
|
||||
/**
|
||||
* @fn of_status_t of_ldpc_staircase_decode_with_new_symbol (of_ldpc_staircase_cb_t* ofcb, void* const new_symbol_buf, UINT32 new_symbol_esi)
|
||||
* @fn of_status_t of_ldpc_staircase_decode_with_new_symbol (of_ldpc_staircase_cb_t* ofcb, void* const new_symbol_buf, _UINT32 new_symbol_esi)
|
||||
* @brief (try to) decode with a newly received symbol
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param new_symbol (IN) Pointer to the encoding symbol now available (i.e. a new
|
||||
@@ -229,7 +229,7 @@ of_status_t of_ldpc_staircase_build_repair_symbol (of_ldpc_staircase_cb_t* ofcb
|
||||
*/
|
||||
of_status_t of_ldpc_staircase_decode_with_new_symbol (of_ldpc_staircase_cb_t* ofcb,
|
||||
void* new_symbol,
|
||||
UINT32 new_symbol_esi);
|
||||
_UINT32 new_symbol_esi);
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_ldpc_staircase_set_available_symbols (of_ldpc_staircase_cb_t* ofcb, void* const encoding_symbols_tab[]);
|
||||
@@ -275,7 +275,7 @@ of_status_t of_ldpc_staircase_get_source_symbols_tab (of_ldpc_staircase_cb_t* of
|
||||
void* source_symbols_tab[]);
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_ldpc_staircase_set_control_parameter (of_ldpc_staircase_cb_t* ofcb,UINT32 type,void* value,UINT32 length)
|
||||
* @fn of_status_t of_ldpc_staircase_set_control_parameter (of_ldpc_staircase_cb_t* ofcb,_UINT32 type,void* value,_UINT32 length)
|
||||
* @brief set a specific FEC parameter
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param type (IN) Type of parameter. This type is FEC codec ID specific.
|
||||
@@ -285,12 +285,12 @@ of_status_t of_ldpc_staircase_get_source_symbols_tab (of_ldpc_staircase_cb_t* of
|
||||
* @return Error status.
|
||||
*/
|
||||
of_status_t of_ldpc_staircase_set_control_parameter(of_ldpc_staircase_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length);
|
||||
_UINT32 length);
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_ldpc_staircase_get_control_parameter (of_ldpc_staircase_cb_t* ofcb, UINT32 type, void* value, UINT32 length)
|
||||
* @fn of_status_t of_ldpc_staircase_get_control_parameter (of_ldpc_staircase_cb_t* ofcb, _UINT32 type, void* value, _UINT32 length)
|
||||
* @brief get a specific FEC parameter
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param type (IN) Type of parameter. This type is FEC codec ID specific.
|
||||
@@ -302,9 +302,9 @@ of_status_t of_ldpc_staircase_set_control_parameter(of_ldpc_staircase_cb_t* ofcb
|
||||
* @return Error status.
|
||||
*/
|
||||
of_status_t of_ldpc_staircase_get_control_parameter(of_ldpc_staircase_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length);
|
||||
_UINT32 length);
|
||||
|
||||
/**
|
||||
* @brief Create the LDPC-Staircase matrix as defined in RFC 5170.
|
||||
@@ -315,10 +315,10 @@ of_status_t of_ldpc_staircase_get_control_parameter(of_ldpc_staircase_cb_t* ofcb
|
||||
* @param ofcb (IN/OUT)
|
||||
* @return pointer to the parity check matrix that has just been allocated and initialized.
|
||||
*/
|
||||
of_mod2sparse* of_create_pchck_matrix_rfc5170_compliant (UINT32 nb_rows,
|
||||
UINT32 nb_cols,
|
||||
UINT32 left_degree,
|
||||
UINT32 seed,
|
||||
of_mod2sparse* of_create_pchck_matrix_rfc5170_compliant (_UINT32 nb_rows,
|
||||
_UINT32 nb_cols,
|
||||
_UINT32 left_degree,
|
||||
_UINT32 seed,
|
||||
of_ldpc_staircase_cb_t *ofcb);
|
||||
|
||||
#endif //OF_USE_DECODER
|
||||
|
||||
@@ -59,7 +59,7 @@ of_status_t of_ldpc_staircase_create_codec_instance (of_ldpc_staircase_cb_t** of
|
||||
of_status_t of_ldpc_staircase_release_codec_instance (of_ldpc_staircase_cb_t* ofcb)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
if (ofcb->pchk_matrix != NULL)
|
||||
{
|
||||
of_mod2sparse_free(ofcb->pchk_matrix);
|
||||
@@ -167,8 +167,8 @@ of_status_t of_ldpc_staircase_set_fec_parameters (of_ldpc_staircase_cb_t* ofcb,
|
||||
of_ldpc_parameters_t* params)
|
||||
{
|
||||
of_mod2entry *e;
|
||||
UINT32 row;
|
||||
UINT32 seq;
|
||||
_UINT32 row;
|
||||
_UINT32 seq;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
|
||||
@@ -191,7 +191,7 @@ of_status_t of_ldpc_staircase_set_fec_parameters (of_ldpc_staircase_cb_t* ofcb,
|
||||
if ((ofcb->nb_repair_symbols = params->nb_repair_symbols) > ofcb->max_nb_encoding_symbols)
|
||||
{
|
||||
/* this test is needed because if the number of repair symbols is
|
||||
* erroneously < 0, because we are using UINT32, this is transformed
|
||||
* erroneously < 0, because we are using _UINT32, this is transformed
|
||||
* into a very large integer, which, when added to k, wraps once again
|
||||
* and the test on nb_total_symbols returns true... */
|
||||
OF_PRINT_ERROR(("of_ldpc_staircase_set_fec_parameters: ERROR, invalid number of repair symbols (got %d, maximum number of encoding symbols is %d)\n",
|
||||
@@ -256,14 +256,14 @@ of_status_t of_ldpc_staircase_set_fec_parameters (of_ldpc_staircase_cb_t* ofcb,
|
||||
#ifdef OF_USE_DECODER
|
||||
if (ofcb->codec_type & OF_DECODER)
|
||||
{
|
||||
ofcb->tab_nb_unknown_symbols = (UINT16*)
|
||||
of_calloc (ofcb->nb_repair_symbols, sizeof (UINT16));
|
||||
ofcb->tab_nb_unknown_symbols = (_UINT16*)
|
||||
of_calloc (ofcb->nb_repair_symbols, sizeof (_UINT16));
|
||||
ofcb->tab_const_term_of_equ = (void**)
|
||||
of_calloc (ofcb->nb_repair_symbols, sizeof (void*));
|
||||
ofcb->tab_nb_equ_for_repair = (UINT16*)
|
||||
of_calloc (ofcb->nb_repair_symbols, sizeof (UINT16));
|
||||
ofcb->tab_nb_enc_symbols_per_equ = (UINT16*)
|
||||
of_calloc (ofcb->nb_repair_symbols, sizeof (UINT16));
|
||||
ofcb->tab_nb_equ_for_repair = (_UINT16*)
|
||||
of_calloc (ofcb->nb_repair_symbols, sizeof (_UINT16));
|
||||
ofcb->tab_nb_enc_symbols_per_equ = (_UINT16*)
|
||||
of_calloc (ofcb->nb_repair_symbols, sizeof (_UINT16));
|
||||
if (ofcb->tab_nb_unknown_symbols == NULL || ofcb->tab_const_term_of_equ == NULL ||
|
||||
ofcb->tab_nb_equ_for_repair == NULL || ofcb->tab_nb_enc_symbols_per_equ == NULL) {
|
||||
goto no_mem;
|
||||
@@ -355,11 +355,11 @@ error:
|
||||
|
||||
of_status_t of_ldpc_staircase_set_callback_functions (of_ldpc_staircase_cb_t* ofcb,
|
||||
void* (*decoded_source_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded source symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded source symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
void* (*decoded_repair_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded repair symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {k..n-1} */
|
||||
_UINT32 size, /* size of decoded repair symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {k..n-1} */
|
||||
void* context_4_callback)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
@@ -375,11 +375,11 @@ of_status_t of_ldpc_staircase_set_callback_functions (of_ldpc_staircase_cb_t* o
|
||||
|
||||
of_status_t of_ldpc_staircase_build_repair_symbol (of_ldpc_staircase_cb_t* ofcb,
|
||||
void* encoding_symbols_tab[],
|
||||
UINT32 esi_of_symbol_to_build)
|
||||
_UINT32 esi_of_symbol_to_build)
|
||||
{
|
||||
of_mod2entry *e;
|
||||
UINT32 col_to_build;
|
||||
UINT32 esi;
|
||||
_UINT32 col_to_build;
|
||||
_UINT32 esi;
|
||||
void *to_add_buf;
|
||||
void *parity_symbol;
|
||||
OF_ENTER_FUNCTION
|
||||
@@ -429,7 +429,7 @@ error:
|
||||
|
||||
of_status_t of_ldpc_staircase_decode_with_new_symbol (of_ldpc_staircase_cb_t* ofcb,
|
||||
void* new_symbol,
|
||||
UINT32 new_symbol_esi)
|
||||
_UINT32 new_symbol_esi)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
return of_linear_binary_code_decode_with_new_symbol((of_linear_binary_code_cb_t*)ofcb, new_symbol, new_symbol_esi);
|
||||
@@ -439,7 +439,7 @@ of_status_t of_ldpc_staircase_decode_with_new_symbol (of_ldpc_staircase_cb_t* of
|
||||
of_status_t of_ldpc_staircase_set_available_symbols (of_ldpc_staircase_cb_t* ofcb,
|
||||
void* const encoding_symbols_tab[])
|
||||
{
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
for (i = 0; i < ofcb->nb_total_symbols; i++)
|
||||
@@ -501,9 +501,9 @@ of_status_t of_ldpc_staircase_get_source_symbols_tab (of_ldpc_staircase_cb_t* of
|
||||
#endif //OF_USE_DECODER
|
||||
|
||||
of_status_t of_ldpc_staircase_set_control_parameter (of_ldpc_staircase_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length)
|
||||
_UINT32 length)
|
||||
{
|
||||
OF_PRINT_ERROR(("of_ldpc_staircase_set_control_parameter: ERROR, not implemented...\n"))
|
||||
return OF_STATUS_ERROR;
|
||||
@@ -511,30 +511,30 @@ of_status_t of_ldpc_staircase_set_control_parameter (of_ldpc_staircase_cb_t* of
|
||||
|
||||
|
||||
of_status_t of_ldpc_staircase_get_control_parameter (of_ldpc_staircase_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length)
|
||||
_UINT32 length)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
switch (type) {
|
||||
case OF_CTRL_GET_MAX_K:
|
||||
if (value == NULL || length != sizeof(UINT32)) {
|
||||
if (value == NULL || length != sizeof(_UINT32)) {
|
||||
OF_PRINT_ERROR(("%s: OF_CTRL_GET_MAX_K ERROR: null value or bad length (got %d, expected %zu)\n",
|
||||
__FUNCTION__, length, sizeof(UINT32)))
|
||||
__FUNCTION__, length, sizeof(_UINT32)))
|
||||
goto error;
|
||||
}
|
||||
*(UINT32*)value = ofcb->max_nb_source_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_K (%d)\n", __FUNCTION__, *(UINT32*)value))
|
||||
*(_UINT32*)value = ofcb->max_nb_source_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_K (%d)\n", __FUNCTION__, *(_UINT32*)value))
|
||||
break;
|
||||
|
||||
case OF_CTRL_GET_MAX_N:
|
||||
if (value == NULL || length != sizeof(UINT32)) {
|
||||
if (value == NULL || length != sizeof(_UINT32)) {
|
||||
OF_PRINT_ERROR(("%s: OF_CTRL_GET_MAX_N ERROR: null value or bad length (got %d, expected %zu)\n",
|
||||
__FUNCTION__, length, sizeof(UINT32)))
|
||||
__FUNCTION__, length, sizeof(_UINT32)))
|
||||
goto error;
|
||||
}
|
||||
*(UINT32*)value = ofcb->max_nb_encoding_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_N (%d)\n", __FUNCTION__, *(UINT32*)value))
|
||||
*(_UINT32*)value = ofcb->max_nb_encoding_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_N (%d)\n", __FUNCTION__, *(_UINT32*)value))
|
||||
break;
|
||||
|
||||
case OF_CRTL_LDPC_STAIRCASE_IS_LAST_SYMBOL_NULL:
|
||||
|
||||
@@ -48,14 +48,14 @@
|
||||
*/
|
||||
typedef struct of_ldpc_parameters
|
||||
{
|
||||
UINT32 nb_source_symbols; /* must be 1st item */
|
||||
UINT32 nb_repair_symbols; /* must be 2nd item */
|
||||
UINT32 encoding_symbol_length; /* must be 3rd item */
|
||||
_UINT32 nb_source_symbols; /* must be 1st item */
|
||||
_UINT32 nb_repair_symbols; /* must be 2nd item */
|
||||
_UINT32 encoding_symbol_length; /* must be 3rd item */
|
||||
/*
|
||||
* FEC codec id specific attributes follow...
|
||||
*/
|
||||
INT32 prng_seed;
|
||||
UINT8 N1;
|
||||
_INT32 prng_seed;
|
||||
_UINT8 N1;
|
||||
} of_ldpc_parameters_t;
|
||||
|
||||
|
||||
|
||||
@@ -50,21 +50,21 @@
|
||||
|
||||
|
||||
/* RFC5170 compliant fonction. DO NOT MODIFY */
|
||||
of_mod2sparse* of_create_pchck_matrix_rfc5170_compliant (UINT32 nb_rows,
|
||||
UINT32 nb_cols,
|
||||
UINT32 left_degree,
|
||||
UINT32 seed,
|
||||
of_mod2sparse* of_create_pchck_matrix_rfc5170_compliant (_UINT32 nb_rows,
|
||||
_UINT32 nb_cols,
|
||||
_UINT32 left_degree,
|
||||
_UINT32 seed,
|
||||
of_ldpc_staircase_cb_t *ofcb)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
of_mod2entry *e;
|
||||
UINT32 added, uneven;
|
||||
INT32 i, j, k;
|
||||
INT32 t; /* left limit within the list of possible choices u[] */
|
||||
UINT32 *u; /* table used to have a homogeneous 1 distrib. */
|
||||
_UINT32 added, uneven;
|
||||
_INT32 i, j, k;
|
||||
_INT32 t; /* left limit within the list of possible choices u[] */
|
||||
_UINT32 *u; /* table used to have a homogeneous 1 distrib. */
|
||||
of_mod2sparse *pchkMatrix = NULL;
|
||||
UINT32 skipCols = 0; // avoid warning
|
||||
UINT32 nbDataCols = 0; // avoid warning
|
||||
_UINT32 skipCols = 0; // avoid warning
|
||||
_UINT32 nbDataCols = 0; // avoid warning
|
||||
|
||||
skipCols = nb_rows;
|
||||
nbDataCols = nb_cols - skipCols;
|
||||
@@ -80,7 +80,7 @@ of_mod2sparse* of_create_pchck_matrix_rfc5170_compliant (UINT32 nb_rows,
|
||||
pchkMatrix = of_mod2sparse_allocate (nb_rows, nb_cols);
|
||||
/* create the initial version of the parity check matrix. */
|
||||
/* evenboth make method only */
|
||||
u = (UINT32*) of_calloc (left_degree * nbDataCols, sizeof * u);
|
||||
u = (_UINT32*) of_calloc (left_degree * nbDataCols, sizeof * u);
|
||||
/* initialize a list of possible choices to guarantee a homogeneous "1" distribution */
|
||||
for (k = left_degree * nbDataCols - 1; k >= 0; k--)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
* Default maximum number of source and encoding symbols for this codec.
|
||||
* This value depends in particular on the Finite Field size used (here GF(2^8)).
|
||||
* To this limit, codec implementation details might add other limits (e.g. if
|
||||
* the ESI values are stored in UINT16 instead of UINT32...).
|
||||
* the ESI values are stored in _UINT16 instead of _UINT32...).
|
||||
*/
|
||||
#define OF_REED_SOLOMON_MAX_NB_SOURCE_SYMBOLS_DEFAULT 255
|
||||
#define OF_REED_SOLOMON_MAX_NB_ENCODING_SYMBOLS_DEFAULT 255
|
||||
|
||||
@@ -36,104 +36,104 @@
|
||||
|
||||
#ifdef OF_USE_REED_SOLOMON_CODEC
|
||||
|
||||
/* VR: added for WIN CE support */
|
||||
#ifdef _WIN32_WCE
|
||||
#define bzero(to,sz) memset((to), 0, (sz))
|
||||
// /* VR: added for WIN CE support */
|
||||
// #ifdef _WIN32_WCE
|
||||
// #define bzero(to,sz) memset((to), 0, (sz))
|
||||
|
||||
#define bcmp(a,b,sz) memcmp((a), (b), (sz))
|
||||
#endif /* WIN32_WCE */
|
||||
// #define bcmp(a,b,sz) memcmp((a), (b), (sz))
|
||||
// #endif /* WIN32_WCE */
|
||||
|
||||
/*
|
||||
* compatibility stuff
|
||||
*/
|
||||
#if defined(WIN32) /* but also for others, e.g. sun... */
|
||||
#define NEED_BCOPY
|
||||
#define bcmp(a,b,n) memcmp(a,b,n)
|
||||
#endif
|
||||
// /*
|
||||
// * compatibility stuff
|
||||
// */
|
||||
// #if defined(_WIN32) /* but also for others, e.g. sun... */
|
||||
// #define NEED_BCOPY
|
||||
// #define bcmp(a,b,n) memcmp(a,b,n)
|
||||
// #endif
|
||||
|
||||
#ifdef NEED_BCOPY
|
||||
#define bcopy(s, d, siz) memcpy((d), (s), (siz))
|
||||
#define bzero(d, siz) memset((d), '\0', (siz))
|
||||
#endif
|
||||
// #ifdef NEED_BCOPY
|
||||
// #define bcopy(s, d, siz) memcpy((d), (s), (siz))
|
||||
// #define bzero(d, siz) memset((d), '\0', (siz))
|
||||
// #endif
|
||||
|
||||
#ifndef UINT32
|
||||
#define UINT32 unsigned long
|
||||
#endif
|
||||
// #ifndef _UINT32
|
||||
// #define _UINT32 unsigned long
|
||||
// #endif
|
||||
|
||||
/*
|
||||
* stuff used for testing purposes only
|
||||
*/
|
||||
// /*
|
||||
// * stuff used for testing purposes only
|
||||
// */
|
||||
|
||||
#ifdef TICK /* VR: avoid a warning under Solaris */
|
||||
#undef TICK
|
||||
#endif
|
||||
// #ifdef TICK /* VR: avoid a warning under Solaris */
|
||||
// #undef TICK
|
||||
// #endif
|
||||
|
||||
//#define TEST
|
||||
#ifdef TEST /* { */
|
||||
// //#define TEST
|
||||
// #ifdef TEST /* { */
|
||||
|
||||
#define DEB(x) x
|
||||
#define DDB(x) x
|
||||
#define OF_RS_DEBUG 4 /* minimal debugging */
|
||||
#if defined(WIN32)
|
||||
#include <time.h>
|
||||
struct timeval
|
||||
{
|
||||
unsigned long ticks;
|
||||
};
|
||||
#define gettimeofday(x, dummy) { (x)->ticks = clock() ; }
|
||||
#define DIFF_T(a,b) (1+ 1000000*(a.ticks - b.ticks) / CLOCKS_PER_SEC )
|
||||
typedef unsigned long UINT32 ;
|
||||
typedef unsigned short u_short ;
|
||||
#else /* typically, unix systems */
|
||||
#include <sys/time.h>
|
||||
#define DIFF_T(a,b) \
|
||||
(1+ 1000000*(a.tv_sec - b.tv_sec) + (a.tv_usec - b.tv_usec) )
|
||||
#endif
|
||||
// #define DEB(x) x
|
||||
// #define DDB(x) x
|
||||
// #define OF_RS_DEBUG 4 /* minimal debugging */
|
||||
// #if defined(_WIN32)
|
||||
// #include <time.h>
|
||||
// struct timeval
|
||||
// {
|
||||
// unsigned long ticks;
|
||||
// };
|
||||
// #define gettimeofday(x, dummy) { (x)->ticks = clock() ; }
|
||||
// #define DIFF_T(a,b) (1+ 1000000*(a.ticks - b.ticks) / CLOCKS_PER_SEC )
|
||||
// typedef unsigned long _UINT32 ;
|
||||
// typedef unsigned short u_short ;
|
||||
// #else /* typically, unix systems */
|
||||
// #include <sys/time.h>
|
||||
// #define DIFF_T(a,b) \
|
||||
// (1+ 1000000*(a.tv_sec - b.tv_sec) + (a.tv_usec - b.tv_usec) )
|
||||
// #endif
|
||||
|
||||
#define TICK(t) \
|
||||
{struct timeval x ; \
|
||||
gettimeofday(&x, NULL) ; \
|
||||
t = x.tv_usec + 1000000* (x.tv_sec & 0xff ) ; \
|
||||
}
|
||||
#define TOCK(t) \
|
||||
{ UINT32 t1 ; TICK(t1) ; \
|
||||
if (t1 < t) t = 256000000 + t1 - t ; \
|
||||
else t = t1 - t ; \
|
||||
if (t == 0) t = 1 ;}
|
||||
// #define TICK(t) \
|
||||
// {struct timeval x ; \
|
||||
// gettimeofday(&x, NULL) ; \
|
||||
// t = x.tv_usec + 1000000* (x.tv_sec & 0xff ) ; \
|
||||
// }
|
||||
// #define TOCK(t) \
|
||||
// { _UINT32 t1 ; TICK(t1) ; \
|
||||
// if (t1 < t) t = 256000000 + t1 - t ; \
|
||||
// else t = t1 - t ; \
|
||||
// if (t == 0) t = 1 ;}
|
||||
|
||||
UINT32 ticks[10]; /* vars for timekeeping */
|
||||
// _UINT32 ticks[10]; /* vars for timekeeping */
|
||||
|
||||
#else /* } { */
|
||||
// #else /* } { */
|
||||
|
||||
#define DEB(x)
|
||||
#define DDB(x)
|
||||
#define TICK(x)
|
||||
#define TOCK(x)
|
||||
// #define DEB(x)
|
||||
// #define DDB(x)
|
||||
// #define TICK(x)
|
||||
// #define TOCK(x)
|
||||
|
||||
#endif /* } TEST */
|
||||
// #endif /* } TEST */
|
||||
|
||||
|
||||
/*
|
||||
* You should not need to change anything beyond this point.
|
||||
* The first part of the file implements linear algebra in GF.
|
||||
*
|
||||
* gf is the type used to store an element of the Galois Field.
|
||||
* Must constain at least GF_BITS bits.
|
||||
*
|
||||
* Note: unsigned char will work up to GF(256) but int seems to run
|
||||
* faster on the Pentium. We use int whenever have to deal with an
|
||||
* index, since they are generally faster.
|
||||
*/
|
||||
#if (GF_BITS < 2 && GF_BITS >16)
|
||||
#error "GF_BITS must be 2 .. 16"
|
||||
#endif
|
||||
/*#if (GF_BITS <= 8)
|
||||
typedef unsigned char gf;
|
||||
#else
|
||||
typedef unsigned short gf;
|
||||
#endif*/
|
||||
// /*
|
||||
// * You should not need to change anything beyond this point.
|
||||
// * The first part of the file implements linear algebra in GF.
|
||||
// *
|
||||
// * gf is the type used to store an element of the Galois Field.
|
||||
// * Must constain at least GF_BITS bits.
|
||||
// *
|
||||
// * Note: unsigned char will work up to GF(256) but int seems to run
|
||||
// * faster on the Pentium. We use int whenever have to deal with an
|
||||
// * index, since they are generally faster.
|
||||
// */
|
||||
// #if (GF_BITS < 2 && GF_BITS >16)
|
||||
// #error "GF_BITS must be 2 .. 16"
|
||||
// #endif
|
||||
// /*#if (GF_BITS <= 8)
|
||||
// typedef unsigned char gf;
|
||||
// #else
|
||||
// typedef unsigned short gf;
|
||||
// #endif*/
|
||||
|
||||
#define GF_SIZE ((1 << GF_BITS) - 1) /* powers of \alpha */
|
||||
// #define GF_SIZE ((1 << GF_BITS) - 1) /* powers of \alpha */
|
||||
|
||||
/*
|
||||
* Primitive polynomials - see Lin & Costello, Appendix A,
|
||||
@@ -180,7 +180,7 @@ static gf of_rs_inverse[GF_SIZE+1]; /* inverse of field elem. */
|
||||
* without a slow divide.
|
||||
*/
|
||||
static gf
|
||||
of_modnn (INT32 x)
|
||||
of_modnn (_INT32 x)
|
||||
{
|
||||
while (x >= GF_SIZE)
|
||||
{
|
||||
@@ -261,7 +261,7 @@ of_gf_mul (x, y)
|
||||
* one place.
|
||||
*/
|
||||
static void *
|
||||
of_my_malloc (INT32 sz, const char *err_string)
|
||||
of_my_malloc (_INT32 sz, const char *err_string)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
void *p = malloc (sz);
|
||||
@@ -285,7 +285,7 @@ static void
|
||||
of_generate_gf (void)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
INT32 i;
|
||||
_INT32 i;
|
||||
gf mask;
|
||||
const char *Pp = of_rs_allPp[GF_BITS] ;
|
||||
|
||||
@@ -373,22 +373,22 @@ of_addmul1 (gf *dst1, gf *src1, gf c, int sz)
|
||||
register gf *dst = dst1, *src = src1 ;
|
||||
|
||||
gf *lim = &dst[sz - UNROLL + 1] ;
|
||||
UINT64 tmp;
|
||||
UINT64 *dst_64 = (UINT64*)dst1;
|
||||
_UINT64 tmp;
|
||||
_UINT64 *dst_64 = (_UINT64*)dst1;
|
||||
GF_MULC0 (c) ;
|
||||
/* with 64-bit CPUs, unroll the loop and work on two 64-bit words at a time. */
|
||||
for (; dst < lim ; dst += UNROLL, src += UNROLL)
|
||||
{
|
||||
|
||||
tmp = ((UINT64)__gf_mulc_[src[0]]) | ((UINT64)__gf_mulc_[src[1]]<<8) | ((UINT64)__gf_mulc_[src[2]]<<16) |
|
||||
((UINT64)__gf_mulc_[src[3]]<<24) | ((UINT64)__gf_mulc_[src[4]]<<32) | ((UINT64)__gf_mulc_[src[5]]<<40) |
|
||||
((UINT64)__gf_mulc_[src[6]]<<48) | ((UINT64)__gf_mulc_[src[7]]<<56) ;
|
||||
tmp = ((_UINT64)__gf_mulc_[src[0]]) | ((_UINT64)__gf_mulc_[src[1]]<<8) | ((_UINT64)__gf_mulc_[src[2]]<<16) |
|
||||
((_UINT64)__gf_mulc_[src[3]]<<24) | ((_UINT64)__gf_mulc_[src[4]]<<32) | ((_UINT64)__gf_mulc_[src[5]]<<40) |
|
||||
((_UINT64)__gf_mulc_[src[6]]<<48) | ((_UINT64)__gf_mulc_[src[7]]<<56) ;
|
||||
*dst_64 ^= tmp;
|
||||
dst_64++;
|
||||
|
||||
tmp = ((UINT64)__gf_mulc_[src[8]]) | ((UINT64)__gf_mulc_[src[9]]<<8) | ((UINT64)__gf_mulc_[src[10]]<<16) |
|
||||
((UINT64)__gf_mulc_[src[11]]<<24) | ((UINT64)__gf_mulc_[src[12]]<<32) | ((UINT64)__gf_mulc_[src[13]]<<40) |
|
||||
((UINT64)__gf_mulc_[src[14]]<<48) | ((UINT64)__gf_mulc_[src[15]]<<56) ;
|
||||
tmp = ((_UINT64)__gf_mulc_[src[8]]) | ((_UINT64)__gf_mulc_[src[9]]<<8) | ((_UINT64)__gf_mulc_[src[10]]<<16) |
|
||||
((_UINT64)__gf_mulc_[src[11]]<<24) | ((_UINT64)__gf_mulc_[src[12]]<<32) | ((_UINT64)__gf_mulc_[src[13]]<<40) |
|
||||
((_UINT64)__gf_mulc_[src[14]]<<48) | ((_UINT64)__gf_mulc_[src[15]]<<56) ;
|
||||
*dst_64 ^= tmp;
|
||||
dst_64++;
|
||||
}
|
||||
@@ -747,8 +747,8 @@ of_rs_init()
|
||||
|
||||
struct fec_parms
|
||||
{
|
||||
UINT32 magic ;
|
||||
INT32 k, n ; /* parameters of the code */
|
||||
_UINT32 magic ;
|
||||
_INT32 k, n ; /* parameters of the code */
|
||||
gf *enc_matrix ;
|
||||
} ;
|
||||
|
||||
@@ -766,7 +766,7 @@ void of_rs_free (struct fec_parms *p)
|
||||
#endif /* CPLUSPLUS_COMPATIBLE */
|
||||
if (p == NULL) //||
|
||||
//p->magic != ( ( (FEC_MAGIC ^ p->k) ^ p->n) ^ (int)(p->enc_matrix)) ) {
|
||||
//p->magic != (( (FEC_MAGIC ^ p->k) ^ p->n) ^ (UINT32) (p->enc_matrix)))
|
||||
//p->magic != (( (FEC_MAGIC ^ p->k) ^ p->n) ^ (_UINT32) (p->enc_matrix)))
|
||||
{
|
||||
OF_PRINT_ERROR (("bad parameters to fec_free\n"))
|
||||
return ;
|
||||
@@ -785,10 +785,10 @@ struct fec_parms *
|
||||
#else
|
||||
void *
|
||||
#endif
|
||||
of_rs_new (UINT32 k, UINT32 n)
|
||||
of_rs_new (_UINT32 k, _UINT32 n)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
INT32 row, col ;
|
||||
_INT32 row, col ;
|
||||
gf *p, *tmp_m ;
|
||||
|
||||
struct fec_parms *retval ;
|
||||
|
||||
@@ -59,14 +59,14 @@ typedef struct of_rs_cb
|
||||
/*
|
||||
* FEC codec id specific attributes follow...
|
||||
*/
|
||||
UINT32 nb_source_symbols; /** k parameter (AKA code dimension). */
|
||||
UINT32 nb_repair_symbols; /** r = n - k parameter. */
|
||||
UINT32 nb_encoding_symbols; /** n parameter (AKA code length). */
|
||||
_UINT32 nb_source_symbols; /** k parameter (AKA code dimension). */
|
||||
_UINT32 nb_repair_symbols; /** r = n - k parameter. */
|
||||
_UINT32 nb_encoding_symbols; /** n parameter (AKA code length). */
|
||||
/** Maximum number of source symbols supported by this codec for practical reasons. */
|
||||
UINT32 max_nb_source_symbols;
|
||||
_UINT32 max_nb_source_symbols;
|
||||
/** Maximum number of encoding symbols supported by this codec for practical reasons. */
|
||||
UINT32 max_nb_encoding_symbols;
|
||||
UINT32 encoding_symbol_length; /** symbol length. */
|
||||
_UINT32 max_nb_encoding_symbols;
|
||||
_UINT32 encoding_symbol_length; /** symbol length. */
|
||||
|
||||
void *rs_cb; /** Reed-Solomon internal codec control block */
|
||||
|
||||
@@ -81,20 +81,20 @@ typedef struct of_rs_cb
|
||||
void ** available_symbols_tab;
|
||||
/** Number of available source and repair symbols. This is the number of entries in
|
||||
* the available_symbols_tab tables. */
|
||||
UINT32 nb_available_symbols;
|
||||
_UINT32 nb_available_symbols;
|
||||
/** Number of available source symbols. */
|
||||
UINT32 nb_available_source_symbols;
|
||||
_UINT32 nb_available_source_symbols;
|
||||
bool decoding_finished; /** true as soon as decoding completed. */
|
||||
#endif /* OF_USE_DECODER */
|
||||
|
||||
|
||||
/** callbacks for this codec. */
|
||||
void* (*decoded_source_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded source symbol */
|
||||
UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded source symbol */
|
||||
_UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
void* (*decoded_repair_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded repair symbol */
|
||||
UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded repair symbol */
|
||||
_UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
void* context_4_callback;
|
||||
|
||||
} of_rs_cb_t;
|
||||
@@ -144,8 +144,8 @@ of_status_t of_rs_set_fec_parameters (of_rs_cb_t* ofcb,
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_rs_set_callback_functions (of_rs_cb_t *ofcb,void* (*decoded_source_symbol_callback)
|
||||
* (void *context,UINT32 size,UINT32 esi), void* (*decoded_repair_symbol_callback)
|
||||
* (void *context,UINT32 size,UINT32 esi),void* context_4_callback)
|
||||
* (void *context,_UINT32 size,_UINT32 esi), void* (*decoded_repair_symbol_callback)
|
||||
* (void *context,_UINT32 size,_UINT32 esi),void* context_4_callback)
|
||||
* @brief set various callbock functions (see header of_open_fec_api.h)
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
*
|
||||
@@ -169,16 +169,16 @@ of_status_t of_rs_set_fec_parameters (of_rs_cb_t* ofcb,
|
||||
*/
|
||||
of_status_t of_rs_set_callback_functions (of_rs_cb_t* ofcb,
|
||||
void* (*decoded_source_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded source symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded source symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
void* (*decoded_repair_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded repair symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded repair symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
void* context_4_callback);
|
||||
|
||||
#ifdef OF_USE_ENCODER
|
||||
/**
|
||||
* @fn of_status_t of_rs_build_repair_symbol (of_rs_cb_t* ofcb, void* encoding_symbols_tab[], UINT32 esi_of_symbol_to_build)
|
||||
* @fn of_status_t of_rs_build_repair_symbol (of_rs_cb_t* ofcb, void* encoding_symbols_tab[], _UINT32 esi_of_symbol_to_build)
|
||||
* @brief build a repair symbol (encoder only)
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param encoding_symbols_tab (IN/OUT) table of source and repair symbols.
|
||||
@@ -192,12 +192,12 @@ of_status_t of_rs_set_callback_functions (of_rs_cb_t* ofcb,
|
||||
*/
|
||||
of_status_t of_rs_build_repair_symbol (of_rs_cb_t* ofcb,
|
||||
void* encoding_symbols_tab[],
|
||||
UINT32 esi_of_symbol_to_build);
|
||||
_UINT32 esi_of_symbol_to_build);
|
||||
#endif //OF_USE_ENCODER
|
||||
|
||||
#ifdef OF_USE_DECODER
|
||||
/**
|
||||
* @fn of_status_t of_rs_decode_with_new_symbol (of_rs_cb_t* ofcb, void* const new_symbol_buf, UINT32 new_symbol_esi)
|
||||
* @fn of_status_t of_rs_decode_with_new_symbol (of_rs_cb_t* ofcb, void* const new_symbol_buf, _UINT32 new_symbol_esi)
|
||||
* @brief (try to) decode with a newly received symbol
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param new_symbol (IN) Pointer to the encoding symbol now available (i.e. a new
|
||||
@@ -208,7 +208,7 @@ of_status_t of_rs_build_repair_symbol (of_rs_cb_t* ofcb,
|
||||
*/
|
||||
of_status_t of_rs_decode_with_new_symbol (of_rs_cb_t* ofcb,
|
||||
void* new_symbol,
|
||||
UINT32 new_symbol_esi);
|
||||
_UINT32 new_symbol_esi);
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_rs_set_available_symbols (of_rs_cb_t* ofcb, void* const encoding_symbols_tab[]);
|
||||
@@ -256,7 +256,7 @@ of_status_t of_rs_get_source_symbols_tab (of_rs_cb_t* ofcb,
|
||||
#endif //OF_USE_DECODER
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_rs_set_control_parameter (of_rs_cb_t* ofcb,UINT32 type,void* value,UINT32 length)
|
||||
* @fn of_status_t of_rs_set_control_parameter (of_rs_cb_t* ofcb,_UINT32 type,void* value,_UINT32 length)
|
||||
* @brief set a specific FEC parameter
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param type (IN) Type of parameter. This type is FEC codec ID specific.
|
||||
@@ -266,12 +266,12 @@ of_status_t of_rs_get_source_symbols_tab (of_rs_cb_t* ofcb,
|
||||
* @return Error status.
|
||||
*/
|
||||
of_status_t of_rs_set_control_parameter (of_rs_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length);
|
||||
_UINT32 length);
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_rs_get_control_parameter (of_rs_cb_t* ofcb,UINT32 type,void* value,UINT32 length)
|
||||
* @fn of_status_t of_rs_get_control_parameter (of_rs_cb_t* ofcb,_UINT32 type,void* value,_UINT32 length)
|
||||
* @brief get a specific FEC parameter
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param type (IN) Type of parameter. This type is FEC codec ID specific.
|
||||
@@ -283,9 +283,9 @@ of_status_t of_rs_set_control_parameter (of_rs_cb_t* ofcb,
|
||||
* @return Error status.
|
||||
*/
|
||||
of_status_t of_rs_get_control_parameter (of_rs_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length);
|
||||
_UINT32 length);
|
||||
|
||||
|
||||
/*
|
||||
@@ -294,7 +294,7 @@ of_status_t of_rs_get_control_parameter (of_rs_cb_t* ofcb,
|
||||
|
||||
void of_rs_free (void *p) ;
|
||||
|
||||
void * of_rs_new (UINT32 k, UINT32 n) ;
|
||||
void * of_rs_new (_UINT32 k, _UINT32 n) ;
|
||||
|
||||
void of_rs_init (void) ;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
|
||||
bool of_rs_is_source_symbol (of_rs_cb_t* ofcb,
|
||||
UINT32 new_symbol_esi)
|
||||
_UINT32 new_symbol_esi)
|
||||
{
|
||||
if (new_symbol_esi < ofcb->nb_source_symbols)
|
||||
return true;
|
||||
@@ -47,7 +47,7 @@ bool of_rs_is_source_symbol (of_rs_cb_t* ofcb,
|
||||
|
||||
|
||||
bool of_rs_is_repair_symbol (of_rs_cb_t* ofcb,
|
||||
UINT32 new_symbol_esi)
|
||||
_UINT32 new_symbol_esi)
|
||||
{
|
||||
if (new_symbol_esi < ofcb->nb_source_symbols)
|
||||
return false;
|
||||
@@ -80,7 +80,7 @@ of_status_t of_rs_create_codec_instance (of_rs_cb_t** of_cb)
|
||||
of_status_t of_rs_release_codec_instance (of_rs_cb_t* ofcb)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
if (ofcb->rs_cb != NULL)
|
||||
{
|
||||
of_rs_free (ofcb->rs_cb);
|
||||
@@ -127,11 +127,11 @@ error:
|
||||
|
||||
of_status_t of_rs_set_callback_functions (of_rs_cb_t* ofcb,
|
||||
void* (*decoded_source_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded source symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded source symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
void* (*decoded_repair_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded repair symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded repair symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
void* context_4_callback)
|
||||
{
|
||||
ofcb->decoded_source_symbol_callback = decoded_source_symbol_callback;
|
||||
@@ -148,7 +148,7 @@ of_status_t of_rs_set_callback_functions (of_rs_cb_t* ofcb,
|
||||
#ifdef OF_USE_ENCODER
|
||||
of_status_t of_rs_build_repair_symbol (of_rs_cb_t* ofcb,
|
||||
void* encoding_symbols_tab[],
|
||||
UINT32 esi_of_symbol_to_build)
|
||||
_UINT32 esi_of_symbol_to_build)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
if (esi_of_symbol_to_build < ofcb->nb_source_symbols || esi_of_symbol_to_build >= ofcb->nb_encoding_symbols)
|
||||
@@ -198,7 +198,7 @@ error:
|
||||
#ifdef OF_USE_DECODER
|
||||
of_status_t of_rs_decode_with_new_symbol (of_rs_cb_t* ofcb,
|
||||
void* new_symbol,
|
||||
UINT32 new_symbol_esi)
|
||||
_UINT32 new_symbol_esi)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
if (ofcb->decoding_finished)
|
||||
@@ -255,7 +255,7 @@ error:
|
||||
of_status_t of_rs_set_available_symbols (of_rs_cb_t* ofcb,
|
||||
void* const encoding_symbols_tab[])
|
||||
{
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
ofcb->nb_available_symbols = 0;
|
||||
@@ -279,22 +279,22 @@ of_status_t of_rs_set_available_symbols (of_rs_cb_t* ofcb,
|
||||
|
||||
of_status_t of_rs_finish_decoding (of_rs_cb_t* ofcb)
|
||||
{
|
||||
UINT32 k;
|
||||
UINT32 n;
|
||||
_UINT32 k;
|
||||
_UINT32 n;
|
||||
char *tmp_buf[GF_SIZE]; /* copy available source/repair symbol buffers here... */
|
||||
int tmp_esi[GF_SIZE]; /* ...and their esi here. In fact we only need k entries
|
||||
* in these tables, but in order to avoid using malloc (time
|
||||
* consumming), we use an automatic table of maximum size for
|
||||
* both tmp_buf[] and tmp_esi[]. */
|
||||
INT32 tmp_idx; /* index in tmp_buf[] and tmp_esi[] tabs */
|
||||
_INT32 tmp_idx; /* index in tmp_buf[] and tmp_esi[] tabs */
|
||||
char *large_buf = NULL; /* single large buffer where to copy all source/repair symbols */
|
||||
UINT32 off; /* offset, in unit of characters, in large_buf */
|
||||
_UINT32 off; /* offset, in unit of characters, in large_buf */
|
||||
void **ass_buf; /* tmp pointer to the current source symbol entry in
|
||||
* available_symbols_tab[] */
|
||||
UINT32 ass_esi; /* corresponding available source symbol ESI */
|
||||
_UINT32 ass_esi; /* corresponding available source symbol ESI */
|
||||
void **ars_buf; /* tmp pointer to the current repair symbol entry in
|
||||
* available_symbols_tab[] */
|
||||
UINT32 ars_esi; /* corresponding available repair symbol ESI */
|
||||
_UINT32 ars_esi; /* corresponding available repair symbol ESI */
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
if (ofcb->decoding_finished)
|
||||
@@ -460,7 +460,7 @@ of_status_t of_rs_get_source_symbols_tab (of_rs_cb_t* ofcb,
|
||||
return OF_STATUS_ERROR;
|
||||
}
|
||||
#if 0
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
for (i = 0; i < ofcb->nb_source_symbols; i++)
|
||||
{
|
||||
if (source_symbols_tab[i] == NULL)
|
||||
@@ -479,9 +479,9 @@ of_status_t of_rs_get_source_symbols_tab (of_rs_cb_t* ofcb,
|
||||
#endif //OF_USE_DECODER
|
||||
|
||||
of_status_t of_rs_set_control_parameter (of_rs_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length)
|
||||
_UINT32 length)
|
||||
{
|
||||
OF_PRINT_ERROR(("of_rs_set_control_parameter: ERROR, not implemented...\n"))
|
||||
return OF_STATUS_ERROR;
|
||||
@@ -489,30 +489,30 @@ of_status_t of_rs_set_control_parameter (of_rs_cb_t* ofcb,
|
||||
|
||||
|
||||
of_status_t of_rs_get_control_parameter (of_rs_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length)
|
||||
_UINT32 length)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
switch (type) {
|
||||
case OF_CTRL_GET_MAX_K:
|
||||
if (value == NULL || length != sizeof(UINT32)) {
|
||||
if (value == NULL || length != sizeof(_UINT32)) {
|
||||
OF_PRINT_ERROR(("%s: OF_CTRL_GET_MAX_K ERROR: null value or bad length (got %d, expected %zu)\n",
|
||||
__FUNCTION__, length, sizeof(UINT32)))
|
||||
__FUNCTION__, length, sizeof(_UINT32)))
|
||||
goto error;
|
||||
}
|
||||
*(UINT32*)value = ofcb->max_nb_source_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_K (%d)\n", __FUNCTION__, *(UINT32*)value))
|
||||
*(_UINT32*)value = ofcb->max_nb_source_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_K (%d)\n", __FUNCTION__, *(_UINT32*)value))
|
||||
break;
|
||||
|
||||
case OF_CTRL_GET_MAX_N:
|
||||
if (value == NULL || length != sizeof(UINT32)) {
|
||||
if (value == NULL || length != sizeof(_UINT32)) {
|
||||
OF_PRINT_ERROR(("%s: OF_CTRL_GET_MAX_N ERROR: null value or bad length (got %d, expected %zu)\n",
|
||||
__FUNCTION__, length, sizeof(UINT32)))
|
||||
__FUNCTION__, length, sizeof(_UINT32)))
|
||||
goto error;
|
||||
}
|
||||
*(UINT32*)value = ofcb->max_nb_encoding_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_N (%d)\n", __FUNCTION__, *(UINT32*)value))
|
||||
*(_UINT32*)value = ofcb->max_nb_encoding_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_N (%d)\n", __FUNCTION__, *(_UINT32*)value))
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -45,9 +45,9 @@
|
||||
*/
|
||||
typedef struct of_rs_parameters
|
||||
{
|
||||
UINT32 nb_source_symbols; /* must be 1st item */
|
||||
UINT32 nb_repair_symbols; /* must be 2nd item */
|
||||
UINT32 encoding_symbol_length; /* must be 3rd item */
|
||||
_UINT32 nb_source_symbols; /* must be 1st item */
|
||||
_UINT32 nb_repair_symbols; /* must be 2nd item */
|
||||
_UINT32 encoding_symbol_length; /* must be 3rd item */
|
||||
/*
|
||||
* FEC codec id specific attributes follow...
|
||||
*/
|
||||
|
||||
@@ -61,11 +61,11 @@ void of_galois_field_2_4_addmul1(gf *dst1, gf *src1, gf c, int sz)
|
||||
register gf *dst = dst1, *src = src1 ;
|
||||
gf *lim = &dst[sz - UNROLL + 1] ;
|
||||
#if ((defined (__LP64__) || (__WORDSIZE == 64)) && !defined (OF_RS_2M_USE_32BITS))
|
||||
UINT64 tmp;
|
||||
UINT64 *dst_64 = (UINT64*)dst1;
|
||||
_UINT64 tmp;
|
||||
_UINT64 *dst_64 = (_UINT64*)dst1;
|
||||
#else
|
||||
UINT32 tmp;
|
||||
UINT32 *dst_32 = (UINT32*)dst1;
|
||||
_UINT32 tmp;
|
||||
_UINT32 *dst_32 = (_UINT32*)dst1;
|
||||
#endif
|
||||
GF_MULC0 (c) ;
|
||||
|
||||
@@ -74,32 +74,32 @@ void of_galois_field_2_4_addmul1(gf *dst1, gf *src1, gf c, int sz)
|
||||
{
|
||||
#if ((defined (__LP64__) || (__WORDSIZE == 64)) && !defined (OF_RS_2M_USE_32BITS))
|
||||
/* perform 64-bit operations for improved performances on 64-bit systems */
|
||||
tmp = ((UINT64)__gf_mulc_[src[0]]) | ((UINT64)__gf_mulc_[src[1]]<<8) | ((UINT64)__gf_mulc_[src[2]]<<16) |
|
||||
((UINT64)__gf_mulc_[src[3]]<<24) | ((UINT64)__gf_mulc_[src[4]]<<32) | ((UINT64)__gf_mulc_[src[5]]<<40) |
|
||||
((UINT64)__gf_mulc_[src[6]]<<48) | ((UINT64)__gf_mulc_[src[7]]<<56) ;
|
||||
tmp = ((_UINT64)__gf_mulc_[src[0]]) | ((_UINT64)__gf_mulc_[src[1]]<<8) | ((_UINT64)__gf_mulc_[src[2]]<<16) |
|
||||
((_UINT64)__gf_mulc_[src[3]]<<24) | ((_UINT64)__gf_mulc_[src[4]]<<32) | ((_UINT64)__gf_mulc_[src[5]]<<40) |
|
||||
((_UINT64)__gf_mulc_[src[6]]<<48) | ((_UINT64)__gf_mulc_[src[7]]<<56) ;
|
||||
*dst_64 ^= tmp;
|
||||
dst_64++;
|
||||
tmp = ((UINT64)__gf_mulc_[src[8]]) | ((UINT64)__gf_mulc_[src[9]]<<8) | ((UINT64)__gf_mulc_[src[10]]<<16) |
|
||||
((UINT64)__gf_mulc_[src[11]]<<24) | ((UINT64)__gf_mulc_[src[12]]<<32) | ((UINT64)__gf_mulc_[src[13]]<<40) |
|
||||
((UINT64)__gf_mulc_[src[14]]<<48) | ((UINT64)__gf_mulc_[src[15]]<<56) ;
|
||||
tmp = ((_UINT64)__gf_mulc_[src[8]]) | ((_UINT64)__gf_mulc_[src[9]]<<8) | ((_UINT64)__gf_mulc_[src[10]]<<16) |
|
||||
((_UINT64)__gf_mulc_[src[11]]<<24) | ((_UINT64)__gf_mulc_[src[12]]<<32) | ((_UINT64)__gf_mulc_[src[13]]<<40) |
|
||||
((_UINT64)__gf_mulc_[src[14]]<<48) | ((_UINT64)__gf_mulc_[src[15]]<<56) ;
|
||||
*dst_64 ^= tmp;
|
||||
dst_64++;
|
||||
#else
|
||||
/* otherwise perform 32-bit operations on 32-bit systems */
|
||||
tmp = ((UINT32)__gf_mulc_[src[0]]) | ((UINT32)__gf_mulc_[src[1]]<<8) | ((UINT32)__gf_mulc_[src[2]]<<16) |
|
||||
((UINT32)__gf_mulc_[src[3]]<<24);
|
||||
tmp = ((_UINT32)__gf_mulc_[src[0]]) | ((_UINT32)__gf_mulc_[src[1]]<<8) | ((_UINT32)__gf_mulc_[src[2]]<<16) |
|
||||
((_UINT32)__gf_mulc_[src[3]]<<24);
|
||||
*dst_32 ^= tmp;
|
||||
dst_32++;
|
||||
tmp = ((UINT32)__gf_mulc_[src[4]]) | ((UINT32)__gf_mulc_[src[5]]<<8) | ((UINT32)__gf_mulc_[src[6]]<<16) |
|
||||
((UINT32)__gf_mulc_[src[7]]<<24);
|
||||
tmp = ((_UINT32)__gf_mulc_[src[4]]) | ((_UINT32)__gf_mulc_[src[5]]<<8) | ((_UINT32)__gf_mulc_[src[6]]<<16) |
|
||||
((_UINT32)__gf_mulc_[src[7]]<<24);
|
||||
*dst_32 ^= tmp;
|
||||
dst_32++;
|
||||
tmp = ((UINT32)__gf_mulc_[src[8]]) | ((UINT32)__gf_mulc_[src[9]]<<8) | ((UINT32)__gf_mulc_[src[10]]<<16) |
|
||||
((UINT32)__gf_mulc_[src[11]]<<24);
|
||||
tmp = ((_UINT32)__gf_mulc_[src[8]]) | ((_UINT32)__gf_mulc_[src[9]]<<8) | ((_UINT32)__gf_mulc_[src[10]]<<16) |
|
||||
((_UINT32)__gf_mulc_[src[11]]<<24);
|
||||
*dst_32 ^= tmp;
|
||||
dst_32++;
|
||||
tmp = ((UINT32)__gf_mulc_[src[12]]) | ((UINT32)__gf_mulc_[src[13]]<<8) | ((UINT32)__gf_mulc_[src[14]]<<16) |
|
||||
((UINT32)__gf_mulc_[src[15]]<<24);
|
||||
tmp = ((_UINT32)__gf_mulc_[src[12]]) | ((_UINT32)__gf_mulc_[src[13]]<<8) | ((_UINT32)__gf_mulc_[src[14]]<<16) |
|
||||
((_UINT32)__gf_mulc_[src[15]]<<24);
|
||||
*dst_32 ^= tmp;
|
||||
dst_32++;
|
||||
#endif
|
||||
@@ -129,11 +129,11 @@ void of_galois_field_2_4_addmul1_compact (gf *dst1, gf *src1, gf c, int
|
||||
register gf *dst = dst1, *src = src1 ;
|
||||
gf *lim = &dst[sz - UNROLL + 1] ;
|
||||
#if ((defined (__LP64__) || (__WORDSIZE == 64)) && !defined (OF_RS_2M_USE_32BITS))
|
||||
UINT64 tmp;
|
||||
UINT64 *dst_64 = (UINT64*)dst1;
|
||||
_UINT64 tmp;
|
||||
_UINT64 *dst_64 = (_UINT64*)dst1;
|
||||
#else
|
||||
UINT32 tmp;
|
||||
UINT32 *dst_32 = (UINT32*)dst1;
|
||||
_UINT32 tmp;
|
||||
_UINT32 *dst_32 = (_UINT32*)dst1;
|
||||
#endif
|
||||
GF_OPT_MULC0(c);
|
||||
|
||||
@@ -142,32 +142,32 @@ void of_galois_field_2_4_addmul1_compact (gf *dst1, gf *src1, gf c, int
|
||||
{
|
||||
#if ((defined (__LP64__) || (__WORDSIZE == 64)) && !defined (OF_RS_2M_USE_32BITS))
|
||||
/* perform 64-bit operations for improved performances on 64-bit systems */
|
||||
tmp = ((UINT64)__gf_mulc_[src[0]]) | ((UINT64)__gf_mulc_[src[1]]<<8) | ((UINT64)__gf_mulc_[src[2]]<<16) |
|
||||
((UINT64)__gf_mulc_[src[3]]<<24) | ((UINT64)__gf_mulc_[src[4]]<<32) | ((UINT64)__gf_mulc_[src[5]]<<40) |
|
||||
((UINT64)__gf_mulc_[src[6]]<<48) | ((UINT64)__gf_mulc_[src[7]]<<56) ;
|
||||
tmp = ((_UINT64)__gf_mulc_[src[0]]) | ((_UINT64)__gf_mulc_[src[1]]<<8) | ((_UINT64)__gf_mulc_[src[2]]<<16) |
|
||||
((_UINT64)__gf_mulc_[src[3]]<<24) | ((_UINT64)__gf_mulc_[src[4]]<<32) | ((_UINT64)__gf_mulc_[src[5]]<<40) |
|
||||
((_UINT64)__gf_mulc_[src[6]]<<48) | ((_UINT64)__gf_mulc_[src[7]]<<56) ;
|
||||
*dst_64 ^= tmp;
|
||||
dst_64++;
|
||||
tmp = ((UINT64)__gf_mulc_[src[8]]) | ((UINT64)__gf_mulc_[src[9]]<<8) | ((UINT64)__gf_mulc_[src[10]]<<16) |
|
||||
((UINT64)__gf_mulc_[src[11]]<<24) | ((UINT64)__gf_mulc_[src[12]]<<32) | ((UINT64)__gf_mulc_[src[13]]<<40) |
|
||||
((UINT64)__gf_mulc_[src[14]]<<48) | ((UINT64)__gf_mulc_[src[15]]<<56) ;
|
||||
tmp = ((_UINT64)__gf_mulc_[src[8]]) | ((_UINT64)__gf_mulc_[src[9]]<<8) | ((_UINT64)__gf_mulc_[src[10]]<<16) |
|
||||
((_UINT64)__gf_mulc_[src[11]]<<24) | ((_UINT64)__gf_mulc_[src[12]]<<32) | ((_UINT64)__gf_mulc_[src[13]]<<40) |
|
||||
((_UINT64)__gf_mulc_[src[14]]<<48) | ((_UINT64)__gf_mulc_[src[15]]<<56) ;
|
||||
*dst_64 ^= tmp;
|
||||
dst_64++;
|
||||
#else
|
||||
/* otherwise perform 32-bit operations on 32-bit systems */
|
||||
tmp = ((UINT32)__gf_mulc_[src[0]]) | ((UINT32)__gf_mulc_[src[1]]<<8) | ((UINT32)__gf_mulc_[src[2]]<<16) |
|
||||
((UINT32)__gf_mulc_[src[3]]<<24);
|
||||
tmp = ((_UINT32)__gf_mulc_[src[0]]) | ((_UINT32)__gf_mulc_[src[1]]<<8) | ((_UINT32)__gf_mulc_[src[2]]<<16) |
|
||||
((_UINT32)__gf_mulc_[src[3]]<<24);
|
||||
*dst_32 ^= tmp;
|
||||
dst_32++;
|
||||
tmp = ((UINT32)__gf_mulc_[src[4]]) | ((UINT32)__gf_mulc_[src[5]]<<8) | ((UINT32)__gf_mulc_[src[6]]<<16) |
|
||||
((UINT32)__gf_mulc_[src[7]]<<24);
|
||||
tmp = ((_UINT32)__gf_mulc_[src[4]]) | ((_UINT32)__gf_mulc_[src[5]]<<8) | ((_UINT32)__gf_mulc_[src[6]]<<16) |
|
||||
((_UINT32)__gf_mulc_[src[7]]<<24);
|
||||
*dst_32 ^= tmp;
|
||||
dst_32++;
|
||||
tmp = ((UINT32)__gf_mulc_[src[8]]) | ((UINT32)__gf_mulc_[src[9]]<<8) | ((UINT32)__gf_mulc_[src[10]]<<16) |
|
||||
((UINT32)__gf_mulc_[src[11]]<<24);
|
||||
tmp = ((_UINT32)__gf_mulc_[src[8]]) | ((_UINT32)__gf_mulc_[src[9]]<<8) | ((_UINT32)__gf_mulc_[src[10]]<<16) |
|
||||
((_UINT32)__gf_mulc_[src[11]]<<24);
|
||||
*dst_32 ^= tmp;
|
||||
dst_32++;
|
||||
tmp = ((UINT32)__gf_mulc_[src[12]]) | ((UINT32)__gf_mulc_[src[13]]<<8) | ((UINT32)__gf_mulc_[src[14]]<<16) |
|
||||
((UINT32)__gf_mulc_[src[15]]<<24);
|
||||
tmp = ((_UINT32)__gf_mulc_[src[12]]) | ((_UINT32)__gf_mulc_[src[13]]<<8) | ((_UINT32)__gf_mulc_[src[14]]<<16) |
|
||||
((_UINT32)__gf_mulc_[src[15]]<<24);
|
||||
*dst_32 ^= tmp;
|
||||
dst_32++;
|
||||
#endif
|
||||
|
||||
@@ -52,11 +52,11 @@ void of_galois_field_2_8_addmul1(gf *dst1, gf *src1, gf c, int sz) {
|
||||
register gf *dst = dst1, *src = src1 ;
|
||||
gf *lim = &dst[sz - UNROLL + 1] ;
|
||||
#if ((defined (__LP64__) || (__WORDSIZE == 64)) && !defined (OF_RS_2M_USE_32BITS))
|
||||
UINT64 tmp;
|
||||
UINT64 *dst_64 = (UINT64*)dst1;
|
||||
_UINT64 tmp;
|
||||
_UINT64 *dst_64 = (_UINT64*)dst1;
|
||||
#else
|
||||
UINT32 tmp;
|
||||
UINT32 *dst_32 = (UINT32*)dst1;
|
||||
_UINT32 tmp;
|
||||
_UINT32 *dst_32 = (_UINT32*)dst1;
|
||||
#endif
|
||||
GF_MULC0 (c) ;
|
||||
|
||||
@@ -66,31 +66,31 @@ void of_galois_field_2_8_addmul1(gf *dst1, gf *src1, gf c, int sz) {
|
||||
for (; dst < lim ;dst += UNROLL, src += UNROLL)
|
||||
{
|
||||
#if ((defined (__LP64__) || (__WORDSIZE == 64)) && !defined (OF_RS_2M_USE_32BITS))
|
||||
tmp = ((UINT64)__gf_mulc_[src[0]]) | ((UINT64)__gf_mulc_[src[1]]<<8) | ((UINT64)__gf_mulc_[src[2]]<<16) |
|
||||
((UINT64)__gf_mulc_[src[3]]<<24) | ((UINT64)__gf_mulc_[src[4]]<<32) | ((UINT64)__gf_mulc_[src[5]]<<40) |
|
||||
((UINT64)__gf_mulc_[src[6]]<<48) | ((UINT64)__gf_mulc_[src[7]]<<56) ;
|
||||
tmp = ((_UINT64)__gf_mulc_[src[0]]) | ((_UINT64)__gf_mulc_[src[1]]<<8) | ((_UINT64)__gf_mulc_[src[2]]<<16) |
|
||||
((_UINT64)__gf_mulc_[src[3]]<<24) | ((_UINT64)__gf_mulc_[src[4]]<<32) | ((_UINT64)__gf_mulc_[src[5]]<<40) |
|
||||
((_UINT64)__gf_mulc_[src[6]]<<48) | ((_UINT64)__gf_mulc_[src[7]]<<56) ;
|
||||
*dst_64 ^= tmp;
|
||||
dst_64++;
|
||||
tmp = ((UINT64)__gf_mulc_[src[8]]) | ((UINT64)__gf_mulc_[src[9]]<<8) | ((UINT64)__gf_mulc_[src[10]]<<16) |
|
||||
((UINT64)__gf_mulc_[src[11]]<<24) | ((UINT64)__gf_mulc_[src[12]]<<32) | ((UINT64)__gf_mulc_[src[13]]<<40) |
|
||||
((UINT64)__gf_mulc_[src[14]]<<48) | ((UINT64)__gf_mulc_[src[15]]<<56) ;
|
||||
tmp = ((_UINT64)__gf_mulc_[src[8]]) | ((_UINT64)__gf_mulc_[src[9]]<<8) | ((_UINT64)__gf_mulc_[src[10]]<<16) |
|
||||
((_UINT64)__gf_mulc_[src[11]]<<24) | ((_UINT64)__gf_mulc_[src[12]]<<32) | ((_UINT64)__gf_mulc_[src[13]]<<40) |
|
||||
((_UINT64)__gf_mulc_[src[14]]<<48) | ((_UINT64)__gf_mulc_[src[15]]<<56) ;
|
||||
*dst_64 ^= tmp;
|
||||
dst_64++;
|
||||
#else
|
||||
tmp = ((UINT32)__gf_mulc_[src[0]]) | ((UINT32)__gf_mulc_[src[1]]<<8) | ((UINT32)__gf_mulc_[src[2]]<<16) |
|
||||
((UINT32)__gf_mulc_[src[3]]<<24);
|
||||
tmp = ((_UINT32)__gf_mulc_[src[0]]) | ((_UINT32)__gf_mulc_[src[1]]<<8) | ((_UINT32)__gf_mulc_[src[2]]<<16) |
|
||||
((_UINT32)__gf_mulc_[src[3]]<<24);
|
||||
*dst_32 ^= tmp;
|
||||
dst_32++;
|
||||
tmp = ((UINT32)__gf_mulc_[src[4]]) | ((UINT32)__gf_mulc_[src[5]]<<8) | ((UINT32)__gf_mulc_[src[6]]<<16) |
|
||||
((UINT32)__gf_mulc_[src[7]]<<24);
|
||||
tmp = ((_UINT32)__gf_mulc_[src[4]]) | ((_UINT32)__gf_mulc_[src[5]]<<8) | ((_UINT32)__gf_mulc_[src[6]]<<16) |
|
||||
((_UINT32)__gf_mulc_[src[7]]<<24);
|
||||
*dst_32 ^= tmp;
|
||||
dst_32++;
|
||||
tmp = ((UINT32)__gf_mulc_[src[8]]) | ((UINT32)__gf_mulc_[src[9]]<<8) | ((UINT32)__gf_mulc_[src[10]]<<16) |
|
||||
((UINT32)__gf_mulc_[src[11]]<<24);
|
||||
tmp = ((_UINT32)__gf_mulc_[src[8]]) | ((_UINT32)__gf_mulc_[src[9]]<<8) | ((_UINT32)__gf_mulc_[src[10]]<<16) |
|
||||
((_UINT32)__gf_mulc_[src[11]]<<24);
|
||||
*dst_32 ^= tmp;
|
||||
dst_32++;
|
||||
tmp = ((UINT32)__gf_mulc_[src[12]]) | ((UINT32)__gf_mulc_[src[13]]<<8) | ((UINT32)__gf_mulc_[src[14]]<<16) |
|
||||
((UINT32)__gf_mulc_[src[15]]<<24);
|
||||
tmp = ((_UINT32)__gf_mulc_[src[12]]) | ((_UINT32)__gf_mulc_[src[13]]<<8) | ((_UINT32)__gf_mulc_[src[14]]<<16) |
|
||||
((_UINT32)__gf_mulc_[src[15]]<<24);
|
||||
*dst_32 ^= tmp;
|
||||
dst_32++;
|
||||
#endif
|
||||
|
||||
@@ -37,9 +37,9 @@
|
||||
#ifdef OF_USE_REED_SOLOMON_2_M_CODEC
|
||||
|
||||
|
||||
gf of_modnn(of_galois_field_code_cb_t* ofcb,INT32 x)
|
||||
gf of_modnn(of_galois_field_code_cb_t* ofcb,_INT32 x)
|
||||
{
|
||||
UINT16 field_size = ofcb->field_size;
|
||||
_UINT16 field_size = ofcb->field_size;
|
||||
while (x >= field_size)
|
||||
{
|
||||
x -= field_size;
|
||||
@@ -114,7 +114,7 @@ of_status_t of_rs_2m_build_encoding_matrix(of_galois_field_code_cb_t* ofcb)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
gf *tmp_m, *p;
|
||||
UINT32 k,r,col,row;
|
||||
_UINT32 k,r,col,row;
|
||||
k=ofcb->nb_source_symbols;
|
||||
r = ofcb->nb_repair_symbols;
|
||||
if ((ofcb->enc_matrix = of_malloc((k+r)*(k))) == NULL)
|
||||
@@ -188,7 +188,7 @@ of_status_t of_rs_2m_build_encoding_matrix(of_galois_field_code_cb_t* ofcb)
|
||||
of_status_t of_rs_2m_build_decoding_matrix(of_galois_field_code_cb_t* ofcb, int *index)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
UINT32 k,r,i;
|
||||
_UINT32 k,r,i;
|
||||
gf *p;
|
||||
k = ofcb->nb_source_symbols;
|
||||
r = ofcb->nb_repair_symbols;
|
||||
|
||||
@@ -36,12 +36,9 @@
|
||||
|
||||
#include "../of_reed-solomon_gf_2_m_includes.h"
|
||||
|
||||
#define bcmp(s1 ,s2, n) memcmp((s1), (s2), (size_t)(n))
|
||||
|
||||
#ifdef OF_USE_REED_SOLOMON_2_M_CODEC
|
||||
|
||||
#define FEC_MAGIC 0xFECC0DEC
|
||||
|
||||
#define FEC_MAGIC 0xFECC0DEC
|
||||
|
||||
/*
|
||||
* Primitive polynomials - see Lin & Costello, Appendix A,
|
||||
@@ -73,32 +70,36 @@ static const char *of_rs_allPp[] = /* GF_BITS polynomial */
|
||||
/**
|
||||
* Galois-Field-Code stable codec specific control block structure.
|
||||
*/
|
||||
typedef of_rs_2_m_cb_t of_galois_field_code_cb_t; /* XXX: the two types are synonymous in fact! */
|
||||
typedef of_rs_2_m_cb_t
|
||||
of_galois_field_code_cb_t; /* XXX: the two types are synonymous in fact! */
|
||||
|
||||
/**
|
||||
* just a helper to init all we need to use GF
|
||||
*/
|
||||
of_status_t of_rs_2m_init(of_galois_field_code_cb_t* ofcb);
|
||||
of_status_t of_rs_2m_init(of_galois_field_code_cb_t* ofcb);
|
||||
|
||||
/**
|
||||
* and the helper to release memory
|
||||
*/
|
||||
void of_rs_2m_release(of_galois_field_code_cb_t* ofcb);
|
||||
void of_rs_2m_release(of_galois_field_code_cb_t* ofcb);
|
||||
|
||||
/**
|
||||
* even if only decoder is defined, we need an encoding matrix.
|
||||
*/
|
||||
of_status_t of_rs_2m_build_encoding_matrix(of_galois_field_code_cb_t* ofcb);
|
||||
of_status_t of_rs_2m_build_encoding_matrix(of_galois_field_code_cb_t* ofcb);
|
||||
|
||||
#ifdef OF_USE_DECODER
|
||||
of_status_t of_rs_2m_build_decoding_matrix(of_galois_field_code_cb_t* ofcb,int* index);
|
||||
of_status_t of_rs_2m_decode(of_galois_field_code_cb_t* ofcb,gf *pkt[], int index[], int sz);
|
||||
of_status_t of_rs_2m_build_decoding_matrix(of_galois_field_code_cb_t* ofcb,
|
||||
int* index);
|
||||
of_status_t of_rs_2m_decode(of_galois_field_code_cb_t* ofcb, gf* pkt[],
|
||||
int index[], int sz);
|
||||
#endif
|
||||
|
||||
#ifdef OF_USE_ENCODER
|
||||
of_status_t of_rs_2m_encode(of_galois_field_code_cb_t* ofcb,gf *_src[], gf *_fec, int index, int sz);
|
||||
of_status_t of_rs_2m_encode(of_galois_field_code_cb_t* ofcb, gf* _src[],
|
||||
gf* _fec, int index, int sz);
|
||||
#endif
|
||||
|
||||
#endif //OF_USE_GALOIS_FIELD_CODES_UTILS
|
||||
#endif // OF_USE_GALOIS_FIELD_CODES_UTILS
|
||||
|
||||
#endif //GALOIS_FIELD_CODE_H
|
||||
#endif // GALOIS_FIELD_CODE_H
|
||||
|
||||
@@ -51,13 +51,13 @@ typedef struct of_rs_2_m_cb
|
||||
***********************************************************************************/
|
||||
of_codec_id_t codec_id; /* must begin with fec_codec_id */
|
||||
of_codec_type_t codec_type; /* must be 2nd item */
|
||||
UINT32 nb_source_symbols; /** k parameter (AKA code dimension). */
|
||||
UINT32 nb_repair_symbols; /** r = n - k parameter. */
|
||||
UINT32 encoding_symbol_length; /** symbol length. */
|
||||
_UINT32 nb_source_symbols; /** k parameter (AKA code dimension). */
|
||||
_UINT32 nb_repair_symbols; /** r = n - k parameter. */
|
||||
_UINT32 encoding_symbol_length; /** symbol length. */
|
||||
/***********************************************************************************/
|
||||
|
||||
UINT16 m; /* in theory between 2..16. Currently only values 4 and 8 are supported */
|
||||
UINT16 field_size; /* 2^m */
|
||||
_UINT16 m; /* in theory between 2..16. Currently only values 4 and 8 are supported */
|
||||
_UINT16 field_size; /* 2^m */
|
||||
gf* of_rs_gf_exp; /* index->poly form conversion table. */
|
||||
int* of_rs_gf_log; /* Poly->index form conversion table. */
|
||||
gf* of_rs_inverse; /* inverse of field elem. */
|
||||
@@ -79,15 +79,15 @@ typedef struct of_rs_2_m_cb
|
||||
#endif
|
||||
/***********************************************************************************/
|
||||
|
||||
UINT32 magic;
|
||||
_UINT32 magic;
|
||||
|
||||
/** Maximum number of source symbols supported by this codec for practical reasons. */
|
||||
UINT32 max_nb_source_symbols;
|
||||
_UINT32 max_nb_source_symbols;
|
||||
/** Maximum number of encoding symbols supported by this codec for practical reasons. */
|
||||
UINT32 max_nb_encoding_symbols;
|
||||
_UINT32 max_nb_encoding_symbols;
|
||||
/* maximum m value in GF(2^m) supported by the codec */
|
||||
UINT16 max_m;
|
||||
UINT32 nb_encoding_symbols;
|
||||
_UINT16 max_m;
|
||||
_UINT32 nb_encoding_symbols;
|
||||
#ifdef OF_USE_DECODER
|
||||
/*
|
||||
* decoder specific variables.
|
||||
@@ -99,20 +99,20 @@ typedef struct of_rs_2_m_cb
|
||||
void ** available_symbols_tab;
|
||||
/** Number of available source and repair symbols. This is the number of entries in
|
||||
* the available_symbols_tab tables. */
|
||||
UINT32 nb_available_symbols;
|
||||
_UINT32 nb_available_symbols;
|
||||
/** Number of available source symbols. */
|
||||
UINT32 nb_available_source_symbols;
|
||||
_UINT32 nb_available_source_symbols;
|
||||
bool decoding_finished; /** true as soon as decoding completed. */
|
||||
#endif /* OF_USE_DECODER */
|
||||
|
||||
|
||||
/** callbacks for this codec. */
|
||||
void* (*decoded_source_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded source symbol */
|
||||
UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded source symbol */
|
||||
_UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
void* (*decoded_repair_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded repair symbol */
|
||||
UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded repair symbol */
|
||||
_UINT32 esi); /* encoding symbol ID in {0..k-1} */
|
||||
void* context_4_callback;
|
||||
|
||||
} of_rs_2_m_cb_t;
|
||||
@@ -162,8 +162,8 @@ of_status_t of_rs_2_m_set_fec_parameters (of_rs_2_m_cb_t* ofcb,
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_rs_2_m_set_callback_functions (of_rs_2_m_cb_t *ofcb,void* (*decoded_source_symbol_callback)
|
||||
* (void *context,UINT32 size,UINT32 esi), void* (*decoded_repair_symbol_callback)
|
||||
* (void *context,UINT32 size,UINT32 esi),void* context_4_callback)
|
||||
* (void *context,_UINT32 size,_UINT32 esi), void* (*decoded_repair_symbol_callback)
|
||||
* (void *context,_UINT32 size,_UINT32 esi),void* context_4_callback)
|
||||
* @brief set various callbock functions (see header of_open_fec_api.h)
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
*
|
||||
@@ -187,16 +187,16 @@ of_status_t of_rs_2_m_set_fec_parameters (of_rs_2_m_cb_t* ofcb,
|
||||
*/
|
||||
of_status_t of_rs_2_m_set_callback_functions (of_rs_2_m_cb_t* ofcb,
|
||||
void* (*decoded_source_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded source symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded source symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
void* (*decoded_repair_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded repair symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded repair symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
void* context_4_callback);
|
||||
|
||||
#ifdef OF_USE_ENCODER
|
||||
/**
|
||||
* @fn of_status_t of_rs_2_m_build_repair_symbol (of_rs_2_m_cb_t* ofcb, void* encoding_symbols_tab[], UINT32 esi_of_symbol_to_build)
|
||||
* @fn of_status_t of_rs_2_m_build_repair_symbol (of_rs_2_m_cb_t* ofcb, void* encoding_symbols_tab[], _UINT32 esi_of_symbol_to_build)
|
||||
* @brief build a repair symbol (encoder only)
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param encoding_symbols_tab (IN/OUT) table of source and repair symbols.
|
||||
@@ -210,12 +210,12 @@ of_status_t of_rs_2_m_set_callback_functions (of_rs_2_m_cb_t* ofcb,
|
||||
*/
|
||||
of_status_t of_rs_2_m_build_repair_symbol (of_rs_2_m_cb_t* ofcb,
|
||||
void* encoding_symbols_tab[],
|
||||
UINT32 esi_of_symbol_to_build);
|
||||
_UINT32 esi_of_symbol_to_build);
|
||||
#endif //OF_USE_ENCODER
|
||||
|
||||
#ifdef OF_USE_DECODER
|
||||
/**
|
||||
* @fn of_status_t of_rs_2_m_decode_with_new_symbol (of_rs_2_m_cb_t* ofcb, void* const new_symbol_buf, UINT32 new_symbol_esi)
|
||||
* @fn of_status_t of_rs_2_m_decode_with_new_symbol (of_rs_2_m_cb_t* ofcb, void* const new_symbol_buf, _UINT32 new_symbol_esi)
|
||||
* @brief (try to) decode with a newly received symbol
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param new_symbol (IN) Pointer to the encoding symbol now available (i.e. a new
|
||||
@@ -226,7 +226,7 @@ of_status_t of_rs_2_m_build_repair_symbol (of_rs_2_m_cb_t* ofcb,
|
||||
*/
|
||||
of_status_t of_rs_2_m_decode_with_new_symbol (of_rs_2_m_cb_t* ofcb,
|
||||
void* new_symbol,
|
||||
UINT32 new_symbol_esi);
|
||||
_UINT32 new_symbol_esi);
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_rs_2_m_set_available_symbols (of_rs_2_m_cb_t* ofcb, void* const encoding_symbols_tab[]);
|
||||
@@ -274,7 +274,7 @@ of_status_t of_rs_2_m_get_source_symbols_tab (of_rs_2_m_cb_t* ofcb,
|
||||
#endif //OF_USE_DECODER
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_rs_2_m_set_control_parameter (of_rs_2_m_cb_t* ofcb,UINT32 type,void* value,UINT32 length)
|
||||
* @fn of_status_t of_rs_2_m_set_control_parameter (of_rs_2_m_cb_t* ofcb,_UINT32 type,void* value,_UINT32 length)
|
||||
* @brief set a specific FEC parameter
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param type (IN) Type of parameter. This type is FEC codec ID specific.
|
||||
@@ -284,12 +284,12 @@ of_status_t of_rs_2_m_get_source_symbols_tab (of_rs_2_m_cb_t* ofcb,
|
||||
* @return Error status.
|
||||
*/
|
||||
of_status_t of_rs_2_m_set_control_parameter (of_rs_2_m_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length);
|
||||
_UINT32 length);
|
||||
|
||||
/**
|
||||
* @fn of_status_t of_rs_2_m_get_control_parameter (of_rs_2_m_cb_t* ofcb,UINT32 type,void* value,UINT32 length)
|
||||
* @fn of_status_t of_rs_2_m_get_control_parameter (of_rs_2_m_cb_t* ofcb,_UINT32 type,void* value,_UINT32 length)
|
||||
* @brief get a specific FEC parameter
|
||||
* @param ofcb (IN) Pointer to the session.
|
||||
* @param type (IN) Type of parameter. This type is FEC codec ID specific.
|
||||
@@ -301,9 +301,9 @@ of_status_t of_rs_2_m_set_control_parameter (of_rs_2_m_cb_t* ofcb,
|
||||
* @return Error status.
|
||||
*/
|
||||
of_status_t of_rs_2_m_get_control_parameter (of_rs_2_m_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length);
|
||||
_UINT32 length);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -119,11 +119,11 @@ error:
|
||||
|
||||
of_status_t of_rs_2_m_set_callback_functions (of_rs_2_m_cb_t* ofcb,
|
||||
void* (*decoded_source_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded source symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded source symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
void* (*decoded_repair_symbol_callback) (void *context,
|
||||
UINT32 size, /* size of decoded repair symbol */
|
||||
UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
_UINT32 size, /* size of decoded repair symbol */
|
||||
_UINT32 esi), /* encoding symbol ID in {0..k-1} */
|
||||
void* context_4_callback)
|
||||
{
|
||||
ofcb->decoded_source_symbol_callback = decoded_source_symbol_callback;
|
||||
@@ -141,7 +141,7 @@ of_status_t of_rs_2_m_set_callback_functions (of_rs_2_m_cb_t* ofcb,
|
||||
|
||||
of_status_t of_rs_2_m_build_repair_symbol (of_rs_2_m_cb_t* ofcb,
|
||||
void* encoding_symbols_tab[],
|
||||
UINT32 esi_of_symbol_to_build)
|
||||
_UINT32 esi_of_symbol_to_build)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
if (esi_of_symbol_to_build < ofcb->nb_source_symbols || esi_of_symbol_to_build >= ofcb->nb_encoding_symbols)
|
||||
@@ -185,7 +185,7 @@ error:
|
||||
#ifdef OF_USE_DECODER
|
||||
of_status_t of_rs_2_m_decode_with_new_symbol (of_rs_2_m_cb_t* ofcb,
|
||||
void* new_symbol,
|
||||
UINT32 new_symbol_esi)
|
||||
_UINT32 new_symbol_esi)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
if (ofcb->decoding_finished)
|
||||
@@ -241,7 +241,7 @@ error:
|
||||
of_status_t of_rs_2_m_set_available_symbols (of_rs_2_m_cb_t* ofcb,
|
||||
void* const encoding_symbols_tab[])
|
||||
{
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
ofcb->nb_available_symbols = 0;
|
||||
@@ -266,18 +266,18 @@ of_status_t of_rs_2_m_set_available_symbols (of_rs_2_m_cb_t* ofcb,
|
||||
#if 0 /* new */
|
||||
of_status_t of_rs_2_m_finish_decoding (of_rs_2_m_cb_t* ofcb)
|
||||
{
|
||||
UINT32 k;
|
||||
UINT32 n;
|
||||
_UINT32 k;
|
||||
_UINT32 n;
|
||||
char *tmp_buf[ofcb->nb_source_symbols];/* keep available source/repair symbol buffers here... */
|
||||
int tmp_esi[ofcb->nb_source_symbols]; /* ...and their esi here. In fact we only need k entries
|
||||
* in these tables, but in order to avoid using malloc (time
|
||||
* consumming), we use an automatic table of maximum size for
|
||||
* both tmp_buf[] and tmp_esi[]. */
|
||||
INT32 tmp_idx; /* index in tmp_buf[] and tmp_esi[] tabs */
|
||||
_INT32 tmp_idx; /* index in tmp_buf[] and tmp_esi[] tabs */
|
||||
void **ass_buf; /* tmp pointer to the current available source symbol entry in available_symbols_tab[] */
|
||||
UINT32 ass_esi; /* corresponding available source symbol ESI */
|
||||
_UINT32 ass_esi; /* corresponding available source symbol ESI */
|
||||
void **ars_buf; /* tmp pointer to the current available repair symbol entry in available_symbols_tab[] */
|
||||
UINT32 ars_esi; /* corresponding available repair symbol ESI */
|
||||
_UINT32 ars_esi; /* corresponding available repair symbol ESI */
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
if (ofcb->decoding_finished)
|
||||
@@ -372,20 +372,20 @@ error:
|
||||
|
||||
of_status_t of_rs_2_m_finish_decoding (of_rs_2_m_cb_t* ofcb)
|
||||
{
|
||||
UINT32 k;
|
||||
UINT32 n;
|
||||
_UINT32 k;
|
||||
_UINT32 n;
|
||||
// char *tmp_buf[ofcb->nb_source_symbols];/* keep available source/repair symbol buffers here... */
|
||||
// int tmp_esi[ofcb->nb_source_symbols]; /* ...and their esi here. In fact we only need k entries
|
||||
// * in these tables, but in order to avoid using malloc (time
|
||||
// * consumming), we use an automatic table of maximum size for
|
||||
// * both tmp_buf[] and tmp_esi[]. */
|
||||
INT32 tmp_idx; /* index in tmp_buf[] and tmp_esi[] tabs */
|
||||
_INT32 tmp_idx; /* index in tmp_buf[] and tmp_esi[] tabs */
|
||||
char *large_buf = NULL; /* single large buffer where to copy all source/repair symbols */
|
||||
UINT32 off; /* offset, in unit of characters, in large_buf */
|
||||
_UINT32 off; /* offset, in unit of characters, in large_buf */
|
||||
void **ass_buf; /* tmp pointer to the current available source symbol entry in available_symbols_tab[] */
|
||||
UINT32 ass_esi; /* corresponding available source symbol ESI */
|
||||
_UINT32 ass_esi; /* corresponding available source symbol ESI */
|
||||
void **ars_buf; /* tmp pointer to the current available repair symbol entry in available_symbols_tab[] */
|
||||
UINT32 ars_esi; /* corresponding available repair symbol ESI */
|
||||
_UINT32 ars_esi; /* corresponding available repair symbol ESI */
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
if (ofcb->decoding_finished)
|
||||
@@ -570,7 +570,7 @@ of_status_t of_rs_2_m_get_source_symbols_tab (of_rs_2_m_cb_t* ofcb,
|
||||
return OF_STATUS_ERROR;
|
||||
}
|
||||
#if 0
|
||||
UINT32 i;
|
||||
_UINT32 i;
|
||||
for (i = 0; i < ofcb->nb_source_symbols; i++)
|
||||
{
|
||||
if (source_symbols_tab[i] == NULL)
|
||||
@@ -589,20 +589,20 @@ of_status_t of_rs_2_m_get_source_symbols_tab (of_rs_2_m_cb_t* ofcb,
|
||||
#endif //OF_USE_DECODER
|
||||
|
||||
of_status_t of_rs_2_m_set_control_parameter (of_rs_2_m_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length)
|
||||
_UINT32 length)
|
||||
{
|
||||
UINT16 m;
|
||||
_UINT16 m;
|
||||
|
||||
OF_ENTER_FUNCTION
|
||||
switch (type) {
|
||||
case OF_RS_CTRL_SET_FIELD_SIZE:
|
||||
if (value == NULL || length != sizeof(UINT16)) {
|
||||
OF_PRINT_ERROR(("OF_CTRL_SET_FIELD_SIZE ERROR: null value or bad length (got %d, expected %zu)\n", length, sizeof(UINT16)))
|
||||
if (value == NULL || length != sizeof(_UINT16)) {
|
||||
OF_PRINT_ERROR(("OF_CTRL_SET_FIELD_SIZE ERROR: null value or bad length (got %d, expected %zu)\n", length, sizeof(_UINT16)))
|
||||
goto error;
|
||||
}
|
||||
m = *(UINT16*)value;
|
||||
m = *(_UINT16*)value;
|
||||
if (m != 4 && m != 8) {
|
||||
OF_PRINT_ERROR(("ERROR: invalid m=%d parameter (must be 4 or 8)\n", m));
|
||||
goto error;
|
||||
@@ -626,36 +626,36 @@ error:
|
||||
|
||||
|
||||
of_status_t of_rs_2_m_get_control_parameter (of_rs_2_m_cb_t* ofcb,
|
||||
UINT32 type,
|
||||
_UINT32 type,
|
||||
void* value,
|
||||
UINT32 length)
|
||||
_UINT32 length)
|
||||
{
|
||||
OF_ENTER_FUNCTION
|
||||
switch (type) {
|
||||
case OF_CTRL_GET_MAX_K:
|
||||
if (value == NULL || length != sizeof(UINT32)) {
|
||||
OF_PRINT_ERROR(("OF_CTRL_GET_MAX_K ERROR: null value or bad length (got %d, expected %zu)\n", length, sizeof(UINT32)))
|
||||
if (value == NULL || length != sizeof(_UINT32)) {
|
||||
OF_PRINT_ERROR(("OF_CTRL_GET_MAX_K ERROR: null value or bad length (got %d, expected %zu)\n", length, sizeof(_UINT32)))
|
||||
goto error;
|
||||
}
|
||||
if (ofcb->max_nb_source_symbols == 0) {
|
||||
OF_PRINT_ERROR(("OF_CTRL_GET_MAX_K ERROR: this parameter is not initialized. Use the of_rs_2_m_set_fec_parameters function to initialize it or of_rs_2_m_set_control_parameter.\n"))
|
||||
goto error;
|
||||
}
|
||||
*(UINT32*)value = ofcb->max_nb_source_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_K (%d)\n", __FUNCTION__, *(UINT32*)value))
|
||||
*(_UINT32*)value = ofcb->max_nb_source_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_K (%d)\n", __FUNCTION__, *(_UINT32*)value))
|
||||
break;
|
||||
|
||||
case OF_CTRL_GET_MAX_N:
|
||||
if (value == NULL || length != sizeof(UINT32)) {
|
||||
OF_PRINT_ERROR(("OF_CTRL_GET_MAX_N ERROR: null value or bad length (got %d, expected %zu)\n", length, sizeof(UINT32)))
|
||||
if (value == NULL || length != sizeof(_UINT32)) {
|
||||
OF_PRINT_ERROR(("OF_CTRL_GET_MAX_N ERROR: null value or bad length (got %d, expected %zu)\n", length, sizeof(_UINT32)))
|
||||
goto error;
|
||||
}
|
||||
if (ofcb->max_nb_encoding_symbols == 0) {
|
||||
OF_PRINT_ERROR(("OF_CTRL_GET_MAX_N ERROR: this parameter is not initialized. Use the of_rs_2_m_set_fec_parameters function to initialize it or of_rs_2_m_set_control_parameter.\n"))
|
||||
goto error;
|
||||
}
|
||||
*(UINT32*)value = ofcb->max_nb_encoding_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_N (%d)\n", __FUNCTION__, *(UINT32*)value))
|
||||
*(_UINT32*)value = ofcb->max_nb_encoding_symbols;
|
||||
OF_TRACE_LVL(1, ("%s: OF_CTRL_GET_MAX_N (%d)\n", __FUNCTION__, *(_UINT32*)value))
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -45,13 +45,13 @@
|
||||
*/
|
||||
typedef struct of_rs_2_m_parameters
|
||||
{
|
||||
UINT32 nb_source_symbols; /* must be 1st item */
|
||||
UINT32 nb_repair_symbols; /* must be 2nd item */
|
||||
UINT32 encoding_symbol_length; /* must be 3rd item */
|
||||
_UINT32 nb_source_symbols; /* must be 1st item */
|
||||
_UINT32 nb_repair_symbols; /* must be 2nd item */
|
||||
_UINT32 encoding_symbol_length; /* must be 3rd item */
|
||||
/*
|
||||
* FEC codec id specific attributes follow...
|
||||
*/
|
||||
UINT16 m; /* WARNING: was bit_size */
|
||||
_UINT16 m; /* WARNING: was bit_size */
|
||||
|
||||
} of_rs_2_m_parameters_t;
|
||||
|
||||
|
||||
5
thirdparty/openfec/xmake.lua
vendored
5
thirdparty/openfec/xmake.lua
vendored
@@ -7,11 +7,14 @@ package("openfec")
|
||||
on_install(function (package)
|
||||
local configs = {}
|
||||
table.insert(configs, "-DDEBUG:STRING=" .. (package:debug() and "ON" or "OFF"))
|
||||
table.insert(configs, "-DLIBRARY_OUTPUT_PATH=" .. (path.join(package:installdir(), "lib")))
|
||||
table.insert(configs, "-DLIBRARY_OUTPUT_PATH=" .. (path.join(package:installdir(), "lib")))
|
||||
|
||||
import("package.tools.cmake").install(package, configs)
|
||||
os.cp("src", package:installdir())
|
||||
package:add("includedirs", "src")
|
||||
if is_plat("windows") then
|
||||
os.cp(path.join(package:installdir(), "lib/Release/openfec.lib"), package:installdir("lib"))
|
||||
end
|
||||
end)
|
||||
|
||||
on_test(function (package)
|
||||
|
||||
Reference in New Issue
Block a user