diff options
Diffstat (limited to 'converter/other/fiasco')
100 files changed, 1205 insertions, 1234 deletions
diff --git a/converter/other/fiasco/binerror.c b/converter/other/fiasco/binerror.c index 77243c64..9820d853 100644 --- a/converter/other/fiasco/binerror.c +++ b/converter/other/fiasco/binerror.c @@ -7,8 +7,8 @@ * Credits: Modelled after variable argument routines from Jef * Poskanzer's pbmplus package. * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* @@ -18,6 +18,7 @@ * $State: Exp $ */ +#define _DEFAULT_SOURCE 1 /* New name for SVID & BSD source defines */ #define _BSD_SOURCE 1 /* Make sure strdup() is in string.h */ #define _XOPEN_SOURCE 500 /* Make sure strdup() is in string.h */ #define _ERROR_C diff --git a/converter/other/fiasco/binerror.h b/converter/other/fiasco/binerror.h index e7ff43c9..4f313aca 100644 --- a/converter/other/fiasco/binerror.h +++ b/converter/other/fiasco/binerror.h @@ -4,8 +4,8 @@ * Written by: Stefan Frank * Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/buttons.c b/converter/other/fiasco/buttons.c index 82ed18cd..fc54d84a 100644 --- a/converter/other/fiasco/buttons.c +++ b/converter/other/fiasco/buttons.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/buttons.h b/converter/other/fiasco/buttons.h index a09f3423..079715f5 100644 --- a/converter/other/fiasco/buttons.h +++ b/converter/other/fiasco/buttons.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/approx.c b/converter/other/fiasco/codec/approx.c index 5072fae3..d8fefcaa 100644 --- a/converter/other/fiasco/codec/approx.c +++ b/converter/other/fiasco/codec/approx.c @@ -1,10 +1,10 @@ /* - * approx.c: Approximation of range images with matching pursuit + * approx.c: Approximation of range images with matching pursuit * - * Written by: Ullrich Hafner - * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * Written by: Ullrich Hafner + * + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* @@ -34,7 +34,7 @@ /***************************************************************************** - local variables + local variables *****************************************************************************/ @@ -52,227 +52,205 @@ typedef struct mp /***************************************************************************** - prototypes + prototypes *****************************************************************************/ static void orthogonalize (unsigned index, unsigned n, unsigned level, real_t min_norm, - const word_t *domain_blocks, const coding_t *c); + const word_t *domain_blocks, const coding_t *c); static void matching_pursuit (mp_t *mp, bool_t full_search, real_t price, - unsigned max_edges, int y_state, const range_t *range, - const domain_pool_t *domain_pool, const coeff_t *coeff, - const wfa_t *wfa, const coding_t *c); + unsigned max_edges, int y_state, const range_t *range, + const domain_pool_t *domain_pool, const coeff_t *coeff, + const wfa_t *wfa, const coding_t *c); /***************************************************************************** - public code + public code *****************************************************************************/ real_t approximate_range (real_t max_costs, real_t price, int max_edges, - int y_state, range_t *range, domain_pool_t *domain_pool, - coeff_t *coeff, const wfa_t *wfa, const coding_t *c) -/* - * Approximate image block 'range' by matching pursuit. This functions - * calls the matching pursuit algorithm several times (with different - * parameters) in order to find the best approximation. Refer to function - * 'matching_pursuit()' for more details about parameters. - * - * Return value: - * approximation costs - */ -{ - mp_t mp; - bool_t success = NO; - - /* - * First approximation attempt: default matching pursuit algorithm. - */ - mp.exclude [0] = NO_EDGE; - matching_pursuit (&mp, c->options.full_search, price, max_edges, - y_state, range, domain_pool, coeff, wfa, c); - - /* - * Next approximation attempt: remove domain block mp->indices [0] - * from domain pool (vector with smallest costs) and run the - * matching pursuit again. - */ - if (c->options.second_domain_block) - { - mp_t tmp_mp = mp; + int y_state, range_t *range, domain_pool_t *domain_pool, + coeff_t *coeff, const wfa_t *wfa, const coding_t *c) { +/*---------------------------------------------------------------------------- + Approximate image block 'range' by matching pursuit. This functions + calls the matching pursuit algorithm several times (with different + parameters) in order to find the best approximation. Refer to function + 'matching_pursuit()' for more details about parameters. + + Return value: approximation costs +-----------------------------------------------------------------------------*/ + mp_t mp; + + /* + * First approximation attempt: default matching pursuit algorithm. + */ + mp.exclude [0] = NO_EDGE; + matching_pursuit(&mp, c->options.full_search, price, max_edges, + y_state, range, domain_pool, coeff, wfa, c); + + /* + * Next approximation attempt: remove domain block mp->indices [0] + * from domain pool (vector with smallest costs) and run the + * matching pursuit again. + */ + if (c->options.second_domain_block) { + mp_t tmp_mp; - tmp_mp.exclude [0] = tmp_mp.indices [0]; - tmp_mp.exclude [1] = NO_EDGE; - - matching_pursuit (&tmp_mp, c->options.full_search, price, max_edges, - y_state, range, domain_pool, coeff, wfa, c); - if (tmp_mp.costs < mp.costs) /* success */ - { - success = YES; - mp = tmp_mp; - } - } - - /* - * Next approximation attempt: check whether some coefficients have - * been quantized to zero. Vectors causing the underflow are - * removed from the domain pool and then the matching pursuit - * algorithm is run again (until underflow doesn't occur anymore). - */ - if (c->options.check_for_underflow) - { - int iteration = -1; - mp_t tmp_mp = mp; + tmp_mp = mp; /* initial value */ + + tmp_mp.exclude[0] = tmp_mp.indices [0]; + tmp_mp.exclude[1] = NO_EDGE; + + matching_pursuit(&tmp_mp, c->options.full_search, price, max_edges, + y_state, range, domain_pool, coeff, wfa, c); + if (tmp_mp.costs < mp.costs) /* success */ + mp = tmp_mp; + } + + /* + * Next approximation attempt: check whether some coefficients have + * been quantized to zero. Vectors causing the underflow are + * removed from the domain pool and then the matching pursuit + * algorithm is run again (until underflow doesn't occur anymore). + */ + if (c->options.check_for_underflow) { + mp_t tmp_mp; + int iteration; + + tmp_mp = mp; /* initial value */ + iteration = -1; /* initial value */ - do - { - int i; + do { + int i; + + ++iteration; + tmp_mp.exclude[iteration] = NO_EDGE; + + for (i = 0; isdomain(tmp_mp.indices[i]); ++i) { + if (tmp_mp.weight [i] == 0) { + tmp_mp.exclude[iteration] = tmp_mp.indices [i]; + break; + } + } + if (isdomain (tmp_mp.exclude [iteration])) { + /* try again */ + tmp_mp.exclude [iteration + 1] = NO_EDGE; + + matching_pursuit(&tmp_mp, c->options.full_search, price, + max_edges, y_state, range, domain_pool, + coeff, wfa, c); + if (tmp_mp.costs < mp.costs) /* success */ + mp = tmp_mp; + } + } while (isdomain (tmp_mp.exclude [iteration]) + && iteration < MAXEDGES - 1); + } + + /* + * Next approximation attempt: check whether some coefficients have + * been quantized to +/- max-value. Vectors causing the overflow are + * removed from the domain pool and then the matching pursuit + * algorithm is run again (until overflow doesn't occur anymore). + */ + if (c->options.check_for_overflow) { + mp_t tmp_mp; + int iteration; + + tmp_mp = mp; /* initial value */ + iteration = -1; /* initial value */ + + do { + int i; - iteration++; - tmp_mp.exclude [iteration] = NO_EDGE; - - for (i = 0; isdomain (tmp_mp.indices [i]); i++) - if (tmp_mp.weight [i] == 0) - { - tmp_mp.exclude [iteration] = tmp_mp.indices [i]; - break; - } + ++iteration; + tmp_mp.exclude[iteration] = NO_EDGE; + + for (i = 0; isdomain (tmp_mp.indices [i]); ++i) { + rpf_t * const rpf = + tmp_mp.indices [i] ? coeff->rpf : coeff->dc_rpf; + + if (tmp_mp.weight [i] == btor (rtob (200, rpf), rpf) + || tmp_mp.weight [i] == btor (rtob (-200, rpf), rpf)) { + tmp_mp.exclude [iteration] = tmp_mp.indices [i]; + break; + } + } - if (isdomain (tmp_mp.exclude [iteration])) /* try again */ - { - tmp_mp.exclude [iteration + 1] = NO_EDGE; - - matching_pursuit (&tmp_mp, c->options.full_search, price, - max_edges, y_state, range, domain_pool, - coeff, wfa, c); - if (tmp_mp.costs < mp.costs) /* success */ - { - success = YES; - mp = tmp_mp; - } - } - } while (isdomain (tmp_mp.exclude [iteration]) - && iteration < MAXEDGES - 1); - } - - /* - * Next approximation attempt: check whether some coefficients have - * been quantized to +/- max-value. Vectors causing the overflow are - * removed from the domain pool and then the matching pursuit - * algorithm is run again (until overflow doesn't occur anymore). - */ - if (c->options.check_for_overflow) - { - int iteration = -1; - mp_t tmp_mp = mp; - - do - { - int i; - - iteration++; - tmp_mp.exclude [iteration] = NO_EDGE; - - for (i = 0; isdomain (tmp_mp.indices [i]); i++) - { - rpf_t *rpf = tmp_mp.indices [i] ? coeff->rpf : coeff->dc_rpf; - - if (tmp_mp.weight [i] == btor (rtob (200, rpf), rpf) - || tmp_mp.weight [i] == btor (rtob (-200, rpf), rpf)) - { - tmp_mp.exclude [iteration] = tmp_mp.indices [i]; - break; - } - } + if (isdomain(tmp_mp.exclude[iteration])) { + /* try again */ + tmp_mp.exclude[iteration + 1] = NO_EDGE; + + matching_pursuit(&tmp_mp, c->options.full_search, price, + max_edges, y_state, range, domain_pool, + coeff, wfa, c); + if (tmp_mp.costs < mp.costs) /* success */ + mp = tmp_mp; + } + } while (isdomain (tmp_mp.exclude [iteration]) + && iteration < MAXEDGES - 1); + } + + /* + * Finally, check whether the best approximation has costs + * smaller than 'max_costs'. + */ + if (mp.costs < max_costs) { + int edge; + int new_index, old_index; + + new_index = 0; + for (old_index = 0; isdomain (mp.indices[old_index]); ++old_index) { + if (mp.weight [old_index] != 0) { + mp.indices [new_index] = mp.indices [old_index]; + mp.into [new_index] = mp.into [old_index]; + mp.weight [new_index] = mp.weight [old_index]; + ++new_index; + } + } + mp.indices [new_index] = NO_EDGE; + mp.into [new_index] = NO_EDGE; + + /* + * Update of probability models + */ + { + word_t * const domain_blocks = + domain_pool->generate(range->level, y_state, + wfa, + domain_pool->model); + domain_pool->update(domain_blocks, mp.indices, + range->level, y_state, wfa, + domain_pool->model); + coeff->update (mp.weight, mp.into, range->level, coeff); + + Free(domain_blocks); + } - if (isdomain (tmp_mp.exclude [iteration])) /* try again */ - { - tmp_mp.exclude [iteration + 1] = NO_EDGE; - - matching_pursuit (&tmp_mp, c->options.full_search, price, - max_edges, y_state, range, domain_pool, - coeff, wfa, c); - if (tmp_mp.costs < mp.costs) /* success */ - { - success = YES; - mp = tmp_mp; - } - } - } while (isdomain (tmp_mp.exclude [iteration]) - && iteration < MAXEDGES - 1); - } - - /* - * Finally, check whether the best approximation has costs - * smaller than 'max_costs'. - */ - if (mp.costs < max_costs) - { - int edge; - bool_t overflow = NO; - bool_t underflow = NO; - int new_index, old_index; - - new_index = 0; - for (old_index = 0; isdomain (mp.indices [old_index]); old_index++) - if (mp.weight [old_index] != 0) - { - rpf_t *rpf = mp.indices [old_index] ? coeff->rpf : coeff->dc_rpf; - - if (mp.weight [old_index] == btor (rtob (200, rpf), rpf) - || mp.weight [old_index] == btor (rtob (-200, rpf), rpf)) - overflow = YES; - - mp.indices [new_index] = mp.indices [old_index]; - mp.into [new_index] = mp.into [old_index]; - mp.weight [new_index] = mp.weight [old_index]; - new_index++; - } - else - underflow = YES; - - mp.indices [new_index] = NO_EDGE; - mp.into [new_index] = NO_EDGE; - - /* - * Update of probability models - */ - { - word_t *domain_blocks = domain_pool->generate (range->level, y_state, - wfa, - domain_pool->model); - domain_pool->update (domain_blocks, mp.indices, - range->level, y_state, wfa, domain_pool->model); - coeff->update (mp.weight, mp.into, range->level, coeff); - - Free (domain_blocks); - } - - for (edge = 0; isedge (mp.indices [edge]); edge++) - { - range->into [edge] = mp.into [edge]; - range->weight [edge] = mp.weight [edge]; - } - range->into [edge] = NO_EDGE; - range->matrix_bits = mp.matrix_bits; - range->weights_bits = mp.weights_bits; - range->err = mp.err; - } - else - { - range->into [0] = NO_EDGE; - mp.costs = MAXCOSTS; - } + for (edge = 0; isedge (mp.indices [edge]); ++edge) { + range->into [edge] = mp.into [edge]; + range->weight [edge] = mp.weight [edge]; + } + range->into [edge] = NO_EDGE; + range->matrix_bits = mp.matrix_bits; + range->weights_bits = mp.weights_bits; + range->err = mp.err; + } else { + range->into [0] = NO_EDGE; + mp.costs = MAXCOSTS; + } - return mp.costs; + return mp.costs; } + + /***************************************************************************** - local variables + local variables *****************************************************************************/ @@ -310,15 +288,15 @@ static bool_t used [MAXSTATES]; /***************************************************************************** - private code + private code *****************************************************************************/ static void matching_pursuit (mp_t *mp, bool_t full_search, real_t price, - unsigned max_edges, int y_state, const range_t *range, - const domain_pool_t *domain_pool, const coeff_t *coeff, - const wfa_t *wfa, const coding_t *c) + unsigned max_edges, int y_state, const range_t *range, + const domain_pool_t *domain_pool, const coeff_t *coeff, + const wfa_t *wfa, const coding_t *c) /* * Find an approximation of the current 'range' with a linear * combination of vectors of the 'domain_pool'. The linear @@ -339,311 +317,318 @@ matching_pursuit (mp_t *mp, bool_t full_search, real_t price, * No return value. * * Side effects: - * vectors, factors, rate, distortion and costs are stored in 'mp' + * vectors, factors, rate, distortion and costs are stored in 'mp' */ { - unsigned n; /* current vector of the OB */ - int index; /* best fitting domain image */ - unsigned domain; /* counter */ - real_t norm; /* norm of range image */ - real_t additional_bits; /* bits for mc, nd, and tree */ - word_t *domain_blocks; /* current set of domain images */ - const real_t min_norm = 2e-3; /* lower bound of norm */ - unsigned best_n = 0; - unsigned size = size_of_level (range->level); + unsigned n; /* current vector of the OB */ + int index; /* best fitting domain image */ + unsigned domain; /* counter */ + real_t norm; /* norm of range image */ + real_t additional_bits; /* bits for mc, nd, and tree */ + word_t *domain_blocks; /* current set of domain images */ + const real_t min_norm = 2e-3; /* lower bound of norm */ + unsigned best_n = 0; + unsigned size = size_of_level (range->level); - /* - * Initialize domain pool and inner product arrays - */ - domain_blocks = domain_pool->generate (range->level, y_state, wfa, - domain_pool->model); - for (domain = 0; domain_blocks [domain] >= 0; domain++) - { - used [domain] = NO; - rem_denominator [domain] /* norm of domain */ - = get_ip_state_state (domain_blocks [domain], domain_blocks [domain], - range->level, c); - if (rem_denominator [domain] / size < min_norm) - used [domain] = YES; /* don't use domains with small norm */ - else - rem_numerator [domain] /* inner product <s_domain, b> */ - = get_ip_image_state (range->image, range->address, - range->level, domain_blocks [domain], c); - if (!used [domain] && fabs (rem_numerator [domain]) < min_norm) - used [domain] = YES; - } - - /* - * Exclude all domain blocks given in array 'mp->exclude' - */ - for (n = 0; isdomain (mp->exclude [n]); n++) - used [mp->exclude [n]] = YES; - - /* - * Compute the approximation costs if 'range' is approximated with - * no linear combination, i.e. the error is equal to the square - * of the image norm and the size of the automaton is determined by - * storing only zero elements in the current matrix row - */ - for (norm = 0, n = 0; n < size; n++) - norm += square (c->pixels [range->address * size + n]); - - additional_bits = range->tree_bits + range->mv_tree_bits - + range->mv_coord_bits + range->nd_tree_bits - + range->nd_weights_bits; - - mp->err = norm; - mp->weights_bits = 0; - mp->matrix_bits = domain_pool->bits (domain_blocks, NULL, range->level, - y_state, wfa, domain_pool->model); - mp->costs = (mp->matrix_bits + mp->weights_bits - + additional_bits) * price + mp->err; - - n = 0; - do - { - /* - * Current approximation is: b = d_0 o_0 + ... + d_(n-1) o_(n-1) - * with corresponding costs 'range->err + range->bits * p'. - * For all remaining state images s_i (used[s_i] == NO) set - * o_n : = s_i - \sum(k = 0, ... , n-1) {(<s_i, o_k> / ||o_k||^2) o_k} - * and try to beat current costs. - * Choose that vector for the next orthogonalization step, - * which has minimal costs: s_index. - * (No progress is indicated by index == -1) - */ + /* + * Initialize domain pool and inner product arrays + */ + domain_blocks = domain_pool->generate (range->level, y_state, wfa, + domain_pool->model); + for (domain = 0; domain_blocks [domain] >= 0; domain++) + { + used [domain] = NO; + rem_denominator [domain] = /* norm of domain */ + get_ip_state_state (domain_blocks [domain], domain_blocks [domain], + range->level, c); + if (rem_denominator [domain] / size < min_norm) + used [domain] = YES; /* don't use domains with small norm */ + else + rem_numerator [domain] /* inner product <s_domain, b> */ + = get_ip_image_state (range->image, range->address, + range->level, domain_blocks [domain], c); + if (!used [domain] && fabs (rem_numerator [domain]) < min_norm) + used [domain] = YES; + } + + /* + * Exclude all domain blocks given in array 'mp->exclude' + */ + for (n = 0; isdomain (mp->exclude [n]); n++) + used [mp->exclude [n]] = YES; + + /* + * Compute the approximation costs if 'range' is approximated with + * no linear combination, i.e. the error is equal to the square + * of the image norm and the size of the automaton is determined by + * storing only zero elements in the current matrix row + */ + for (norm = 0, n = 0; n < size; n++) + norm += square (c->pixels [range->address * size + n]); + + additional_bits = range->tree_bits + range->mv_tree_bits + + range->mv_coord_bits + range->nd_tree_bits + + range->nd_weights_bits; + + mp->err = norm; + mp->weights_bits = 0; + mp->matrix_bits = domain_pool->bits (domain_blocks, NULL, range->level, + y_state, wfa, domain_pool->model); + mp->costs = (mp->matrix_bits + mp->weights_bits + + additional_bits) * price + mp->err; + + n = 0; + do + { + /* + * Current approximation is: b = d_0 o_0 + ... + d_(n-1) o_(n-1) + * with corresponding costs 'range->err + range->bits * p'. + * For all remaining state images s_i (used[s_i] == NO) set + * o_n : = s_i - \sum(k = 0, ... , n-1) {(<s_i, o_k> / ||o_k||^2) o_k} + * and try to beat current costs. + * Choose that vector for the next orthogonalization step, + * which has minimal costs: s_index. + * (No progress is indicated by index == -1) + */ - real_t min_matrix_bits = 0; - real_t min_weights_bits = 0; - real_t min_error = 0; - real_t min_weight [MAXEDGES]; - real_t min_costs = full_search ? MAXCOSTS : mp->costs; + real_t min_matrix_bits = 0; + real_t min_weights_bits = 0; + real_t min_error = 0; + real_t min_weight [MAXEDGES]; + real_t min_costs = full_search ? MAXCOSTS : mp->costs; - for (index = -1, domain = 0; domain_blocks [domain] >= 0; domain++) - if (!used [domain]) - { - real_t matrix_bits, weights_bits; - /* - * To speed up the search through the domain images, - * the costs of using domain image 'domain' as next vector - * can be approximated in a first step: - * improvement of image quality - * <= square (rem_numerator[domain]) / rem_denominator[domain] - */ - { - word_t vectors [MAXEDGES + 1]; - word_t states [MAXEDGES + 1]; - real_t weights [MAXEDGES + 1]; - unsigned i, k; - - for (i = 0, k = 0; k < n; k++) - if (mp->weight [k] != 0) - { - vectors [i] = mp->indices [k]; - states [i] = domain_blocks [vectors [i]]; - weights [i] = mp->weight [k]; - i++; - } - vectors [i] = domain; - states [i] = domain_blocks [domain]; - weights [i] = 0.5; - vectors [i + 1] = -1; - states [i + 1] = -1; - - weights_bits = coeff->bits (weights, states, range->level, - coeff); - matrix_bits = domain_pool->bits (domain_blocks, vectors, - range->level, y_state, - wfa, domain_pool->model); - } - if (((matrix_bits + weights_bits + additional_bits) * price + - mp->err - - square (rem_numerator [domain]) / rem_denominator [domain]) - < min_costs) - { - /* - * 1.) Compute the weights (linear factors) c_i of the - * linear combination - * b = c_0 v_0 + ... + c_(n-1) v_(n-1) + c_n v_'domain' - * Use backward substitution to obtain c_i from the linear - * factors of the lin. comb. b = d_0 o_0 + ... + d_n o_n - * of the corresponding orthogonal vectors {o_0, ..., o_n}. - * Vector o_n of the orthogonal basis is obtained by using - * vector 'v_domain' in step n of the Gram Schmidt - * orthogonalization (see above for definition of o_n). - * Recursive formula for the coefficients c_i: - * c_n := <b, o_n> / ||o_n||^2 - * for i = n - 1, ... , 0: - * c_i := <b, o_i> / ||o_i||^2 + - * \sum (k = i + 1, ... , n){ c_k <v_k, o_i> - * / ||o_i||^2 } - * 2.) Because linear factors are stored with reduced precision - * factor c_i is rounded with the given precision in step i - * of the recursive formula. - */ - - unsigned k; /* counter */ - int l; /* counter */ - real_t m_bits; /* number of matrix bits to store */ - real_t w_bits; /* number of weights bits to store */ - real_t r [MAXEDGES]; /* rounded linear factors */ - real_t f [MAXEDGES]; /* linear factors */ - int v [MAXEDGES]; /* mapping of domains to vectors */ - real_t costs; /* current approximation costs */ - real_t m_err; /* current approximation error */ - - f [n] = rem_numerator [domain] / rem_denominator [domain]; - v [n] = domain; /* corresponding mapping */ - for (k = 0; k < n; k++) - { - f [k] = ip_image_ortho_vector [k] / norm_ortho_vector [k]; - v [k] = mp->indices [k]; - } - - for (l = n; l >= 0; l--) - { - rpf_t *rpf = domain_blocks [v [l]] - ? coeff->rpf : coeff->dc_rpf; - - r [l] = f [l] = btor (rtob (f [l], rpf), rpf); - - for (k = 0; k < (unsigned) l; k++) - f [k] -= f [l] * ip_domain_ortho_vector [v [l]][k] - / norm_ortho_vector [k] ; - } - - /* - * Compute the number of output bits of the linear combination - * and store the weights with reduced precision. The - * resulting linear combination is - * b = r_0 v_0 + ... + r_(n-1) v_(n-1) + r_n v_'domain' - */ - { - word_t vectors [MAXEDGES + 1]; - word_t states [MAXEDGES + 1]; - real_t weights [MAXEDGES + 1]; - int i; - - for (i = 0, k = 0; k <= n; k++) - if (f [k] != 0) - { - vectors [i] = v [k]; - states [i] = domain_blocks [v [k]]; - weights [i] = f [k]; - i++; - } - vectors [i] = -1; - states [i] = -1; - - w_bits = coeff->bits (weights, states, range->level, coeff); - m_bits = domain_pool->bits (domain_blocks, vectors, - range->level, y_state, - wfa, domain_pool->model); - } - - /* - * To compute the approximation error, the corresponding - * linear factors of the linear combination - * b = r_0 o_0 + ... + r_(n-1) o_(n-1) + r_n o_'domain' - * with orthogonal vectors must be computed with following - * formula: - * r_i := r_i + - * \sum (k = i + 1, ... , n) { r_k <v_k, o_i> - * / ||o_i||^2 } - */ - for (l = 0; (unsigned) l <= n; l++) - { - /* - * compute <v_n, o_n> - */ - real_t a; - - a = get_ip_state_state (domain_blocks [v [l]], - domain_blocks [domain], - range->level, c); - for (k = 0; k < n; k++) - a -= ip_domain_ortho_vector [v [l]][k] - / norm_ortho_vector [k] - * ip_domain_ortho_vector [domain][k]; - ip_domain_ortho_vector [v [l]][n] = a; - } - norm_ortho_vector [n] = rem_denominator [domain]; - ip_image_ortho_vector [n] = rem_numerator [domain]; - - for (k = 0; k <= n; k++) - for (l = k + 1; (unsigned) l <= n; l++) - r [k] += ip_domain_ortho_vector [v [l]][k] * r [l] - / norm_ortho_vector [k]; - /* - * Compute approximation error: - * error := ||b||^2 + - * \sum (k = 0, ... , n){r_k^2 ||o_k||^2 - 2 r_k <b, o_k>} - */ - m_err = norm; - for (k = 0; k <= n; k++) - m_err += square (r [k]) * norm_ortho_vector [k] - - 2 * r [k] * ip_image_ortho_vector [k]; - if (m_err < 0) /* TODO: return MAXCOSTS */ - warning ("Negative image norm: %f" - " (current domain: %d, level = %d)", - (double) m_err, domain, range->level); - - costs = (m_bits + w_bits + additional_bits) * price + m_err; - if (costs < min_costs) /* found a better approximation */ - { - index = domain; - min_costs = costs; - min_matrix_bits = m_bits; - min_weights_bits = w_bits; - min_error = m_err; - for (k = 0; k <= n; k++) - min_weight [k] = f [k]; - } - } - } + for (index = -1, domain = 0; domain_blocks [domain] >= 0; domain++) + if (!used [domain]) + { + real_t matrix_bits, weights_bits; + /* + * To speed up the search through the domain images, + * the costs of using domain image 'domain' as next vector + * can be approximated in a first step: + * improvement of image quality + * <= square (rem_numerator[domain]) / rem_denominator[domain] + */ + { + word_t vectors [MAXEDGES + 1]; + word_t states [MAXEDGES + 1]; + real_t weights [MAXEDGES + 1]; + unsigned i, k; + + for (i = 0, k = 0; k < n; k++) + if (mp->weight [k] != 0) + { + vectors [i] = mp->indices [k]; + states [i] = domain_blocks [vectors [i]]; + weights [i] = mp->weight [k]; + i++; + } + vectors [i] = domain; + states [i] = domain_blocks [domain]; + weights [i] = 0.5; + vectors [i + 1] = -1; + states [i + 1] = -1; + + weights_bits = coeff->bits (weights, states, range->level, + coeff); + matrix_bits = domain_pool->bits (domain_blocks, vectors, + range->level, y_state, + wfa, domain_pool->model); + } + if (((matrix_bits + weights_bits + additional_bits) * price + + mp->err - + square (rem_numerator[domain]) / rem_denominator[domain]) + < min_costs) + { + /* + * 1.) Compute the weights (linear factors) c_i of the + * linear combination + * b = c_0 v_0 + ... + c_(n-1) v_(n-1) + c_n v_'domain' + * Use backward substitution to obtain c_i from the linear + * factors of the lin. comb. b = d_0 o_0 + ... + d_n o_n + * of the corresponding orthogonal vectors {o_0, ..., o_n}. + * Vector o_n of the orthogonal basis is obtained by using + * vector 'v_domain' in step n of the Gram Schmidt + * orthogonalization (see above for definition of o_n). + * Recursive formula for the coefficients c_i: + * c_n := <b, o_n> / ||o_n||^2 + * for i = n - 1, ... , 0: + * c_i := <b, o_i> / ||o_i||^2 + + * \sum (k = i + 1, ... , n){ c_k <v_k, o_i> + * / ||o_i||^2 } + * 2.) Because linear factors are stored with reduced + * precision factor c_i is rounded with the given + * precision in step i of the recursive formula. + */ + + unsigned k; /* counter */ + int l; /* counter */ + real_t m_bits; /* number of matrix bits to store */ + real_t w_bits; /* number of weights bits to store */ + real_t r [MAXEDGES]; /* rounded linear factors */ + real_t f [MAXEDGES]; /* linear factors */ + int v [MAXEDGES]; /* mapping of domains to vectors*/ + real_t costs; /* current approximation costs */ + real_t m_err; /* current approximation error */ + + f [n] = rem_numerator [domain] / rem_denominator [domain]; + v [n] = domain; /* corresponding mapping */ + for (k = 0; k < n; k++) + { + f[k] = ip_image_ortho_vector[k] / norm_ortho_vector[k]; + v [k] = mp->indices [k]; + } + + for (l = n; l >= 0; --l) { + rpf_t * const rpf = domain_blocks[v[l]] + ? coeff->rpf : coeff->dc_rpf; + + unsigned int k; + + r[l] = f[l] = btor(rtob(f[l], rpf), rpf); + + { + real_t const fl = f[l]; + + for (k = 0; k < l; ++k) { + f[k] -= fl * ip_domain_ortho_vector[v[l]][k] + / norm_ortho_vector[k]; + } + } + } + + /* + * Compute the number of output bits of the linear + * combination and store the weights with reduced + * precision. The resulting linear combination is + * b = r_0 v_0 + ... + r_(n-1) v_(n-1) + r_n v_'domain' + */ + { + word_t vectors [MAXEDGES + 1]; + word_t states [MAXEDGES + 1]; + real_t weights [MAXEDGES + 1]; + int i; + + for (i = 0, k = 0; k <= n; k++) + if (f [k] != 0) + { + vectors [i] = v [k]; + states [i] = domain_blocks [v [k]]; + weights [i] = f [k]; + i++; + } + vectors [i] = -1; + states [i] = -1; + + w_bits = + coeff->bits(weights, states, range->level, coeff); + m_bits = domain_pool->bits (domain_blocks, vectors, + range->level, y_state, + wfa, domain_pool->model); + } + + /* + * To compute the approximation error, the corresponding + * linear factors of the linear combination + * b = r_0 o_0 + ... + r_(n-1) o_(n-1) + r_n o_'domain' + * with orthogonal vectors must be computed with following + * formula: + * r_i := r_i + + * \sum (k = i + 1, ... , n) { r_k <v_k, o_i> + * / ||o_i||^2 } + */ + for (l = 0; (unsigned) l <= n; l++) + { + /* + * compute <v_n, o_n> + */ + real_t a; + + a = get_ip_state_state (domain_blocks [v [l]], + domain_blocks [domain], + range->level, c); + for (k = 0; k < n; k++) + a -= ip_domain_ortho_vector [v [l]][k] + / norm_ortho_vector [k] + * ip_domain_ortho_vector [domain][k]; + ip_domain_ortho_vector [v [l]][n] = a; + } + norm_ortho_vector [n] = rem_denominator [domain]; + ip_image_ortho_vector [n] = rem_numerator [domain]; + + for (k = 0; k <= n; k++) + for (l = k + 1; (unsigned) l <= n; l++) + r [k] += ip_domain_ortho_vector [v [l]][k] * r [l] + / norm_ortho_vector [k]; + /* + * Compute approximation error: + * error := ||b||^2 + + * \sum (k = 0, ... , n){r_k^2 ||o_k||^2 - 2 r_k <b, o_k>} + */ + m_err = norm; + for (k = 0; k <= n; k++) + m_err += square (r [k]) * norm_ortho_vector [k] + - 2 * r [k] * ip_image_ortho_vector [k]; + if (m_err < 0) /* TODO: return MAXCOSTS */ + warning ("Negative image norm: %f" + " (current domain: %d, level = %d)", + (double) m_err, domain, range->level); + + costs = (m_bits + w_bits + additional_bits) * price + m_err; + if (costs < min_costs) /* found a better approximation */ + { + index = domain; + min_costs = costs; + min_matrix_bits = m_bits; + min_weights_bits = w_bits; + min_error = m_err; + for (k = 0; k <= n; k++) + min_weight [k] = f [k]; + } + } + } - if (index >= 0) /* found a better approximation */ - { - if (min_costs < mp->costs) - { - unsigned k; - - mp->costs = min_costs; - mp->err = min_error; - mp->matrix_bits = min_matrix_bits; - mp->weights_bits = min_weights_bits; - - for (k = 0; k <= n; k++) - mp->weight [k] = min_weight [k]; - - best_n = n + 1; - } - - mp->indices [n] = index; - mp->into [n] = domain_blocks [index]; - - used [index] = YES; - - /* - * Gram-Schmidt orthogonalization step n - */ - orthogonalize (index, n, range->level, min_norm, domain_blocks, c); - n++; - } - } - while (n < max_edges && index >= 0); - - mp->indices [best_n] = NO_EDGE; + if (index >= 0) /* found a better approximation */ + { + if (min_costs < mp->costs) + { + unsigned k; + + mp->costs = min_costs; + mp->err = min_error; + mp->matrix_bits = min_matrix_bits; + mp->weights_bits = min_weights_bits; + + for (k = 0; k <= n; k++) + mp->weight [k] = min_weight [k]; + + best_n = n + 1; + } + + mp->indices [n] = index; + mp->into [n] = domain_blocks [index]; + + used [index] = YES; + + /* + * Gram-Schmidt orthogonalization step n + */ + orthogonalize (index, n, range->level, min_norm, domain_blocks, c); + n++; + } + } + while (n < max_edges && index >= 0); + + mp->indices [best_n] = NO_EDGE; - mp->costs = (mp->matrix_bits + mp->weights_bits + additional_bits) * price - + mp->err; + mp->costs = (mp->matrix_bits + mp->weights_bits + additional_bits) * price + + mp->err; - Free (domain_blocks); + Free (domain_blocks); } static void orthogonalize (unsigned index, unsigned n, unsigned level, real_t min_norm, - const word_t *domain_blocks, const coding_t *c) + const word_t *domain_blocks, const coding_t *c) /* * Step 'n' of the Gram-Schmidt orthogonalization procedure: * vector 'index' is orthogonalized with respect to the set @@ -655,8 +640,8 @@ orthogonalize (unsigned index, unsigned n, unsigned level, real_t min_norm, * No return value. * * Side effects: - * The remainder values (numerator and denominator) of - * all 'domain_blocks' are updated. + * The remainder values (numerator and denominator) of + * all 'domain_blocks' are updated. */ { unsigned domain; @@ -676,25 +661,25 @@ orthogonalize (unsigned index, unsigned n, unsigned level, real_t min_norm, for (domain = 0; domain_blocks [domain] >= 0; domain++) if (!used [domain]) { - unsigned k; - real_t tmp = get_ip_state_state (domain_blocks [index], - domain_blocks [domain], level, c); - - for (k = 0; k < n; k++) - tmp -= ip_domain_ortho_vector [domain][k] / norm_ortho_vector [k] - * ip_domain_ortho_vector [index][k]; - ip_domain_ortho_vector [domain][n] = tmp; - rem_denominator [domain] -= square (tmp) / norm_ortho_vector [n]; - rem_numerator [domain] -= ip_image_ortho_vector [n] - / norm_ortho_vector [n] - * ip_domain_ortho_vector [domain][n] ; - - /* - * Exclude vectors with small denominator - */ - if (!used [domain]) - if (rem_denominator [domain] / size_of_level (level) < min_norm) - used [domain] = YES; + unsigned k; + real_t tmp = get_ip_state_state (domain_blocks [index], + domain_blocks [domain], level, c); + + for (k = 0; k < n; k++) + tmp -= ip_domain_ortho_vector [domain][k] / norm_ortho_vector [k] + * ip_domain_ortho_vector [index][k]; + ip_domain_ortho_vector [domain][n] = tmp; + rem_denominator [domain] -= square (tmp) / norm_ortho_vector [n]; + rem_numerator [domain] -= ip_image_ortho_vector [n] + / norm_ortho_vector [n] + * ip_domain_ortho_vector [domain][n] ; + + /* + * Exclude vectors with small denominator + */ + if (!used [domain]) + if (rem_denominator [domain] / size_of_level (level) < min_norm) + used [domain] = YES; } } diff --git a/converter/other/fiasco/codec/approx.h b/converter/other/fiasco/codec/approx.h index c54b78c9..42f1458a 100644 --- a/converter/other/fiasco/codec/approx.h +++ b/converter/other/fiasco/codec/approx.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/bintree.c b/converter/other/fiasco/codec/bintree.c index ddd74e15..b050ab63 100644 --- a/converter/other/fiasco/codec/bintree.c +++ b/converter/other/fiasco/codec/bintree.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/bintree.h b/converter/other/fiasco/codec/bintree.h index cdb80c94..3dc88ac1 100644 --- a/converter/other/fiasco/codec/bintree.h +++ b/converter/other/fiasco/codec/bintree.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/coder.c b/converter/other/fiasco/codec/coder.c index 94e367dd..1e21994d 100644 --- a/converter/other/fiasco/codec/coder.c +++ b/converter/other/fiasco/codec/coder.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* @@ -14,6 +14,7 @@ * $State: Exp $ */ +#define _DEFAULT_SOURCE 1 /* New name for SVID & BSD source defines */ #define _BSD_SOURCE 1 /* Make sure strdup() is in string.h */ #define _XOPEN_SOURCE 500 /* Make sure strdup() is in string.h */ diff --git a/converter/other/fiasco/codec/coder.h b/converter/other/fiasco/codec/coder.h index c6f4bb7c..2fe81d81 100644 --- a/converter/other/fiasco/codec/coder.h +++ b/converter/other/fiasco/codec/coder.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/coeff.c b/converter/other/fiasco/codec/coeff.c index 0cd64f17..6d33bad5 100644 --- a/converter/other/fiasco/codec/coeff.c +++ b/converter/other/fiasco/codec/coeff.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/coeff.h b/converter/other/fiasco/codec/coeff.h index 118cd0fc..6193e2ee 100644 --- a/converter/other/fiasco/codec/coeff.h +++ b/converter/other/fiasco/codec/coeff.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/control.c b/converter/other/fiasco/codec/control.c index 94c23c83..2ea06052 100644 --- a/converter/other/fiasco/codec/control.c +++ b/converter/other/fiasco/codec/control.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/control.h b/converter/other/fiasco/codec/control.h index f601d8b8..6c0834a1 100644 --- a/converter/other/fiasco/codec/control.h +++ b/converter/other/fiasco/codec/control.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/cwfa.h b/converter/other/fiasco/codec/cwfa.h index 9c4e7fee..dd86fbfc 100644 --- a/converter/other/fiasco/codec/cwfa.h +++ b/converter/other/fiasco/codec/cwfa.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/decoder.c b/converter/other/fiasco/codec/decoder.c index 26284596..229996b6 100644 --- a/converter/other/fiasco/codec/decoder.c +++ b/converter/other/fiasco/codec/decoder.c @@ -3,11 +3,11 @@ * * Written by: Ullrich Hafner * Michael Unger - * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ - + /* * $Date: 2000/10/22 10:44:48 $ * $Author: hafner $ @@ -37,7 +37,7 @@ /***************************************************************************** prototypes - + *****************************************************************************/ static void @@ -63,7 +63,7 @@ duplicate_state_image (const word_t *domain, unsigned offset, unsigned level); /***************************************************************************** public code - + *****************************************************************************/ video_t * @@ -78,7 +78,7 @@ alloc_video (bool_t store_wfa) */ { video_t *video = Calloc (1, sizeof (video_t)); - + video->future_display = -1; video->display = 0; @@ -138,13 +138,13 @@ get_next_frame (bool_t store_wfa, int enlarge_factor, * Get next frame of the WFA 'video' from stream 'input'. * 'orig_wfa' is the constant part of the WFA used by all frames. * Depending on values of 'enlarge_factor' and 'smoothing' enlarge and - * smooth image, respectively. + * smooth image, respectively. * If 'store_wfa' is TRUE, then store WFA structure of reference frames * (used by analysis tool xwfa). * If 'reference_frame' is not NULL, then load image 'reference_frame' * from disk. * 'format' gives the color format to be used (either 4:2:0 or 4:4:4). - * If 'timer' is not NULL, then accumulate running time statistics. + * If 'timer' is not NULL, then accumulate running time statistics. * * Return value: * pointer to decoded frame @@ -157,7 +157,7 @@ get_next_frame (bool_t store_wfa, int enlarge_factor, image_t *sframe = NULL; /* current smoothed frame */ bool_t current_frame_is_future_frame = NO; - if (video->future_display == video->display) + if (video->future_display == video->display) { /* * Future frame is already computed since it has been used @@ -189,7 +189,7 @@ get_next_frame (bool_t store_wfa, int enlarge_factor, clock_t ptimer; unsigned int stop_timer [3]; wfa_t *tmp_wfa = NULL; - + if (!store_wfa) video->wfa = orig_wfa; else @@ -198,7 +198,7 @@ get_next_frame (bool_t store_wfa, int enlarge_factor, copy_wfa (tmp_wfa, video->wfa); copy_wfa (video->wfa, orig_wfa); } - + /* * First step: read WFA from disk */ @@ -210,7 +210,7 @@ get_next_frame (bool_t store_wfa, int enlarge_factor, timer->input [video->wfa->frame_type] += stop_timer [0]; timer->frames [video->wfa->frame_type]++; } - + /* * Read reference frame from disk if required * (i.e., 1st frame is of type B or P) @@ -225,7 +225,7 @@ get_next_frame (bool_t store_wfa, int enlarge_factor, video->frame = read_image_file (reference_frame); video->sframe = NULL; } - + /* * Depending on current frame type update past and future frames */ @@ -313,7 +313,7 @@ get_next_frame (bool_t store_wfa, int enlarge_factor, } if (tmp_wfa) free_wfa (tmp_wfa); - + current_frame_is_future_frame = NO; /* * Second step: decode image @@ -323,7 +323,7 @@ get_next_frame (bool_t store_wfa, int enlarge_factor, unsigned orig_width, orig_height; stop_timer [0] = stop_timer [1] = stop_timer [2] = 0; - + enlarge_image (enlarge_factor, format, (video->wfa->wfainfo->color && format == FORMAT_4_2_0) @@ -332,10 +332,10 @@ get_next_frame (bool_t store_wfa, int enlarge_factor, if (enlarge_factor > 0) { orig_width = video->wfa->wfainfo->width << enlarge_factor; - orig_height = video->wfa->wfainfo->height << enlarge_factor; + orig_height = video->wfa->wfainfo->height << enlarge_factor; } else - { + { orig_width = video->wfa->wfainfo->width >> - enlarge_factor; orig_height = video->wfa->wfainfo->height >> - enlarge_factor; if (orig_width & 1) @@ -343,7 +343,7 @@ get_next_frame (bool_t store_wfa, int enlarge_factor, if (orig_height & 1) orig_height++; } - + frame = decode_image (orig_width, orig_height, format, timer != NULL ? stop_timer : NULL, video->wfa); @@ -381,7 +381,7 @@ get_next_frame (bool_t store_wfa, int enlarge_factor, } else sframe = NULL; - + stop_timer [0] = prg_timer (&ptimer, STOP); if (timer) timer->smooth [video->wfa->frame_type] += stop_timer [0]; @@ -399,7 +399,7 @@ get_next_frame (bool_t store_wfa, int enlarge_factor, video->future_display = frame_number; current_frame_is_future_frame = YES; } - + if (!store_wfa) remove_states (video->wfa->basis_states, video->wfa); } while (!video->frame); @@ -407,7 +407,7 @@ get_next_frame (bool_t store_wfa, int enlarge_factor, if (!store_wfa) video->wfa = NULL; } - + return video->sframe ? video->sframe : video->frame; } @@ -418,8 +418,8 @@ decode_image (unsigned orig_width, unsigned orig_height, format_e format, * Compute image which is represented by the given 'wfa'. * 'orig_width'x'orig_height' gives the resolution of the image at * coding time. Use 4:2:0 subsampling or 4:4:4 'format' for color images. - * If 'dec_timer' is given, accumulate running time statistics. - * + * If 'dec_timer' is given, accumulate running time statistics. + * * Return value: * pointer to decoded image * @@ -458,7 +458,7 @@ decode_image (unsigned orig_width, unsigned orig_height, format_e format, for (max_level = 0, state = wfa->basis_states; state < wfa->states; state++) if (isedge (wfa->into [state][0][0]) || isedge (wfa->into [state][1][0])) max_level = MAX(max_level, wfa->level_of_state [state]); - + /* * Allocate frame buffer for decoded image @@ -468,7 +468,7 @@ decode_image (unsigned orig_width, unsigned orig_height, format_e format, width = MAX(width, orig_width); height = MAX(height, orig_height); frame = alloc_image (width, height, wfa->wfainfo->color, format); - + /* * Allocate buffers for intermediate state images */ @@ -478,7 +478,7 @@ decode_image (unsigned orig_width, unsigned orig_height, format_e format, wfa->level_of_state [wfa->tree[wfa->root_state][0]] = 128; wfa->level_of_state [wfa->tree[wfa->root_state][1]] = 128; } - alloc_state_images (&images, &offsets, frame, root_state, 0, max_level, + alloc_state_images (&images, &offsets, frame, root_state, 0, max_level, format, wfa); if (dec_timer) @@ -498,20 +498,20 @@ decode_image (unsigned orig_width, unsigned orig_height, format_e format, prg_timer (&ptimer, START); free_state_images (max_level, frame->color, images, offsets, root_state, 0, format, wfa); - + /* * Crop decoded image if the image size differs. */ if (orig_width != width || orig_height != height) { - frame->height = orig_height; - frame->width = orig_width; - if (orig_width != width) + frame->height = orig_height; + frame->width = orig_width; + if (orig_width != width) { color_e band; /* current color band */ word_t *src, *dst; /* source and destination pointers */ unsigned y; /* current row */ - + for (band = first_band (frame->color); band <= last_band (frame->color); band++) { @@ -546,7 +546,7 @@ decode_state (unsigned state, unsigned level, wfa_t *wfa) * pointer to decoded state image * * Side effects: - * 'wfa' states > 'state' are removed. + * 'wfa' states > 'state' are removed. */ { word_t *domains [2]; @@ -571,7 +571,7 @@ decode_state (unsigned state, unsigned level, wfa_t *wfa) { word_t *src, *dst; unsigned y; - + src = domains [0]; dst = img->pixels [GRAY]; for (y = img->height; y; y--) @@ -603,75 +603,73 @@ decode_range (unsigned range_state, unsigned range_label, unsigned range_level, * 'wfa->level_of_state []' is changed */ { - unsigned root_state [3]; /* dummy (for alloc_state_images) */ - image_t *state_image; /* regenerated state image */ - word_t **images; /* pointer to array of pointers - to state images */ - u_word_t *offsets; /* pointer to array of state image - offsets */ - word_t *range; - - enlarge_image (range_level - (wfa->level_of_state [range_state] - 1), - FORMAT_4_4_4, -1, wfa); - root_state [0] = range_state; - state_image = alloc_image (width_of_level (range_level + 1), - height_of_level (range_level + 1), - NO, FORMAT_4_4_4); - alloc_state_images (&images, &offsets, state_image, NULL, range_state, - range_level + 1, NO, wfa); - compute_state_images (range_level + 1, images, offsets, wfa); - - range = Calloc (size_of_level (range_level), sizeof (word_t)); - - if ((range_level & 1) == 0) /* square image */ - { - memcpy (range, - images [range_state + (range_level + 1) * wfa->states] - + range_label * size_of_level (range_level), - size_of_level (range_level) * sizeof (word_t)); - } - else /* rectangle */ - { - word_t *src, *dst; - unsigned y; - - src = images [range_state + (range_level + 1) * wfa->states] - + range_label * width_of_level (range_level); - dst = range; - for (y = height_of_level (range_level); y; y--) - { - memcpy (dst, src, width_of_level (range_level) * sizeof (word_t)); - dst += width_of_level (range_level); - src += width_of_level (range_level + 1); - } - } - - if (domain != NULL) /* copy domain images */ - { - int s; /* domain state */ - unsigned edge; /* counter */ - - if (ischild (s = wfa->tree [range_state][range_label])) - *domain++ = duplicate_state_image (images [s + (range_level) - * wfa->states], - offsets [s + (range_level) - * wfa->states], - range_level); - for (edge = 0; isedge (s = wfa->into[range_state][range_label][edge]); - edge++) - *domain++ = duplicate_state_image (images [s + (range_level) - * wfa->states], - offsets [s + (range_level) - * wfa->states], - range_level); - *domain = NULL; - } - - free_state_images (range_level + 1, NO, images, offsets, NULL, range_state, - NO, wfa); - free_image (state_image); - - return range; + image_t *state_image; /* regenerated state image */ + word_t **images; /* pointer to array of pointers + to state images */ + u_word_t *offsets; /* pointer to array of state image + offsets */ + word_t *range; + + enlarge_image (range_level - (wfa->level_of_state [range_state] - 1), + FORMAT_4_4_4, -1, wfa); + state_image = alloc_image (width_of_level (range_level + 1), + height_of_level (range_level + 1), + NO, FORMAT_4_4_4); + alloc_state_images (&images, &offsets, state_image, NULL, range_state, + range_level + 1, FORMAT_4_4_4, wfa); + compute_state_images (range_level + 1, images, offsets, wfa); + + range = Calloc (size_of_level (range_level), sizeof (word_t)); + + if ((range_level & 1) == 0) /* square image */ + { + memcpy (range, + images [range_state + (range_level + 1) * wfa->states] + + range_label * size_of_level (range_level), + size_of_level (range_level) * sizeof (word_t)); + } + else /* rectangle */ + { + word_t *src, *dst; + unsigned y; + + src = images [range_state + (range_level + 1) * wfa->states] + + range_label * width_of_level (range_level); + dst = range; + for (y = height_of_level (range_level); y; y--) + { + memcpy (dst, src, width_of_level (range_level) * sizeof (word_t)); + dst += width_of_level (range_level); + src += width_of_level (range_level + 1); + } + } + + if (domain != NULL) /* copy domain images */ + { + int s; /* domain state */ + unsigned edge; /* counter */ + + if (ischild (s = wfa->tree [range_state][range_label])) + *domain++ = duplicate_state_image (images [s + (range_level) + * wfa->states], + offsets [s + (range_level) + * wfa->states], + range_level); + for (edge = 0; isedge (s = wfa->into[range_state][range_label][edge]); + edge++) + *domain++ = duplicate_state_image (images [s + (range_level) + * wfa->states], + offsets [s + (range_level) + * wfa->states], + range_level); + *domain = NULL; + } + + free_state_images (range_level + 1, NO, images, offsets, NULL, range_state, + FORMAT_4_4_4, wfa); + free_image (state_image); + + return range; } void @@ -687,7 +685,7 @@ smooth_image (unsigned sf, const wfa_t *wfa, image_t *image) */ { int is, inegs; /* integer factors of s and 1 - s*/ - unsigned state; + unsigned state; unsigned img_width = image->width; unsigned img_height = image->height; real_t s = 1.0 - sf / 200.0; @@ -697,7 +695,7 @@ smooth_image (unsigned sf, const wfa_t *wfa, image_t *image) is = s * 512 + .5; /* integer representation of s */ inegs = (1 - s) * 512 + .5; /* integer representation of 1 - s */ - + for (state = wfa->basis_states; state < (wfa->wfainfo->color ? wfa->tree [wfa->root_state][0] @@ -708,10 +706,10 @@ smooth_image (unsigned sf, const wfa_t *wfa, image_t *image) unsigned level = wfa->level_of_state[state]; /* level of state image */ unsigned width = width_of_level (level); /* size of state image */ unsigned height = height_of_level (level); /* size of state image */ - + if (wfa->y [state][1] >= img_height || wfa->x [state][1] >= img_width) continue; /* outside visible area */ - + if (level % 2) /* horizontal smoothing */ { unsigned i; /* line counter */ @@ -721,12 +719,12 @@ smooth_image (unsigned sf, const wfa_t *wfa, image_t *image) img1 = bptr + (wfa->y [state][1] - 1) * img_width + wfa->x [state][1]; img2 = bptr + wfa->y [state][1] * img_width + wfa->x [state][1]; - + for (i = MIN(width, img_width - wfa->x [state][1]); i; i--, img1++, img2++) { int tmp = *img1; - + #ifdef HAVE_SIGNED_SHIFT *img1 = (((is * tmp) >> 10) << 1) + (((inegs * (int) *img2) >> 10) << 1); @@ -748,12 +746,12 @@ smooth_image (unsigned sf, const wfa_t *wfa, image_t *image) img1 = bptr + wfa->y [state][1] * img_width + wfa->x [state][1] - 1; img2 = bptr + wfa->y [state][1] * img_width + wfa->x [state][1]; - + for (i = MIN(height, img_height - wfa->y [state][1]); i; i--, img1 += img_width, img2 += img_width) { int tmp = *img1; - + #ifdef HAVE_SIGNED_SHIFT *img1 = (((is * tmp) >> 10) << 1) + (((inegs * (int) *img2) >> 10) << 1); @@ -773,7 +771,7 @@ smooth_image (unsigned sf, const wfa_t *wfa, image_t *image) /***************************************************************************** private code - + *****************************************************************************/ static void @@ -791,7 +789,7 @@ enlarge_image (int enlarge_factor, format_e format, unsigned y_root, * are modified. */ { - + if (enlarge_factor != 0 || format == FORMAT_4_2_0) { unsigned state; @@ -803,11 +801,11 @@ enlarge_image (int enlarge_factor, format_e format, unsigned y_root, } else state = wfa->basis_states; - + for (; state < wfa->states; state++) { unsigned label, n; - + wfa->level_of_state [state] = MAX(wfa->level_of_state [state] + enlarge_factor * 2, 0); @@ -857,12 +855,12 @@ compute_actual_size (unsigned luminance_root, { unsigned x = 0, y = 0; /* maximum coordinates */ unsigned state; /* counter */ - + for (state = wfa->basis_states; state < wfa->states; state++) if (isedge (wfa->into [state][0][0]) || isedge (wfa->into [state][1][0])) { unsigned mult = state > luminance_root ? 2 : 1; - + x = MAX((wfa->x [state][0] + width_of_level (wfa->level_of_state [state])) * mult, x); y = MAX((wfa->y [state][0] @@ -888,7 +886,7 @@ alloc_state_images (word_t ***images, u_word_t **offsets, const image_t *frame, * 'max_level' fives the max. level of a linear combination. * Memory is allocated for every required state image. * Use 4:2:0 subsampling or 4:4:4 'format' for color images. - * If 'range_state' > 0 then rather compute image of 'range_state' than + * If 'range_state' > 0 then rather compute image of 'range_state' than * image of 'wfa->root_state'. * * Return values: @@ -902,7 +900,7 @@ alloc_state_images (word_t ***images, u_word_t **offsets, const image_t *frame, word_t **simg; /* ptr to list of state image ptr's */ u_word_t *offs; /* ptr to list of offsets */ unsigned level; /* counter */ - + simg = Calloc (wfa->states * (max_level + 1), sizeof (word_t *)); offs = Calloc (wfa->states * (max_level + 1), sizeof (u_word_t)); @@ -940,7 +938,7 @@ alloc_state_images (word_t ***images, u_word_t **offsets, const image_t *frame, } } } - + /* * Generate list of state images which must be computed at each level */ @@ -948,9 +946,9 @@ alloc_state_images (word_t ***images, u_word_t **offsets, const image_t *frame, { int child, domain; unsigned state, label, edge; - + /* - * Range approximation with child. + * Range approximation with child. */ for (state = 1; state < (range_state > 0 ? range_state + 1 : wfa->states); state++) @@ -992,7 +990,7 @@ alloc_state_images (word_t ***images, u_word_t **offsets, const image_t *frame, } } /* - * Range approximation with linear combination + * Range approximation with linear combination */ for (state = 1; state < (range_state > 0 ? range_state + 1 : wfa->states); state++) @@ -1010,7 +1008,7 @@ alloc_state_images (word_t ***images, u_word_t **offsets, const image_t *frame, = width_of_level (level - 1); } } - + } *images = simg; @@ -1041,7 +1039,7 @@ free_state_images (unsigned max_level, bool_t color, word_t **state_image, else { unsigned state; - + /* * Initialize state image array with states at 'max_level' */ @@ -1055,19 +1053,19 @@ free_state_images (unsigned max_level, bool_t color, word_t **state_image, level = max_level - 2; else level = max_level; - + for (; state < wfa->states; state++) if (wfa->level_of_state [state] == level) state_image [state + level * wfa->states] = ▮ } } - + for (level = max_level; level > 0; level--) { int domain, child; unsigned state, label, edge; /* - * Range approximation with child. + * Range approximation with child. */ for (state = 1; state < (range_state > 0 ? range_state + 1 : wfa->states); state++) @@ -1082,7 +1080,7 @@ free_state_images (unsigned max_level, bool_t color, word_t **state_image, state_image [child + (level - 1) * wfa->states] = ▮ } /* - * Range approximation with linear combination + * Range approximation with linear combination */ for (state = 1; state < (range_state > 0 ? range_state + 1 : wfa->states); @@ -1091,7 +1089,7 @@ free_state_images (unsigned max_level, bool_t color, word_t **state_image, for (label = 0; label < MAXLABELS; label++) for (edge = 0; isedge (domain = wfa->into[state][label][edge]); edge++) - if (domain > 0 + if (domain > 0 && (state_image [domain + (level - 1) * wfa->states] != NULL) && (state_image [domain + (level - 1) * wfa->states] @@ -1114,7 +1112,7 @@ compute_state_images (unsigned max_level, word_t **simg, * which are marked in the array 'simg' (offsets of state images * are given by 'offset'). * - * Warning: Several optimizations are used in this function making + * Warning: Several optimizations are used in this function making * it difficult to understand. * * No return value. @@ -1125,7 +1123,7 @@ compute_state_images (unsigned max_level, word_t **simg, */ { unsigned level, state; - + /* * Copy one-pixel images in case state_image pointer != &final distr. */ @@ -1140,17 +1138,17 @@ compute_state_images (unsigned max_level, word_t **simg, * 'weight' gives the weight in integer notation * 'src', 'dst', and 'idst' are pointers to the source and * destination pixels (short or integer format), respectively. - * Short format : one operation per register (16 bit mode). - * Integer format : two operations per register (32 bit mode). + * Short format : one operation per register (16 bit mode). + * Integer format : two operations per register (32 bit mode). * 'src_offset', 'dst_offset', and 'dst_offset' give the number of * pixels which have to be omitted when jumping to the next image row. */ - for (level = 1; level <= max_level; level++) + for (level = 1; level <= max_level; level++) { unsigned label; unsigned width = width_of_level (level - 1); unsigned height = height_of_level (level - 1); - + for (state = 1; state < wfa->states; state++) if (simg [state + level * wfa->states] != NULL) for (label = 0; label < MAXLABELS; label++) @@ -1178,7 +1176,7 @@ compute_state_images (unsigned max_level, word_t **simg, } /* - * Generate the state images by adding the corresponding + * Generate the state images by adding the corresponding * weighted state images: * subimage [label] = * weight_1 * image_1 + ... + weight_n * image_n @@ -1228,12 +1226,12 @@ compute_state_images (unsigned max_level, word_t **simg, src_offset = offset [domain + ((level - 1) * wfa->states)] - width; weight = wfa->int_weight [state][label][edge]; - + if (width == 1) /* can't add two-pixels in a row */ { word_t *dst; unsigned dst_offset; - + dst = range; dst_offset = offset [state + level * wfa->states] - width; @@ -1242,7 +1240,7 @@ compute_state_images (unsigned max_level, word_t **simg, #else /* not HAVE_SIGNED_SHIFT */ *dst++ = ((weight * (int) *src++) / 1024) * 2; #endif /* not HAVE_SIGNED_SHIFT */ - if (height == 2) + if (height == 2) { src += src_offset; dst += dst_offset; @@ -1258,14 +1256,14 @@ compute_state_images (unsigned max_level, word_t **simg, unsigned y; int *idst; unsigned idst_offset; - + idst = (int *) range; idst_offset = (offset [state + level * wfa->states] - width) / 2; for (y = height; y; y--) { int *comp_dst = idst + (width >> 1); - + for (; idst != comp_dst; ) { int tmp; /* temp. value of adjacent pixels */ @@ -1314,11 +1312,11 @@ compute_state_images (unsigned max_level, word_t **simg, { word_t *dst; unsigned dst_offset; - + dst = range; dst_offset = offset [state + level * wfa->states] - width; - + *dst++ = weight; if (height == 2) { @@ -1331,7 +1329,7 @@ compute_state_images (unsigned max_level, word_t **simg, unsigned x, y; int *idst; unsigned idst_offset; - + weight = (weight * 65536) | (weight & 0xffff); idst = (int *) range; idst_offset = offset [state + level * wfa->states] @@ -1353,7 +1351,7 @@ compute_state_images (unsigned max_level, word_t **simg, } else edge = 0; - + /* * Add remaining weighted domain images to current range */ @@ -1370,12 +1368,12 @@ compute_state_images (unsigned max_level, word_t **simg, src_offset = offset [domain + ((level - 1) * wfa->states)] - width; weight = wfa->int_weight [state][label][edge]; - + if (width == 1) /* can't add two-pixels in a row */ { word_t *dst; unsigned dst_offset; - + dst = range; dst_offset = offset [state + level * wfa->states] - width; @@ -1385,7 +1383,7 @@ compute_state_images (unsigned max_level, word_t **simg, #else /* not HAVE_SIGNED_SHIFT */ *dst++ += ((weight * (int) *src++) / 1024) * 2; #endif /* not HAVE_SIGNED_SHIFT */ - if (height == 2) + if (height == 2) { src += src_offset; dst += dst_offset; @@ -1401,15 +1399,15 @@ compute_state_images (unsigned max_level, word_t **simg, int *idst; unsigned idst_offset; unsigned y; - + idst = (int *) range; idst_offset = (offset [state + level * wfa->states] - width) / 2; - + for (y = height; y; y--) { int *comp_dst = idst + (width >> 1); - + for (; idst != comp_dst;) { int tmp; /* temp. value of adjacent pixels */ @@ -1459,11 +1457,11 @@ compute_state_images (unsigned max_level, word_t **simg, { word_t *dst; unsigned dst_offset; - + dst = range; dst_offset = offset [state + level * wfa->states] - width; - + *dst++ += weight; if (height == 2) { @@ -1476,16 +1474,16 @@ compute_state_images (unsigned max_level, word_t **simg, int *idst; unsigned idst_offset; unsigned y; - + weight = (weight * 65536) | (weight & 0xffff); idst = (int *) range; idst_offset = (offset [state + level * wfa->states] - width) /2; - + for (y = height; y; y--) { int *comp_dst = idst + (width >> 1); - + for (; idst != comp_dst; ) { *idst = (*idst + weight) & 0xfffefffe; @@ -1496,14 +1494,14 @@ compute_state_images (unsigned max_level, word_t **simg, } } } - } + } } } static word_t * duplicate_state_image (const word_t *domain, unsigned offset, unsigned level) /* - * Allocate new memory block 'pixels' and copy pixel values of 'domain' + * Allocate new memory block 'pixels' and copy pixel values of 'domain' * (size and pixel offset are given by 'level' and 'offset') * to the lock 'pixels'. * diff --git a/converter/other/fiasco/codec/decoder.h b/converter/other/fiasco/codec/decoder.h index 8cd211e0..7823ab91 100644 --- a/converter/other/fiasco/codec/decoder.h +++ b/converter/other/fiasco/codec/decoder.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/dfiasco.c b/converter/other/fiasco/codec/dfiasco.c index 2fdec573..d45c9e39 100644 --- a/converter/other/fiasco/codec/dfiasco.c +++ b/converter/other/fiasco/codec/dfiasco.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/dfiasco.h b/converter/other/fiasco/codec/dfiasco.h index bcc3c7f9..eed12b6b 100644 --- a/converter/other/fiasco/codec/dfiasco.h +++ b/converter/other/fiasco/codec/dfiasco.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/domain-pool.c b/converter/other/fiasco/codec/domain-pool.c index 7cc3900e..1c14a30c 100644 --- a/converter/other/fiasco/codec/domain-pool.c +++ b/converter/other/fiasco/codec/domain-pool.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/domain-pool.h b/converter/other/fiasco/codec/domain-pool.h index d1488779..a2c46141 100644 --- a/converter/other/fiasco/codec/domain-pool.h +++ b/converter/other/fiasco/codec/domain-pool.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/ip.c b/converter/other/fiasco/codec/ip.c index ade0d916..56b0ae9a 100644 --- a/converter/other/fiasco/codec/ip.c +++ b/converter/other/fiasco/codec/ip.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/ip.h b/converter/other/fiasco/codec/ip.h index e5e4dd65..0c693826 100644 --- a/converter/other/fiasco/codec/ip.h +++ b/converter/other/fiasco/codec/ip.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/motion.c b/converter/other/fiasco/codec/motion.c index 876a2998..0d1fa099 100644 --- a/converter/other/fiasco/codec/motion.c +++ b/converter/other/fiasco/codec/motion.c @@ -4,8 +4,8 @@ * Written by: Ullrich Hafner * Michael Unger * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/motion.h b/converter/other/fiasco/codec/motion.h index 2ea382f7..82d1f1ec 100644 --- a/converter/other/fiasco/codec/motion.h +++ b/converter/other/fiasco/codec/motion.h @@ -4,8 +4,8 @@ * Written by: Ullrich Hafner * Michael Unger * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/mwfa.c b/converter/other/fiasco/codec/mwfa.c index 43a7dae2..0be08a4f 100644 --- a/converter/other/fiasco/codec/mwfa.c +++ b/converter/other/fiasco/codec/mwfa.c @@ -4,8 +4,8 @@ * Written by: Michael Unger * Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/mwfa.h b/converter/other/fiasco/codec/mwfa.h index 52f41866..2c1e7c9f 100644 --- a/converter/other/fiasco/codec/mwfa.h +++ b/converter/other/fiasco/codec/mwfa.h @@ -4,8 +4,8 @@ * Written by: Michael Unger * Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/options.c b/converter/other/fiasco/codec/options.c index c8e4d2e2..b9c64efd 100644 --- a/converter/other/fiasco/codec/options.c +++ b/converter/other/fiasco/codec/options.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* @@ -14,6 +14,7 @@ * $State: Exp $ */ +#define _DEFAULT_SOURCE 1 /* New name for SVID & BSD source defines */ #define _BSD_SOURCE 1 /* Make sure strdup() is in string.h */ #define _XOPEN_SOURCE 500 /* Make sure strdup() is in string.h */ diff --git a/converter/other/fiasco/codec/options.h b/converter/other/fiasco/codec/options.h index 3af6be01..783c41ef 100644 --- a/converter/other/fiasco/codec/options.h +++ b/converter/other/fiasco/codec/options.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/prediction.c b/converter/other/fiasco/codec/prediction.c index e056d10f..e78e5acc 100644 --- a/converter/other/fiasco/codec/prediction.c +++ b/converter/other/fiasco/codec/prediction.c @@ -4,8 +4,8 @@ * Written by: Ullrich Hafner * Michael Unger * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/prediction.h b/converter/other/fiasco/codec/prediction.h index 1068501a..0646dfd8 100644 --- a/converter/other/fiasco/codec/prediction.h +++ b/converter/other/fiasco/codec/prediction.h @@ -4,8 +4,8 @@ * Written by: Ullrich Hafner * Michael Unger * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/subdivide.c b/converter/other/fiasco/codec/subdivide.c index 2ace18e4..348f838a 100644 --- a/converter/other/fiasco/codec/subdivide.c +++ b/converter/other/fiasco/codec/subdivide.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/subdivide.h b/converter/other/fiasco/codec/subdivide.h index b6840e58..bd9cd10e 100644 --- a/converter/other/fiasco/codec/subdivide.h +++ b/converter/other/fiasco/codec/subdivide.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/tiling.c b/converter/other/fiasco/codec/tiling.c index 21e4428a..9af43da0 100644 --- a/converter/other/fiasco/codec/tiling.c +++ b/converter/other/fiasco/codec/tiling.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/tiling.h b/converter/other/fiasco/codec/tiling.h index 2eb04fe0..6668ad8b 100644 --- a/converter/other/fiasco/codec/tiling.h +++ b/converter/other/fiasco/codec/tiling.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/wfa.h b/converter/other/fiasco/codec/wfa.h index 9253affd..59020fc1 100644 --- a/converter/other/fiasco/codec/wfa.h +++ b/converter/other/fiasco/codec/wfa.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/codec/wfalib.c b/converter/other/fiasco/codec/wfalib.c index 61d64d2f..90420d6f 100644 --- a/converter/other/fiasco/codec/wfalib.c +++ b/converter/other/fiasco/codec/wfalib.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* @@ -14,6 +14,7 @@ * $State: Exp $ */ +#define _DEFAULT_SOURCE 1 /* New name for SVID & BSD source defines */ #define _BSD_SOURCE 1 /* Make sure strdup() is in string.h */ #define _XOPEN_SOURCE 500 /* Make sure strdup() is in string.h */ diff --git a/converter/other/fiasco/codec/wfalib.h b/converter/other/fiasco/codec/wfalib.h index 4622fcd2..5c1e0907 100644 --- a/converter/other/fiasco/codec/wfalib.h +++ b/converter/other/fiasco/codec/wfalib.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/display.c b/converter/other/fiasco/display.c index cf160329..d8d32fa6 100644 --- a/converter/other/fiasco/display.c +++ b/converter/other/fiasco/display.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner * * Based on mpeg2decode, (C) 1994, MPEG Software Simulation Group * and mpeg2play, (C) 1994 Stefan Eckart diff --git a/converter/other/fiasco/display.h b/converter/other/fiasco/display.h index 5f30b117..8049456a 100644 --- a/converter/other/fiasco/display.h +++ b/converter/other/fiasco/display.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/doc/README.LIB b/converter/other/fiasco/doc/README.LIB index 4bf8c382..ce8a6b2b 100644 --- a/converter/other/fiasco/doc/README.LIB +++ b/converter/other/fiasco/doc/README.LIB @@ -1,5 +1,5 @@ --------------------------------------------------------------------------- - FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) + FIASCO (Fractal Image And Sequence COdec) Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de>, http://ulli.linuxave.net Version 1.0 diff --git a/converter/other/fiasco/doc/fiasco_c_options_new.3 b/converter/other/fiasco/doc/fiasco_c_options_new.3 index 52efb86c..d873b642 100644 --- a/converter/other/fiasco/doc/fiasco_c_options_new.3 +++ b/converter/other/fiasco/doc/fiasco_c_options_new.3 @@ -429,4 +429,4 @@ Finite Automata\fP, Ph.D. thesis, Mensch & Buch Verlag, ISBN 3-89820-002-7, October 1999. .SH AUTHOR -Ullrich Hafner <hafner@bigfoot.de> +Ullrich Hafner diff --git a/converter/other/fiasco/doc/fiasco_coder.3 b/converter/other/fiasco/doc/fiasco_coder.3 index 3d1c6b87..9f2e0f8e 100644 --- a/converter/other/fiasco/doc/fiasco_coder.3 +++ b/converter/other/fiasco/doc/fiasco_coder.3 @@ -103,4 +103,4 @@ Finite Automata\fP, Ph.D. thesis, Mensch & Buch Verlag, ISBN 3-89820-002-7, October 1999. .SH AUTHOR -Ullrich Hafner <hafner@bigfoot.de> +Ullrich Hafner diff --git a/converter/other/fiasco/doc/fiasco_d_options_new.3 b/converter/other/fiasco/doc/fiasco_d_options_new.3 index 4294330a..d7f2181a 100644 --- a/converter/other/fiasco/doc/fiasco_d_options_new.3 +++ b/converter/other/fiasco/doc/fiasco_d_options_new.3 @@ -119,4 +119,4 @@ Finite Automata\fP, Ph.D. thesis, Mensch & Buch Verlag, ISBN 3-89820-002-7, October 1999. .SH AUTHOR -Ullrich Hafner <hafner@bigfoot.de> +Ullrich Hafner diff --git a/converter/other/fiasco/doc/fiasco_decoder_new.3 b/converter/other/fiasco/doc/fiasco_decoder_new.3 index 05e981a9..5d1d0d08 100644 --- a/converter/other/fiasco/doc/fiasco_decoder_new.3 +++ b/converter/other/fiasco/doc/fiasco_decoder_new.3 @@ -191,4 +191,4 @@ Finite Automata\fP, Ph.D. thesis, Mensch & Buch Verlag, ISBN 3-89820-002-7, October 1999. .SH AUTHOR -Ullrich Hafner <hafner@bigfoot.de> +Ullrich Hafner diff --git a/converter/other/fiasco/doc/fiasco_get_error_message.3 b/converter/other/fiasco/doc/fiasco_get_error_message.3 index 09d593fb..ce53e6d9 100644 --- a/converter/other/fiasco/doc/fiasco_get_error_message.3 +++ b/converter/other/fiasco/doc/fiasco_get_error_message.3 @@ -38,4 +38,4 @@ Finite Automata\fP, Ph.D. thesis, Mensch & Buch Verlag, ISBN 3-89820-002-7, October 1999. .SH AUTHOR -Ullrich Hafner <hafner@bigfoot.de> +Ullrich Hafner diff --git a/converter/other/fiasco/doc/fiasco_image_new.3 b/converter/other/fiasco/doc/fiasco_image_new.3 index 10625b63..ac3297bf 100644 --- a/converter/other/fiasco/doc/fiasco_image_new.3 +++ b/converter/other/fiasco/doc/fiasco_image_new.3 @@ -92,4 +92,4 @@ Finite Automata\fP, Ph.D. thesis, Mensch & Buch Verlag, ISBN 3-89820-002-7, October 1999. .SH AUTHOR -Ullrich Hafner <hafner@bigfoot.de> +Ullrich Hafner diff --git a/converter/other/fiasco/doc/fiasco_options_new.3 b/converter/other/fiasco/doc/fiasco_options_new.3 index 26e070ca..f26586a7 100644 --- a/converter/other/fiasco/doc/fiasco_options_new.3 +++ b/converter/other/fiasco/doc/fiasco_options_new.3 @@ -438,4 +438,4 @@ Finite Automata\fP, Ph.D. thesis, Mensch & Buch Verlag, ISBN 3-89820-002-7, October 1999. .SH AUTHOR -Ullrich Hafner <hafner@bigfoot.de> +Ullrich Hafner diff --git a/converter/other/fiasco/doc/fiasco_renderer_new.3 b/converter/other/fiasco/doc/fiasco_renderer_new.3 index b24d8462..8b5e47cd 100644 --- a/converter/other/fiasco/doc/fiasco_renderer_new.3 +++ b/converter/other/fiasco/doc/fiasco_renderer_new.3 @@ -122,4 +122,4 @@ Finite Automata\fP, Ph.D. thesis, Mensch & Buch Verlag, ISBN 3-89820-002-7, October 1999. .SH AUTHOR -Ullrich Hafner <hafner@bigfoot.de> +Ullrich Hafner diff --git a/converter/other/fiasco/doc/fiasco_set_verbosity.3 b/converter/other/fiasco/doc/fiasco_set_verbosity.3 index 746854b1..3e88399a 100644 --- a/converter/other/fiasco/doc/fiasco_set_verbosity.3 +++ b/converter/other/fiasco/doc/fiasco_set_verbosity.3 @@ -43,4 +43,4 @@ Finite Automata\fP, Ph.D. thesis, Mensch & Buch Verlag, ISBN 3-89820-002-7, October 1999. .SH AUTHOR -Ullrich Hafner <hafner@bigfoot.de> +Ullrich Hafner diff --git a/converter/other/fiasco/fiasco.h b/converter/other/fiasco/fiasco.h index 59367bb8..88f999fc 100644 --- a/converter/other/fiasco/fiasco.h +++ b/converter/other/fiasco/fiasco.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/converter/other/fiasco/fiascotopnm.c b/converter/other/fiasco/fiascotopnm.c index dfba2256..e95e27fc 100644 --- a/converter/other/fiasco/fiascotopnm.c +++ b/converter/other/fiasco/fiascotopnm.c @@ -4,8 +4,8 @@ * Written by: Ullrich Hafner * Michael Unger * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* @@ -15,6 +15,7 @@ * $State: Exp $ */ +#define _DEFAULT_SOURCE 1 /* New name for SVID & BSD source defines */ #define _BSD_SOURCE 1 /* Make sure strdup() is in string.h */ #define _XOPEN_SOURCE 500 /* Make sure strdup() is in string.h */ @@ -361,6 +362,8 @@ video_decoder (const char *wfa_name, const char *image_name, bool_t panel, while (prg_timer (&fps_timer, STOP) < frame_time) /* wait */ ; } +#else + if (frame_time) {/* defeat compiler warning */} #endif /* not X_DISPLAY_MISSING */ } free (filename); diff --git a/converter/other/fiasco/input/basis.c b/converter/other/fiasco/input/basis.c index 4a748f61..aa371ea1 100644 --- a/converter/other/fiasco/input/basis.c +++ b/converter/other/fiasco/input/basis.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/input/basis.h b/converter/other/fiasco/input/basis.h index fa26bca2..e2242198 100644 --- a/converter/other/fiasco/input/basis.h +++ b/converter/other/fiasco/input/basis.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/input/matrices.c b/converter/other/fiasco/input/matrices.c index 47cde1aa..388855ea 100644 --- a/converter/other/fiasco/input/matrices.c +++ b/converter/other/fiasco/input/matrices.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/input/matrices.h b/converter/other/fiasco/input/matrices.h index ba8fd9bf..6d1cef15 100644 --- a/converter/other/fiasco/input/matrices.h +++ b/converter/other/fiasco/input/matrices.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/input/mc.c b/converter/other/fiasco/input/mc.c index 070d839e..2d4a073d 100644 --- a/converter/other/fiasco/input/mc.c +++ b/converter/other/fiasco/input/mc.c @@ -4,8 +4,8 @@ * written by: Michael Unger * Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/input/mc.h b/converter/other/fiasco/input/mc.h index 1e14d287..9d9d714d 100644 --- a/converter/other/fiasco/input/mc.h +++ b/converter/other/fiasco/input/mc.h @@ -4,8 +4,8 @@ * written by: Michael Unger * Ullrich Hafner - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/input/nd.c b/converter/other/fiasco/input/nd.c index 1a68bfbf..52d48e61 100644 --- a/converter/other/fiasco/input/nd.c +++ b/converter/other/fiasco/input/nd.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/input/nd.h b/converter/other/fiasco/input/nd.h index 2c2fff4b..0fe06cf1 100644 --- a/converter/other/fiasco/input/nd.h +++ b/converter/other/fiasco/input/nd.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/input/read.c b/converter/other/fiasco/input/read.c index e6e2d7e8..9f4ac993 100644 --- a/converter/other/fiasco/input/read.c +++ b/converter/other/fiasco/input/read.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* @@ -14,6 +14,7 @@ * $State: Exp $ */ +#define _DEFAULT_SOURCE 1 /* New name for SVID & BSD source defines */ #define _BSD_SOURCE 1 /* Make sure strdup() is in string.h */ #define _XOPEN_SOURCE 500 /* Make sure strdup() is in string.h */ diff --git a/converter/other/fiasco/input/read.h b/converter/other/fiasco/input/read.h index d0d0ee13..1f59f103 100644 --- a/converter/other/fiasco/input/read.h +++ b/converter/other/fiasco/input/read.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/input/tree.c b/converter/other/fiasco/input/tree.c index e3e7117e..0ac2b6ae 100644 --- a/converter/other/fiasco/input/tree.c +++ b/converter/other/fiasco/input/tree.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/input/tree.h b/converter/other/fiasco/input/tree.h index e4b5f2d8..f743ee98 100644 --- a/converter/other/fiasco/input/tree.h +++ b/converter/other/fiasco/input/tree.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/input/weights.c b/converter/other/fiasco/input/weights.c index 15c35731..8a1e8899 100644 --- a/converter/other/fiasco/input/weights.c +++ b/converter/other/fiasco/input/weights.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/input/weights.h b/converter/other/fiasco/input/weights.h index 1e2285a9..36cea5c2 100644 --- a/converter/other/fiasco/input/weights.h +++ b/converter/other/fiasco/input/weights.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/lib/arith.c b/converter/other/fiasco/lib/arith.c index dc35d1d1..825d4757 100644 --- a/converter/other/fiasco/lib/arith.c +++ b/converter/other/fiasco/lib/arith.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/lib/arith.h b/converter/other/fiasco/lib/arith.h index 744eb9d7..04297eb5 100644 --- a/converter/other/fiasco/lib/arith.h +++ b/converter/other/fiasco/lib/arith.h @@ -1,8 +1,8 @@ /* * arith.h * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/lib/bit-io.c b/converter/other/fiasco/lib/bit-io.c index 1bfef598..f69343e6 100644 --- a/converter/other/fiasco/lib/bit-io.c +++ b/converter/other/fiasco/lib/bit-io.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* @@ -14,6 +14,7 @@ * $State: Exp $ */ +#define _DEFAULT_SOURCE 1 /* New name for SVID & BSD source defines */ #define _BSD_SOURCE 1 /* Make sure strdup() is in string.h */ #define _XOPEN_SOURCE 500 /* Make sure strdup() is in string.h */ diff --git a/converter/other/fiasco/lib/bit-io.h b/converter/other/fiasco/lib/bit-io.h index d37cc47c..08029824 100644 --- a/converter/other/fiasco/lib/bit-io.h +++ b/converter/other/fiasco/lib/bit-io.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/lib/dither.c b/converter/other/fiasco/lib/dither.c index accd9dd6..669bb16c 100644 --- a/converter/other/fiasco/lib/dither.c +++ b/converter/other/fiasco/lib/dither.c @@ -3,8 +3,8 @@ * * Adapted by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* @@ -713,15 +713,11 @@ display_24_bit_bgr (const struct fiasco_renderer *this, unsigned char *ximage, word_t *cbptr, *crptr; /* pointer to chroma bands */ word_t *yptr; /* pointers to lumincance band */ int *Cr_r_tab, *Cr_g_tab, *Cb_g_tab, *Cb_b_tab; - unsigned int *r_table, *g_table, *b_table; Cr_g_tab = private->Cr_g_tab; Cr_r_tab = private->Cr_r_tab; Cb_b_tab = private->Cb_b_tab; Cb_g_tab = private->Cb_g_tab; - r_table = private->r_table; - g_table = private->g_table; - b_table = private->b_table; yptr = image->pixels [Y]; cbptr = image->pixels [Cb]; crptr = image->pixels [Cr]; @@ -1044,9 +1040,7 @@ display_24_bit_bgr (const struct fiasco_renderer *this, unsigned char *ximage, { unsigned int *dst; /* pointer to dithered pixels */ word_t *src; /* current pixel of frame */ - unsigned int *y_table; - y_table = private->y_table; dst = (unsigned int *) out; src = image->pixels [GRAY]; @@ -1164,15 +1158,11 @@ display_24_bit_rgb (const struct fiasco_renderer *this, unsigned char *ximage, word_t *cbptr, *crptr; /* pointer to chroma bands */ word_t *yptr; /* pointers to lumincance band */ int *Cr_r_tab, *Cr_g_tab, *Cb_g_tab, *Cb_b_tab; - unsigned int *r_table, *g_table, *b_table; Cr_g_tab = private->Cr_g_tab; Cr_r_tab = private->Cr_r_tab; Cb_b_tab = private->Cb_b_tab; Cb_g_tab = private->Cb_g_tab; - r_table = private->r_table; - g_table = private->g_table; - b_table = private->b_table; yptr = image->pixels [Y]; cbptr = image->pixels [Cb]; crptr = image->pixels [Cr]; @@ -1495,9 +1485,7 @@ display_24_bit_rgb (const struct fiasco_renderer *this, unsigned char *ximage, { unsigned int *dst; /* pointer to dithered pixels */ word_t *src; /* current pixel of frame */ - unsigned int *y_table; - y_table = private->y_table; dst = (unsigned int *) out; src = image->pixels [GRAY]; diff --git a/converter/other/fiasco/lib/dither.h b/converter/other/fiasco/lib/dither.h index 71f9d3c3..767bca28 100644 --- a/converter/other/fiasco/lib/dither.h +++ b/converter/other/fiasco/lib/dither.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/lib/error.c b/converter/other/fiasco/lib/error.c index ee3afe1f..394f896f 100644 --- a/converter/other/fiasco/lib/error.c +++ b/converter/other/fiasco/lib/error.c @@ -3,29 +3,19 @@ * * Written by: Stefan Frank * Ullrich Hafner - * + * * Credits: Modelled after variable argument routines from Jef - * Poskanzer's pbmplus package. + * Poskanzer's pbmplus package. * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> - - "int dummy = " change to int dummy; dummy =" for Netpbm to avoid - unused variable warning. - - */ - -/* - * $Date: 2000/06/14 20:49:37 $ - * $Author: hafner $ - * $Revision: 5.1 $ - * $State: Exp $ + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ #define _ERROR_C #include "config.h" +#include <stdbool.h> #include <stdio.h> #include <errno.h> @@ -47,7 +37,7 @@ /***************************************************************************** local variables - + *****************************************************************************/ static fiasco_verbosity_e verboselevel = FIASCO_SOME_VERBOSITY; @@ -60,234 +50,237 @@ jmp_buf env; /***************************************************************************** public code - + *****************************************************************************/ void -set_error (const char *format, ...) -/* - * Set error text to given string. - */ -{ - va_list args; - unsigned len = 0; - const char *str = format; - - VA_START (args, format); - - len = strlen (format); - while ((str = strchr (str, '%'))) - { - str++; - if (*str == 's') - { - char *vstring = va_arg (args, char *); - len += strlen (vstring); - } - else if (*str == 'd') - { - int dummy; - dummy = va_arg (args, int); - len += 10; - } - else if (*str == 'c') - { - int dummy; - dummy = va_arg (args, int); - len += 1; - } - else - return; - str++; - } - va_end(args); - - VA_START (args, format); - - if (error_message) - Free (error_message); - error_message = Calloc (len, sizeof (char)); - - vsprintf (error_message, format, args); - - va_end (args); +set_error(const char * const format, ...) { +/*---------------------------------------------------------------------------- + Set error text to given string. +-----------------------------------------------------------------------------*/ + va_list args; + unsigned len; + bool error; + const char * str; + + VA_START (args, format); + + /* Compute how long the error text will be: 'len' */ + + for (len = strlen(format), str = &format[0], error = false; + *str && !error; ) { + + str = strchr(str, '%'); + + if (*str) { + ++str; /* Move past % */ + if (*str == 's') { + char * const vstring = va_arg (args, char *); + len += strlen(vstring); + } else if (*str == 'd') { + (void)va_arg(args, int); + len += 10; + } else if (*str == 'c') { + (void)va_arg(args, int); + len += 1; + } else + error = true; + if (!error) + ++str; + } + } + va_end(args); + + if (!error) { + VA_START(args, format); + + if (error_message) + Free(error_message); + error_message = Calloc(len, sizeof (char)); + + vsprintf(error_message, format, args); + + va_end(args); + } } + + void -error (const char *format, ...) -/* - * Set error text to given string. - */ -{ - va_list args; - unsigned len = 0; - const char *str = format; - - VA_START (args, format); - - len = strlen (format); - while ((str = strchr (str, '%'))) - { - str++; - if (*str == 's') - { - char *vstring = va_arg (args, char *); - len += strlen (vstring); - } - else if (*str == 'd') - { - int dummy; - dummy = va_arg (args, int); - len += 10; - } - else if (*str == 'c') - { - int dummy; - dummy = va_arg (args, int); - len += 1; - } - else - { +error(const char * const format, ...) { +/*---------------------------------------------------------------------------- + Set error text to given string. +-----------------------------------------------------------------------------*/ + va_list args; + unsigned len; + const char * str; + + len = 0; /* initial value */ + str = &format[0]; /* initial value */ + + VA_START (args, format); + + len = strlen (format); + while ((str = strchr (str, '%'))) { + ++str; + if (*str == 's') { + char * const vstring = va_arg (args, char *); + len += strlen(vstring); + } else if (*str == 'd') { + (void)va_arg(args, int); + len += 10; + } else if (*str == 'c') { + (void)va_arg(args, int); + len += 1; + } else { #if HAVE_SETJMP_H - longjmp (env, 1); -#else /* not HAVE_SETJMP_H */ - exit (1); -#endif /* HAVE_SETJMP_H */ - }; - - str++; - } - va_end(args); - - VA_START (args, format); - - if (error_message) - Free (error_message); - error_message = Calloc (len, sizeof (char)); - - vsprintf (error_message, format, args); - - va_end (args); - + longjmp(env, 1); +#else + exit(1); +#endif + }; + + ++str; + } + va_end(args); + + VA_START(args, format); + + if (error_message) + Free(error_message); + error_message = Calloc(len, sizeof (char)); + + vsprintf(error_message, format, args); + + va_end(args); + #if HAVE_SETJMP_H - longjmp (env, 1); -#else /* not HAVE_SETJMP_H */ - exit (1); -#endif /* HAVE_SETJMP_H */ + longjmp(env, 1); +#else + exit(1); +#endif } + + const char * -fiasco_get_error_message (void) -/* - * Return value: - * Last error message of FIASCO library. - */ -{ - return error_message ? error_message : ""; +fiasco_get_error_message(void) { +/*---------------------------------------------------------------------------- + Last error message of FIASCO library. +-----------------------------------------------------------------------------*/ + return error_message ? error_message : ""; } + + const char * -get_system_error (void) -{ - return strerror (errno); +get_system_error(void) { + return strerror(errno); } + + void -file_error (const char *filename) -/* - * Print file error message and exit. - * - * No return value. - */ -{ - error ("File `%s': I/O Error - %s.", filename, get_system_error ()); +file_error(const char * const filename) { +/*---------------------------------------------------------------------------- + Print file error message and exit. +-----------------------------------------------------------------------------*/ + error("File `%s': I/O Error - %s.", filename, get_system_error ()); } -void -warning (const char *format, ...) -/* - * Issue a warning and continue execution. - * - * No return value. - */ -{ - va_list args; - - VA_START (args, format); - if (verboselevel == FIASCO_NO_VERBOSITY) - return; - - fprintf (stderr, "Warning: "); - vfprintf (stderr, format, args); - fputc ('\n', stderr); - va_end (args); +void +warning(const char * const format, ...) { +/*---------------------------------------------------------------------------- + Issue a warning. +-----------------------------------------------------------------------------*/ + va_list args; + + VA_START (args, format); + + if (verboselevel == FIASCO_NO_VERBOSITY) { + /* User doesn't want warnings */ + } else { + fprintf (stderr, "Warning: "); + vfprintf (stderr, format, args); + fputc ('\n', stderr); + } + va_end (args); } -void -message (const char *format, ...) -/* - * Print a message to stderr. - */ -{ - va_list args; - - VA_START (args, format); - if (verboselevel == FIASCO_NO_VERBOSITY) - return; - vfprintf (stderr, format, args); - fputc ('\n', stderr); - va_end (args); +void +message(const char * const format, ...) { +/*---------------------------------------------------------------------------- + Print a message to Standard Error +-----------------------------------------------------------------------------*/ + va_list args; + + VA_START (args, format); + + if (verboselevel == FIASCO_NO_VERBOSITY) { + /* User doesn't want messages */ + } else { + vfprintf (stderr, format, args); + fputc ('\n', stderr); + } + va_end (args); } -void -debug_message (const char *format, ...) -/* - * Print a message to stderr. - */ -{ - va_list args; - VA_START (args, format); - - if (verboselevel < FIASCO_ULTIMATE_VERBOSITY) - return; - - fprintf (stderr, "*** "); - vfprintf (stderr, format, args); - fputc ('\n', stderr); - va_end (args); -} void -info (const char *format, ...) -/* - * Print a message to stderr. Do not append a newline. - */ -{ - va_list args; +debug_message(const char * const format, ...) { +/*---------------------------------------------------------------------------- + Print a message to Standard Error if debug messages are enabled. +-----------------------------------------------------------------------------*/ + va_list args; + + VA_START (args, format); + + if (verboselevel >= FIASCO_ULTIMATE_VERBOSITY) { + fprintf (stderr, "*** "); + vfprintf (stderr, format, args); + fputc ('\n', stderr); + } + va_end (args); +} - VA_START (args, format); - if (verboselevel == FIASCO_NO_VERBOSITY) - return; - vfprintf (stderr, format, args); - fflush (stderr); - va_end (args); +void +info(const char * const format, ...) { +/*---------------------------------------------------------------------------- + Print a message to stderr. Do not append a newline. +-----------------------------------------------------------------------------*/ + va_list args; + + VA_START (args, format); + + if (verboselevel == FIASCO_NO_VERBOSITY) { + /* User doesn't want informational messages */ + } else { + vfprintf (stderr, format, args); + fflush (stderr); + } + va_end (args); } + + void -fiasco_set_verbosity (fiasco_verbosity_e level) -{ +fiasco_set_verbosity(fiasco_verbosity_e const level) { verboselevel = level; } + + fiasco_verbosity_e -fiasco_get_verbosity (void) -{ +fiasco_get_verbosity(void) { return verboselevel; } + + + diff --git a/converter/other/fiasco/lib/error.h b/converter/other/fiasco/lib/error.h index 288b25f4..4159ccd2 100644 --- a/converter/other/fiasco/lib/error.h +++ b/converter/other/fiasco/lib/error.h @@ -4,8 +4,8 @@ * Written by: Stefan Frank * Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ #ifndef ERROR_H_INCLUDED diff --git a/converter/other/fiasco/lib/image.c b/converter/other/fiasco/lib/image.c index fa3b2db5..a700fe88 100644 --- a/converter/other/fiasco/lib/image.c +++ b/converter/other/fiasco/lib/image.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/lib/image.h b/converter/other/fiasco/lib/image.h index 00978526..a87a3c05 100644 --- a/converter/other/fiasco/lib/image.h +++ b/converter/other/fiasco/lib/image.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/lib/list.c b/converter/other/fiasco/lib/list.c index bb4efae1..b67ff4b8 100644 --- a/converter/other/fiasco/lib/list.c +++ b/converter/other/fiasco/lib/list.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/lib/list.h b/converter/other/fiasco/lib/list.h index db7c08b2..68577dfd 100644 --- a/converter/other/fiasco/lib/list.h +++ b/converter/other/fiasco/lib/list.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/lib/macros.h b/converter/other/fiasco/lib/macros.h index 9968110a..0bc80e7c 100644 --- a/converter/other/fiasco/lib/macros.h +++ b/converter/other/fiasco/lib/macros.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/lib/misc.c b/converter/other/fiasco/lib/misc.c index 782ed1e9..c5629c5c 100644 --- a/converter/other/fiasco/lib/misc.c +++ b/converter/other/fiasco/lib/misc.c @@ -6,8 +6,8 @@ * Written by: Stefan Frank * Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/lib/misc.h b/converter/other/fiasco/lib/misc.h index 28fd8b5a..6f643b7a 100644 --- a/converter/other/fiasco/lib/misc.h +++ b/converter/other/fiasco/lib/misc.h @@ -4,8 +4,8 @@ * Written by: Stefan Frank * Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/lib/rpf.c b/converter/other/fiasco/lib/rpf.c index 84c1f9b6..e6ff6e09 100644 --- a/converter/other/fiasco/lib/rpf.c +++ b/converter/other/fiasco/lib/rpf.c @@ -1,10 +1,10 @@ /* - * rpf.c: Conversion of float to reduced precision format values + * rpf.c: Conversion of float to reduced precision format values * - * Written by: Stefan Frank - * Richard Krampfl - * Ullrich Hafner - * + * Written by: Stefan Frank + * Richard Krampfl + * Ullrich Hafner + * * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> */ @@ -18,6 +18,7 @@ #include "pm_config.h" #include "config.h" +#include "mallocvar.h" #include "types.h" #include "macros.h" @@ -26,39 +27,37 @@ #include "misc.h" #include "rpf.h" -/* - * CAUTION: The IEEE float format must be used by your compiler, - * or all following code is void! - */ +int const RPF_ZERO = -1; -#if BYTE_ORDER == BIG_ENDIAN -/* - * Big-Endian Architecture (e.g. SUN, Motorola) - * Memory representation of integer 0x00112233 is 00,11,22,33 - */ +/***************************************************************************** -enum real_bytes {BYTE_0, BYTE_1, BYTE_2, BYTE_3}; + private code + +*****************************************************************************/ -#else -/* - * Little-Endian Architecture (e.g. Intel, VAX, Alpha) - * Memory representation of integer 0x00112233 is 33,22,11,00 - */ -enum real_bytes {BYTE_3, BYTE_2, BYTE_1, BYTE_0}; +typedef struct { + double fraction; + int exponent; +} FracExp; -#endif -const int RPF_ZERO = -1; -/***************************************************************************** +static FracExp +fracExpFromDouble(double const x) { + + FracExp retval; + + retval.fraction = frexp(x, &retval.exponent); + + return retval; +} + - private code - -*****************************************************************************/ int -rtob (real_t f, const rpf_t *rpf) +rtob (real_t const f, + const rpf_t * const rpfP) /* * Convert real number 'f' into fixed point format. * The real number in [-'range'; +'range'] is scaled to [-1 ; +1]. @@ -66,111 +65,98 @@ rtob (real_t f, const rpf_t *rpf) * packed into one integer. * * Return value: - * real value in reduced precision format + * real value in reduced precision format */ { - unsigned int mantissa; - int exponent, sign; - union - { - float f; - unsigned char c[4]; - } v; /* conversion dummy */ - - f /= rpf->range; /* scale f to [-1,+1] */ - v.f = f; - - /* - * Extract mantissa (23 Bits), exponent (8 Bits) and sign (1 Bit) - */ - - mantissa = ((((v.c[BYTE_1] & 127) << 8 ) | v.c[BYTE_2]) << 8) | v.c[BYTE_3]; - exponent = (((v.c[BYTE_0] & 127) << 1) | (v.c[BYTE_1] & 128 ? 1 : 0)) - 126; - sign = v.c[BYTE_0] & 128 ? 1 : 0; - - /* - * Generate reduced precision mantissa. - */ - mantissa >>= 1; /* shift 1 into from left */ - mantissa |= (1 << 22); - if (exponent > 0) - mantissa <<= exponent; - else - mantissa >>= -exponent; + /* + * Extract mantissa (23 Bits), exponent (8 Bits) and sign (1 Bit) + */ + + double const normalized = f / rpfP->range; + /* 'f' scaled to [-1,+1] */ + FracExp const fracExp = fracExpFromDouble(normalized); + unsigned int const signedMantissa = + (unsigned int) (fracExp.fraction * (1<<23)); + + unsigned int mantissa; + unsigned int sign; /* 0 for positive; 1 for negative */ + + if (signedMantissa < 0) { + mantissa = -signedMantissa; + sign = 1; + } else { + mantissa = +signedMantissa; + sign = 0; + } + + /* + * Generate reduced precision mantissa. + */ + if (fracExp.exponent > 0) + mantissa <<= fracExp.exponent; + else + mantissa >>= -fracExp.exponent; + + mantissa >>= (23 - rpfP->mantissa_bits - 1); + + mantissa += 1; /* Round last bit. */ + mantissa >>= 1; - mantissa >>= (23 - rpf->mantissa_bits - 1); - - mantissa += 1; /* Round last bit. */ - mantissa >>= 1; - - if (mantissa == 0) /* close to zero */ - return RPF_ZERO; - else if (mantissa >= (1U << rpf->mantissa_bits)) /* overflow */ - return sign; - else - return ((mantissa & ((1U << rpf->mantissa_bits) - 1)) << 1) | sign; + if (mantissa == 0) /* close to zero */ + return RPF_ZERO; + else if (mantissa >= (1U << rpfP->mantissa_bits)) /* overflow */ + return sign; + else + return ((mantissa & ((1U << rpfP->mantissa_bits) - 1)) << 1) | sign; } + + float -btor (int binary, const rpf_t *rpf) +btor (int const binary, + const rpf_t * const rpfP) /* * Convert value 'binary' in reduced precision format to a real value. - * For more information refer to function lin_rtob() above. + * For more information refer to function rtob() above. * * Return value: - * converted value + * converted value */ { - unsigned int mantissa; - int sign, exponent; - union - { - float f; - unsigned char c[4]; - } value; - - if (binary == RPF_ZERO) - return 0; - - if (binary < 0 || binary >= 1 << (rpf->mantissa_bits + 1)) - error ("Reduced precision format: value %d out of range.", binary); - - /* - * Restore IEEE float format: - * mantissa (23 Bits), exponent (8 Bits) and sign (1 Bit) - */ + unsigned int mantissa; + float sign; + float f; + + if (binary == RPF_ZERO) + return 0; + + if (binary < 0 || binary >= 1 << (rpfP->mantissa_bits + 1)) + error ("Reduced precision format: value %d out of range.", binary); + + /* + * Restore IEEE float format: + * mantissa (23 Bits), exponent (8 Bits) and sign (1 Bit) + */ - sign = binary & 1; - mantissa = (binary & ((1 << (rpf->mantissa_bits + 1)) - 1)) >> 1; - mantissa <<= (23 - rpf->mantissa_bits); - exponent = 0; - - if (mantissa == 0) - { - value.f = (sign ? -1.0 : 1.0); - } - else - { - while (!(mantissa & (1 << 22))) /* normalize mantissa */ - { - exponent--; - mantissa <<= 1; - } - mantissa <<= 1; - - value.c[BYTE_0] = (sign << 7) | ((exponent + 126) >> 1); - value.c[BYTE_1] = (((exponent + 126) & 1) << 7) - | ((mantissa >> 16) & 127); - value.c[BYTE_2] = (mantissa >> 8) & 255; - value.c[BYTE_3] = mantissa & 255; - } + sign = (binary & 0x1) == 0 ? 1.0 : -1.0; + mantissa = (binary & ((0x1 << (rpfP->mantissa_bits + 1)) - 1)) >> 1; + mantissa <<= (23 - rpfP->mantissa_bits); + + if (mantissa == 0) + f = sign; + else + f = sign * (float) mantissa / 8388608; - return value.f * rpf->range; /* expand [ -1 ; +1 ] to - [ -range ; +range ] */ + return f * rpfP->range; /* expand [ -1 ; +1 ] to + [ -range ; +range ] */ } + + + rpf_t * -alloc_rpf (unsigned mantissa, fiasco_rpf_range_e range) +alloc_rpf (unsigned const mantissa, + fiasco_rpf_range_e const range) /* * Reduced precision format constructor. * Allocate memory for the rpf_t structure. @@ -180,45 +166,47 @@ alloc_rpf (unsigned mantissa, fiasco_rpf_range_e range) * returned. * * Return value - * pointer to the new rpf structure + * pointer to the new rpf structure */ { - rpf_t *rpf = Calloc (1, sizeof (rpf_t)); + rpf_t * rpfP; + + MALLOCVAR(rpfP); - if (mantissa < 2) - { - warning (_("Size of RPF mantissa has to be in the interval [2,8]. " - "Using minimum value 2.\n")); - mantissa = 2; - } - else if (mantissa > 8) - { - warning (_("Size of RPF mantissa has to be in the interval [2,8]. " - "Using maximum value 8.\n")); - mantissa = 2; - } - - rpf->mantissa_bits = mantissa; - rpf->range_e = range; - switch (range) - { - case FIASCO_RPF_RANGE_0_75: - rpf->range = 0.75; - break; - case FIASCO_RPF_RANGE_1_50: - rpf->range = 1.50; - break; - case FIASCO_RPF_RANGE_2_00: - rpf->range = 2.00; - break; - case FIASCO_RPF_RANGE_1_00: - rpf->range = 1.00; - break; - default: - warning (_("Invalid RPF range specified. Using default value 1.0.")); - rpf->range = 1.00; - rpf->range_e = FIASCO_RPF_RANGE_1_00; - break; - } - return rpf; + if (mantissa < 2) { + warning (_("Size of RPF mantissa has to be in the interval [2,8]. " + "Using minimum value 2.\n")); + rpfP->mantissa_bits = 2; + } else if (mantissa > 8) { + warning (_("Size of RPF mantissa has to be in the interval [2,8]. " + "Using maximum value 8.\n")); + rpfP->mantissa_bits = 2; + } else + rpfP->mantissa_bits = mantissa; + + switch (range) { + case FIASCO_RPF_RANGE_0_75: + rpfP->range = 0.75; + rpfP->range_e = range; + break; + case FIASCO_RPF_RANGE_1_50: + rpfP->range = 1.50; + rpfP->range_e = range; + break; + case FIASCO_RPF_RANGE_2_00: + rpfP->range = 2.00; + rpfP->range_e = range; + break; + case FIASCO_RPF_RANGE_1_00: + rpfP->range = 1.00; + rpfP->range_e = range; + break; + default: + warning (_("Invalid RPF range specified. Using default value 1.0.")); + rpfP->range = 1.00; + rpfP->range_e = FIASCO_RPF_RANGE_1_00; + break; + } + return rpfP; } + diff --git a/converter/other/fiasco/lib/rpf.h b/converter/other/fiasco/lib/rpf.h index ba3ff6be..e543f855 100644 --- a/converter/other/fiasco/lib/rpf.h +++ b/converter/other/fiasco/lib/rpf.h @@ -5,8 +5,8 @@ * Richard Krampfl * Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/lib/types.h b/converter/other/fiasco/lib/types.h index 16d8028c..02e40a90 100644 --- a/converter/other/fiasco/lib/types.h +++ b/converter/other/fiasco/lib/types.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/output/matrices.c b/converter/other/fiasco/output/matrices.c index 01189669..7dc0e6d9 100644 --- a/converter/other/fiasco/output/matrices.c +++ b/converter/other/fiasco/output/matrices.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* NETPBM: When you call delta_encoding() with last_domain < 4, it diff --git a/converter/other/fiasco/output/matrices.h b/converter/other/fiasco/output/matrices.h index f880fef8..44671496 100644 --- a/converter/other/fiasco/output/matrices.h +++ b/converter/other/fiasco/output/matrices.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/output/mc.c b/converter/other/fiasco/output/mc.c index afff586b..d048bef5 100644 --- a/converter/other/fiasco/output/mc.c +++ b/converter/other/fiasco/output/mc.c @@ -4,8 +4,8 @@ * Written by: Michael Unger * Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/output/mc.h b/converter/other/fiasco/output/mc.h index b7843fd8..cacddfe7 100644 --- a/converter/other/fiasco/output/mc.h +++ b/converter/other/fiasco/output/mc.h @@ -4,8 +4,8 @@ * Written by: Michael Unger * Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/output/nd.c b/converter/other/fiasco/output/nd.c index a09ff762..65a85467 100644 --- a/converter/other/fiasco/output/nd.c +++ b/converter/other/fiasco/output/nd.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/output/nd.h b/converter/other/fiasco/output/nd.h index 600b3d73..01a37838 100644 --- a/converter/other/fiasco/output/nd.h +++ b/converter/other/fiasco/output/nd.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/output/tree.c b/converter/other/fiasco/output/tree.c index 0056d7dd..2eae2df9 100644 --- a/converter/other/fiasco/output/tree.c +++ b/converter/other/fiasco/output/tree.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/output/tree.h b/converter/other/fiasco/output/tree.h index 6f8a3800..50fe2279 100644 --- a/converter/other/fiasco/output/tree.h +++ b/converter/other/fiasco/output/tree.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/output/weights.c b/converter/other/fiasco/output/weights.c index 5aa17674..0203fef0 100644 --- a/converter/other/fiasco/output/weights.c +++ b/converter/other/fiasco/output/weights.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/output/weights.h b/converter/other/fiasco/output/weights.h index 271203ad..f22bd9f8 100644 --- a/converter/other/fiasco/output/weights.h +++ b/converter/other/fiasco/output/weights.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/output/write.c b/converter/other/fiasco/output/write.c index e6185ad3..d6faee26 100644 --- a/converter/other/fiasco/output/write.c +++ b/converter/other/fiasco/output/write.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/output/write.h b/converter/other/fiasco/output/write.h index a3ede1f4..6bdc2f1b 100644 --- a/converter/other/fiasco/output/write.h +++ b/converter/other/fiasco/output/write.h @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/params.c b/converter/other/fiasco/params.c index afacbada..7d0b84ab 100644 --- a/converter/other/fiasco/params.c +++ b/converter/other/fiasco/params.c @@ -4,8 +4,8 @@ * Written by: Stefan Frank * Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* @@ -15,6 +15,7 @@ * $State: Exp $ */ +#define _DEFAULT_SOURCE 1 /* New name for SVID & BSD source defines */ #define _BSD_SOURCE 1 /* Make sure strdup() is in string.h and strcaseeq() is in nstring.h */ #define _XOPEN_SOURCE 500 /* Make sure strdup() is in string.h */ @@ -325,8 +326,17 @@ parseargs (param_t *usr_params, NO, sys_path, usr_file_name); else if (streq (params [param_index].name, "version")) { - fprintf (stderr, "%s " VERSION "\n", argv [0]); - exit (2); + fprintf (stderr, "%s " VERSION "\n", argv [0]); + { + /* Kludge for standard Netpbm version announcement */ + char * modified_argv[2]; + int argc; + modified_argv[0] = argv[0]; + modified_argv[1] = (char *) "--version"; + argc = 2; + pm_proginit(&argc, (const char **) modified_argv); + } + exit (2); } else if (streq (params [param_index].name, "verbose")) fiasco_set_verbosity ( diff --git a/converter/other/fiasco/params.h b/converter/other/fiasco/params.h index 810a9ff0..a1164cf7 100644 --- a/converter/other/fiasco/params.h +++ b/converter/other/fiasco/params.h @@ -4,8 +4,8 @@ * Written by: Stefan Frank * Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/pnmtofiasco.c b/converter/other/fiasco/pnmtofiasco.c index eebd09a9..e2656c71 100644 --- a/converter/other/fiasco/pnmtofiasco.c +++ b/converter/other/fiasco/pnmtofiasco.c @@ -3,8 +3,8 @@ * * Written by: Ullrich Hafner * - * This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) - * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> + * This file is part of FIASCO (Fractal Image And Sequence COdec) + * Copyright (C) 1994-2000 Ullrich Hafner */ /* diff --git a/converter/other/fiasco/system.fiascorc b/converter/other/fiasco/system.fiascorc index 86ff2da2..77d60603 100644 --- a/converter/other/fiasco/system.fiascorc +++ b/converter/other/fiasco/system.fiascorc @@ -3,8 +3,8 @@ # # Written by: Ullrich Hafner # -# This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec) -# Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> +# This file is part of FIASCO (Fractal Image And Sequence COdec) +# Copyright (C) 1994-2000 Ullrich Hafner # # $Date: 2000/06/25 16:38:01 $ |