diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2020-03-26 02:53:02 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2020-03-26 02:53:02 +0000 |
commit | b117a415aaf58c435805243a930e833f8cf62421 (patch) | |
tree | ca6cda4c24d37737a3942e534b95006bcd566c5a /converter/other/fiasco/codec | |
parent | 34bb24c566c9d9fe3c4ae71fc4c6b53323fb1dd9 (diff) | |
download | netpbm-mirror-b117a415aaf58c435805243a930e833f8cf62421.tar.gz netpbm-mirror-b117a415aaf58c435805243a930e833f8cf62421.tar.xz netpbm-mirror-b117a415aaf58c435805243a930e833f8cf62421.zip |
Promote trunk (10.90.00) to advanced
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3784 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/fiasco/codec')
-rw-r--r-- | converter/other/fiasco/codec/coder.c | 142 | ||||
-rw-r--r-- | converter/other/fiasco/codec/cwfa.h | 2 | ||||
-rw-r--r-- | converter/other/fiasco/codec/dfiasco.c | 40 | ||||
-rw-r--r-- | converter/other/fiasco/codec/ip.c | 76 | ||||
-rw-r--r-- | converter/other/fiasco/codec/prediction.c | 114 | ||||
-rw-r--r-- | converter/other/fiasco/codec/subdivide.c | 124 | ||||
-rw-r--r-- | converter/other/fiasco/codec/wfa.h | 8 |
7 files changed, 253 insertions, 253 deletions
diff --git a/converter/other/fiasco/codec/coder.c b/converter/other/fiasco/codec/coder.c index 1e21994d..dc774a19 100644 --- a/converter/other/fiasco/codec/coder.c +++ b/converter/other/fiasco/codec/coder.c @@ -2,7 +2,7 @@ * coder.c: WFA coder toplevel functions * * Written by: Ullrich Hafner - * + * * This file is part of FIASCO (Fractal Image And Sequence COdec) * Copyright (C) 1994-2000 Ullrich Hafner */ @@ -56,7 +56,7 @@ /***************************************************************************** global variables - + *****************************************************************************/ const real_t MAXCOSTS = 1e20; @@ -64,7 +64,7 @@ const real_t MAXCOSTS = 1e20; /***************************************************************************** private code - + *****************************************************************************/ static char * @@ -109,44 +109,44 @@ get_input_image_name (char const * const *templptr, unsigned ith_image) strcpy (prefix, template); prefix [s - template] = '\0'; - + for (s2 = ++s, n_digits = 0; ISDIGIT (*s2); s2++, n_digits++) ; if (sscanf (s, "%d", &dummy) == 0 || dummy < 0) error ("Input name template conversion failure.\n" "Check spelling of template."); first = (unsigned) dummy; - + if (*s2++ != '-') error ("Input name template conversion failure.\n" "Check spelling of template."); - + for (s = s2; ISDIGIT (*s2); s2++) ; if (sscanf (s, "%d", &dummy) == 0 || dummy < 0) error ("Input name template conversion failure.\n" "Check spelling of template."); last = (unsigned) dummy; - - if (*s2 == '+' || *s2 == '-') + + if (*s2 == '+' || *s2 == '-') { for (s = s2++; ISDIGIT (*s2); s2++) ; if (sscanf (s, "%d", &increment) == 0) error ("Input name template conversion failure.\n" "Check spelling of template."); - } + } if (*s2 != ']') error ("Input name template conversion failure.\n" "Check spelling of template."); suffix = s2 + 1; - + image_num = first + increment * ith_image; if (image_num < 0) error ("Input name template conversion failure.\n" "Check spelling of template."); - - if ((increment > 0 && (unsigned) image_num > last) || + + if ((increment > 0 && (unsigned) image_num > last) || (increment <= 0 && (unsigned) image_num < last)) { /* TODO: check this */ @@ -158,7 +158,7 @@ get_input_image_name (char const * const *templptr, unsigned ith_image) /* format string for image filename */ char image_name [MAXSTRLEN]; /* image file name to be composed */ - + strcpy (formatstr, "%s%0?d%s"); formatstr [4] = '0' + (char) n_digits; sprintf (image_name, formatstr, prefix, image_num, suffix); @@ -167,7 +167,7 @@ get_input_image_name (char const * const *templptr, unsigned ith_image) } } return NULL; -} +} @@ -191,7 +191,7 @@ alloc_coder (char const * const * const inputname, coding_t * c; c = NULL; /* initial value */ - + /* * Check whether all specified image frames are readable and of same type */ @@ -200,7 +200,7 @@ alloc_coder (char const * const * const inputname, int width, w = 0, height, h = 0; bool_t color, c = NO; unsigned n; - + for (n = 0; (filename = get_input_image_name (inputname, n)); n++) { xelval maxval; @@ -220,7 +220,7 @@ alloc_coder (char const * const * const inputname, pm_close(file); } color = (PNM_FORMAT_TYPE(format) == PPM_FORMAT) ? TRUE: FALSE; - + if (n > 0) { if (w != width || h != height || c != color) @@ -249,13 +249,13 @@ alloc_coder (char const * const * const inputname, */ { unsigned lx, ly; - + lx = (unsigned) (log2 (wi->width - 1) + 1); ly = (unsigned) (log2 (wi->height - 1) + 1); - + wi->level = MAX(lx, ly) * 2 - ((ly == lx + 1) ? 1 : 0); } - + c = Calloc (1, sizeof (coding_t)); c->options = *options; @@ -278,10 +278,10 @@ alloc_coder (char const * const * const inputname, c->options.lc_max_level, wi->level - c->tiling->exponent - 1); c->options.lc_max_level = wi->level - c->tiling->exponent - 1; } - + if (c->options.lc_min_level > c->options.lc_max_level) c->options.lc_min_level = c->options.lc_max_level; - + /* * p_min_level, p_max_level min and max level for ND/MC prediction * [p_min_level, p_max_level] must be a subset of [min_level, max_level] ! @@ -293,7 +293,7 @@ alloc_coder (char const * const * const inputname, c->options.images_level = MIN(c->options.images_level, c->options.lc_max_level - 1); - + c->products_level = MAX(0, ((signed int) c->options.lc_max_level - (signed int) c->options.images_level - 1)); c->pixels = Calloc (size_of_level (c->options.lc_max_level), @@ -301,7 +301,7 @@ alloc_coder (char const * const * const inputname, c->images_of_state = Calloc (MAXSTATES, sizeof (real_t *)); c->ip_images_state = Calloc (MAXSTATES, sizeof (real_t *)); c->ip_states_state = Calloc (MAXSTATES * MAXLEVEL, sizeof (real_t *)); - + debug_message ("Imageslevel :%d, Productslevel :%d", c->options.images_level, c->products_level); debug_message ("Memory : (%d + %d + %d * 'states') * 'states' + %d", @@ -309,7 +309,7 @@ alloc_coder (char const * const * const inputname, size_of_tree (c->products_level) * 4, (c->options.lc_max_level - c->options.images_level), size_of_level (c->options.lc_max_level)); - + /* * Domain pools ... */ @@ -333,7 +333,7 @@ alloc_coder (char const * const * const inputname, */ wi->title = strdup (options->title); wi->comment = strdup (options->comment); - + /* * Reduced precision format */ @@ -345,7 +345,7 @@ alloc_coder (char const * const * const inputname, = alloc_rpf (options->d_rpf_mantissa, options->d_rpf_range); wi->d_dc_rpf = alloc_rpf (options->d_dc_rpf_mantissa, options->d_dc_rpf_range); - + /* * Color image options ... */ @@ -361,7 +361,7 @@ alloc_coder (char const * const * const inputname, wi->cross_B_search = options->half_pixel_prediction; wi->B_as_past_ref = options->B_as_past_ref; wi->smoothing = options->smoothing; - + c->mt = alloc_motion (wi); return c; @@ -383,7 +383,7 @@ free_coder (coding_t *c) { free_tiling (c->tiling); free_motion (c->mt); - + Free (c->pixels); Free (c->images_of_state); Free (c->ip_images_state); @@ -424,13 +424,13 @@ print_statistics (char c, real_t costs, const wfa_t *wfa, const image_t *image, const range_t *range) { unsigned max_level, min_level, state, label, lincomb; - + for (max_level = 0, min_level = MAXLEVEL, state = wfa->basis_states; state < wfa->states; state++) { for (lincomb = 0, label = 0; label < MAXLABELS; label++) lincomb += isrange(wfa->tree[state][label]) ? 1 : 0; - + if (lincomb) { max_level = MAX(max_level, @@ -483,10 +483,10 @@ print_statistics (char c, real_t costs, const wfa_t *wfa, const image_t *image, -static void +static void frame_coder (wfa_t *wfa, coding_t *c, bitfile_t *output) /* - * + * * WFA Coding of next frame. All important coding parameters are * stored in 'c'. The generated 'wfa' is written to stream 'output' * immediately after coding. @@ -499,11 +499,11 @@ frame_coder (wfa_t *wfa, coding_t *c, bitfile_t *output) real_t costs; /* total costs (minimized quantity) */ unsigned bits; /* number of bits written on disk */ clock_t ptimer; - + prg_timer (&ptimer, START); bits = bits_processed (output); - + init_tree_model (&c->tree); init_tree_model (&c->p_tree); @@ -552,9 +552,9 @@ frame_coder (wfa_t *wfa, coding_t *c, bitfile_t *output) int YCb_node = -1; int tree [3]; /* 3 root states of each color comp. */ color_e band; - + /* - * When compressing color images, the three color components (YCbCr) + * When compressing color images, the three color components (YCbCr) * are copied into a large image: * [ Y Cr ] * [ Cb 0 ] @@ -573,14 +573,14 @@ frame_coder (wfa_t *wfa, coding_t *c, bitfile_t *output) c->domain_pool->chroma (wfa->wfainfo->chroma_max_states, wfa, c->domain_pool->model); /* - * Don't use a finer partioning for the chrominancy bands than - * for the luminancy band. + * Don't use a finer partitioning for the chrominancy bands + * than for the luminancy band. */ for (min_level = MAXLEVEL, state = wfa->basis_states; state < wfa->states; state++) { unsigned lincomb, label; - + for (lincomb = 0, label = 0; label < MAXLABELS; label++) lincomb += isrange (wfa->tree [state][label]) ? 1 : 0; if (lincomb) @@ -596,23 +596,23 @@ frame_coder (wfa_t *wfa, coding_t *c, bitfile_t *output) memset (&range, 0, sizeof (range_t)); range.level = wfa->wfainfo->level; - + costs = subdivide (MAXCOSTS, band, tree [Y], &range, wfa, c, c->mt->frame_type != I_FRAME && band == Y, NO); if (c->options.progress_meter != FIASCO_PROGRESS_NONE) message (""); { char colors [] = {'Y', 'B', 'R'}; - + print_statistics (colors [band], costs, wfa, c->mt->original, &range); } - + if (isrange (range.tree)) /* whole image is approx. by a l.c. */ error ("No root state generated for color component %d!", band); else tree[band] = range.tree; - + if (band == Cb) { wfa->tree [wfa->states][0] = tree[Y]; @@ -623,13 +623,13 @@ frame_coder (wfa_t *wfa, coding_t *c, bitfile_t *output) } } /* - * generate two virtual states (*) + * generate two virtual states (*) * * * * / \ * + * - * / \ / - * Y CbCr + * / \ / + * Y CbCr */ wfa->tree [wfa->states][0] = tree[Cr]; wfa->tree [wfa->states][1] = RANGE; @@ -646,7 +646,7 @@ frame_coder (wfa_t *wfa, coding_t *c, bitfile_t *output) for (state = wfa->basis_states; state < MAXSTATES; state++) { unsigned level; - + if (c->images_of_state [state]) { Free (c->images_of_state [state]); @@ -665,12 +665,12 @@ frame_coder (wfa_t *wfa, coding_t *c, bitfile_t *output) Free (c->ip_states_state [state][level]); c->ip_states_state [state][level] = NULL; } - + } - + locate_delta_images (wfa); write_next_wfa (wfa, c, output); - + bits = bits_processed (output) - bits; debug_message ("Total number of bits written: %d (%d bytes, %5.3f bpp)", bits, bits >> 3, @@ -712,7 +712,7 @@ video_coder(char const * const * const image_template, /* image name of current frame. File name or "-" for Standard Input */ image_t *reconst = NULL; /* decoded reference image */ bool_t future_frame = NO; /* YES if last frame was in future */ - + debug_message ("Generating %d WFA's ...", wfa->wfainfo->frames); future_display = -1; @@ -722,7 +722,7 @@ video_coder(char const * const * const image_template, while ((image_name = get_input_image_name (image_template, display))) { frame_type_e type; /* current frame type: I, B, P */ - + /* * Determine type of next frame. * Skip already coded frames (future reference!) @@ -731,7 +731,7 @@ video_coder(char const * const * const image_template, type = I_FRAME; /* Force first frame to be intra */ else type = pattern2type (display, c->options.pattern); - + if (type != I_FRAME && c->options.reference_filename) /* Load reference from disk */ { @@ -741,12 +741,12 @@ video_coder(char const * const * const image_template, c->options.reference_filename = NULL; } if ((int) display == future_display) - { + { /* Skip already coded future ref */ display++; continue; - } - else if (type == B_FRAME && (int) display > future_display) + } + else if (type == B_FRAME && (int) display > future_display) { unsigned i = display; /* @@ -758,7 +758,7 @@ video_coder(char const * const * const image_template, i++; name = get_input_image_name (image_template, i); - + if (!name) /* Force last valid frame to be 'P' */ { future_display = i - 1; @@ -766,7 +766,7 @@ video_coder(char const * const * const image_template, } else { - future_display = i; + future_display = i; image_name = name; type = pattern2type (i, c->options.pattern); } @@ -781,7 +781,7 @@ video_coder(char const * const * const image_template, debug_message ("Coding \'%s\' [%c-frame].", image_name, type == I_FRAME ? 'I' : (type == P_FRAME ? 'P' : 'B')); - + /* * Depending on current frame type update past and future frames * which are needed as reference frames. @@ -846,10 +846,10 @@ video_coder(char const * const * const image_template, c->mt->original = read_image_stream(stdin, stdinwidth, stdinheight, stdinmaxval, stdinformat); - else + else c->mt->original = read_image_file(image_name); - if (c->tiling->exponent && type == I_FRAME) + if (c->tiling->exponent && type == I_FRAME) perform_tiling (c->mt->original, c->tiling); frame_coder (wfa, c, output); @@ -869,7 +869,7 @@ video_coder(char const * const * const image_template, if (c->mt->original) free_image (c->mt->original); c->mt->original = NULL; - + remove_states (wfa->basis_states, wfa); /* Clear WFA structure */ } @@ -927,7 +927,7 @@ read_stdin_header(const char * const * const template, /***************************************************************************** public code - + *****************************************************************************/ int @@ -957,7 +957,7 @@ fiasco_coder (char const * const *inputname, const char *outputname, unsigned int stdinheight, stdinwidth; xelval stdinmaxval; int stdinformat; - + /* * Check parameters */ @@ -965,7 +965,7 @@ fiasco_coder (char const * const *inputname, const char *outputname, template = default_input; else template = inputname; - + if (quality <= 0) { set_error (_("Compression quality has to be positive.")); @@ -1013,20 +1013,20 @@ fiasco_coder (char const * const *inputname, const char *outputname, coding_t *c = alloc_coder(template, cop, wfa->wfainfo, stdinwidth, stdinheight, stdinmaxval, stdinformat); - + read_basis (cop->basis_name, wfa); append_basis_states (wfa->basis_states, wfa, c); - + c->price = 128 * 64 / quality; - + video_coder (template, output, wfa, c, stdinwidth, stdinheight, stdinmaxval, stdinformat); - + close_bitfile (output); free_wfa (wfa); free_coder (c); - + if (default_options) fiasco_c_options_delete (default_options); } diff --git a/converter/other/fiasco/codec/cwfa.h b/converter/other/fiasco/codec/cwfa.h index dd86fbfc..e8e2d474 100644 --- a/converter/other/fiasco/codec/cwfa.h +++ b/converter/other/fiasco/codec/cwfa.h @@ -33,7 +33,7 @@ extern const real_t MAXCOSTS; typedef struct motion { image_t *original; /* Current image */ - image_t *past; /* Preceeding image */ + image_t *past; /* Preceding image */ image_t *future; /* Succeeding image */ frame_type_e frame_type; /* frame type: B_, P_ I_FRAME */ unsigned number; /* display number of frame */ diff --git a/converter/other/fiasco/codec/dfiasco.c b/converter/other/fiasco/codec/dfiasco.c index d45c9e39..ce25654a 100644 --- a/converter/other/fiasco/codec/dfiasco.c +++ b/converter/other/fiasco/codec/dfiasco.c @@ -2,11 +2,11 @@ * dfiasco.c: Decoder public interface * * Written by: Ullrich Hafner - * + * * This file is part of FIASCO (Fractal Image And Sequence COdec) * Copyright (C) 1994-2000 Ullrich Hafner */ - + /* * $Date: 2000/10/28 17:39:30 $ * $Author: hafner $ @@ -38,7 +38,7 @@ /***************************************************************************** prototypes - + *****************************************************************************/ static dfiasco_t * @@ -52,7 +52,7 @@ alloc_dfiasco (wfa_t *wfa, video_t *video, bitfile_t *input, /***************************************************************************** public code - + *****************************************************************************/ fiasco_decoder_t * @@ -79,7 +79,7 @@ fiasco_decoder_new (const char *filename, const fiasco_d_options_t *options) default_options = fiasco_d_options_new (); dop = cast_d_options (default_options); } - + wfa = alloc_wfa (NO); video = alloc_video (NO); input = open_wfa (filename, wfa->wfainfo); @@ -102,7 +102,7 @@ fiasco_decoder_new (const char *filename, const fiasco_d_options_t *options) dop->magnification, dop->smoothing, dop->image_format); - + if (default_options) fiasco_d_options_delete (default_options); if (dfiasco->enlarge_factor >= 0) @@ -115,7 +115,7 @@ fiasco_decoder_new (const char *filename, const fiasco_d_options_t *options) if (pixels << (n << 1) > 2048 * 2048) { set_error (_("Magnifaction factor `%d' is too large. " - "Maximium value is %d."), + "Maximum value is %d."), dfiasco->enlarge_factor, MAX(0, n - 1)); fiasco_decoder_delete (decoder); return NULL; @@ -152,7 +152,7 @@ fiasco_decoder_write_frame (fiasco_decoder_t *decoder, const char *filename) { dfiasco_t *dfiasco = cast_dfiasco (decoder); - + if (!dfiasco) return 0; else @@ -177,7 +177,7 @@ fiasco_image_t * fiasco_decoder_get_frame (fiasco_decoder_t *decoder) { dfiasco_t *dfiasco = cast_dfiasco (decoder); - + if (!dfiasco) return NULL; else @@ -197,7 +197,7 @@ fiasco_decoder_get_frame (fiasco_decoder_t *decoder) image->get_width = fiasco_image_get_width; image->get_height = fiasco_image_get_height; image->is_color = fiasco_image_is_color; - + return image; } catch @@ -211,7 +211,7 @@ unsigned fiasco_decoder_get_length (fiasco_decoder_t *decoder) { dfiasco_t *dfiasco = cast_dfiasco (decoder); - + if (!dfiasco) return 0; else @@ -222,7 +222,7 @@ unsigned fiasco_decoder_get_rate (fiasco_decoder_t *decoder) { dfiasco_t *dfiasco = cast_dfiasco (decoder); - + if (!dfiasco) return 0; else @@ -239,12 +239,12 @@ fiasco_decoder_get_width (fiasco_decoder_t *decoder) else { unsigned width; - + if (dfiasco->enlarge_factor >= 0) width = dfiasco->wfa->wfainfo->width << dfiasco->enlarge_factor; else width = dfiasco->wfa->wfainfo->width >> - dfiasco->enlarge_factor; - + return width & 1 ? width + 1 : width; } } @@ -259,7 +259,7 @@ fiasco_decoder_get_height (fiasco_decoder_t *decoder) else { unsigned height; - + if (dfiasco->enlarge_factor >= 0) height = dfiasco->wfa->wfainfo->height << dfiasco->enlarge_factor; else @@ -306,10 +306,10 @@ int fiasco_decoder_delete (fiasco_decoder_t *decoder) { dfiasco_t *dfiasco = cast_dfiasco (decoder); - + if (!dfiasco) return 1; - + try { free_wfa (dfiasco->wfa); @@ -330,7 +330,7 @@ fiasco_decoder_delete (fiasco_decoder_t *decoder) /***************************************************************************** private code - + *****************************************************************************/ static dfiasco_t * @@ -347,14 +347,14 @@ alloc_dfiasco (wfa_t *wfa, video_t *video, bitfile_t *input, dfiasco_t *dfiasco = Calloc (1, sizeof (dfiasco_t)); strcpy (dfiasco->id, "DFIASCO"); - + dfiasco->wfa = wfa; dfiasco->video = video; dfiasco->input = input; dfiasco->enlarge_factor = enlarge_factor; dfiasco->smoothing = smoothing; dfiasco->image_format = image_format; - + return dfiasco; } diff --git a/converter/other/fiasco/codec/ip.c b/converter/other/fiasco/codec/ip.c index 56b0ae9a..18257a06 100644 --- a/converter/other/fiasco/codec/ip.c +++ b/converter/other/fiasco/codec/ip.c @@ -2,7 +2,7 @@ * ip.c: Computation of inner products * * Written by: Ullrich Hafner - * + * * This file is part of FIASCO (Fractal Image And Sequence COdec) * Copyright (C) 1994-2000 Ullrich Hafner */ @@ -27,40 +27,40 @@ /***************************************************************************** prototypes - + *****************************************************************************/ -static real_t +static real_t standard_ip_image_state (unsigned address, unsigned level, unsigned domain, const coding_t *c); -static real_t +static real_t standard_ip_state_state (unsigned domain1, unsigned domain2, unsigned level, const coding_t *c); /***************************************************************************** public code - + *****************************************************************************/ -real_t +real_t get_ip_image_state (unsigned image, unsigned address, unsigned level, unsigned domain, const coding_t *c) /* * Return value: * Inner product between 'image' ('address') and - * 'domain' at given 'level' + * 'domain' at given 'level' */ { if (level <= c->options.images_level) { /* - * Compute the inner product in the standard way by multiplying + * Compute the inner product in the standard way by multiplying * the pixel-values of the given domain and range image. - */ + */ return standard_ip_image_state (address, level, domain, c); } - else + else { /* * Use the already computed inner products stored in 'ip_images_states' @@ -69,29 +69,29 @@ get_ip_image_state (unsigned image, unsigned address, unsigned level, } } -void +void compute_ip_images_state (unsigned image, unsigned address, unsigned level, unsigned n, unsigned from, const wfa_t *wfa, coding_t *c) /* * Compute the inner products between all states * 'from', ... , 'wfa->max_states' and the range images 'image' - * (and childs) up to given level. + * (and children) up to given level. * * No return value. * * Side effects: * inner product tables 'c->ip_images_states' are updated - */ + */ { - if (level > c->options.images_level) + if (level > c->options.images_level) { unsigned state, label; if (level > c->options.images_level + 1) /* recursive computation */ compute_ip_images_state (MAXLABELS * image + 1, address * MAXLABELS, level - 1, MAXLABELS * n, from, wfa, c); - + /* * Compute inner product <f, Phi_i> */ @@ -102,7 +102,7 @@ compute_ip_images_state (unsigned image, unsigned address, unsigned level, unsigned edge, count; int domain; real_t *dst, *src; - + if (ischild (domain = wfa->tree [state][label])) { if (level > c->options.images_level + 1) @@ -116,9 +116,9 @@ compute_ip_images_state (unsigned image, unsigned address, unsigned level, else { unsigned newadr = address * MAXLABELS + label; - + dst = c->ip_images_state [state] + image; - + for (count = n; count; count--, newadr += MAXLABELS) *dst++ += standard_ip_image_state (newadr, level - 1, domain, c); @@ -128,7 +128,7 @@ compute_ip_images_state (unsigned image, unsigned address, unsigned level, edge++) { real_t weight = wfa->weight [state][label][edge]; - + if (level > c->options.images_level + 1) { dst = c->ip_images_state [state] + image; @@ -142,7 +142,7 @@ compute_ip_images_state (unsigned image, unsigned address, unsigned level, unsigned newadr = address * MAXLABELS + label; dst = c->ip_images_state [state] + image; - + for (count = n; count; count--, newadr += MAXLABELS) *dst++ += weight * standard_ip_image_state (newadr, level - 1, @@ -153,7 +153,7 @@ compute_ip_images_state (unsigned image, unsigned address, unsigned level, } } -real_t +real_t get_ip_state_state (unsigned domain1, unsigned domain2, unsigned level, const coding_t *c) /* @@ -164,12 +164,12 @@ get_ip_state_state (unsigned domain1, unsigned domain2, unsigned level, if (level <= c->options.images_level) { /* - * Compute the inner product in the standard way by multiplying + * Compute the inner product in the standard way by multiplying * the pixel-values of both state-images - */ + */ return standard_ip_state_state (domain1, domain2, level, c); } - else + else { /* * Use already computed inner products stored in 'ip_images_states' @@ -181,7 +181,7 @@ get_ip_state_state (unsigned domain1, unsigned domain2, unsigned level, } } -void +void compute_ip_states_state (unsigned from, unsigned to, const wfa_t *wfa, coding_t *c) /* @@ -192,7 +192,7 @@ compute_ip_states_state (unsigned from, unsigned to, * * Side effects: * inner product tables 'c->ip_states_state' are computed. - */ + */ { unsigned level; unsigned state1, state2; @@ -204,25 +204,25 @@ compute_ip_states_state (unsigned from, unsigned to, for (level = c->options.images_level + 1; level <= c->options.lc_max_level; level++) for (state1 = from; state1 <= to; state1++) - for (state2 = 0; state2 <= state1; state2++) + for (state2 = 0; state2 <= state1; state2++) if (need_image (state2, wfa)) { unsigned label; real_t ip = 0; - + for (label = 0; label < MAXLABELS; label++) { int domain1, domain2; unsigned edge1, edge2; real_t sum, weight2; - + if (ischild (domain1 = wfa->tree [state1][label])) { sum = 0; if (ischild (domain2 = wfa->tree [state2][label])) sum = get_ip_state_state (domain1, domain2, level - 1, c); - + for (edge2 = 0; isedge (domain2 = wfa->into [state2][label][edge2]); edge2++) @@ -238,12 +238,12 @@ compute_ip_states_state (unsigned from, unsigned to, edge1++) { real_t weight1 = wfa->weight [state1][label][edge1]; - + sum = 0; if (ischild (domain2 = wfa->tree [state2][label])) sum = get_ip_state_state (domain1, domain2, level - 1, c); - + for (edge2 = 0; isedge (domain2 = wfa->into [state2][label][edge2]); edge2++) @@ -262,10 +262,10 @@ compute_ip_states_state (unsigned from, unsigned to, /***************************************************************************** private code - + *****************************************************************************/ -static real_t +static real_t standard_ip_image_state (unsigned address, unsigned level, unsigned domain, const coding_t *c) /* @@ -283,18 +283,18 @@ standard_ip_image_state (unsigned address, unsigned level, unsigned domain, if (level > c->options.images_level) error ("We cannot interpret a Level %d image.", level); - + imageptr = &c->pixels [address * size_of_level (level)]; stateptr = c->images_of_state [domain] + address_of_level (level); - + for (i = size_of_level (level); i; i--) ip += *imageptr++ * *stateptr++; return ip; } -static real_t +static real_t standard_ip_state_state (unsigned domain1, unsigned domain2, unsigned level, const coding_t *c) /* @@ -315,7 +315,7 @@ standard_ip_state_state (unsigned domain1, unsigned domain2, unsigned level, state1ptr = c->images_of_state [domain1] + address_of_level (level); state2ptr = c->images_of_state [domain2] + address_of_level (level); - + for (i = size_of_level (level); i; i--) ip += *state1ptr++ * *state2ptr++; diff --git a/converter/other/fiasco/codec/prediction.c b/converter/other/fiasco/codec/prediction.c index e78e5acc..c592baa5 100644 --- a/converter/other/fiasco/codec/prediction.c +++ b/converter/other/fiasco/codec/prediction.c @@ -1,9 +1,9 @@ /* - * prediction.c: Range image prediction with MC or ND + * prediction.c: Range image prediction with MC or ND * * Written by: Ullrich Hafner * Michael Unger - * + * * This file is part of FIASCO (Fractal Image And Sequence COdec) * Copyright (C) 1994-2000 Ullrich Hafner */ @@ -41,7 +41,7 @@ /***************************************************************************** local variables - + *****************************************************************************/ typedef struct state_data @@ -71,7 +71,7 @@ typedef struct state_data /***************************************************************************** prototypes - + *****************************************************************************/ static real_t @@ -90,9 +90,9 @@ restore_state_data (unsigned from, unsigned to, unsigned max_level, /***************************************************************************** public code - + *****************************************************************************/ - + real_t predict_range (real_t max_costs, real_t price, range_t *range, wfa_t *wfa, coding_t *c, unsigned band, int y_state, unsigned states, @@ -124,11 +124,11 @@ predict_range (real_t max_costs, real_t price, range_t *range, wfa_t *wfa, rec_d_coeff_model = c->d_coeff->model; rec_tree_model = c->tree; rec_p_tree_model = c->p_tree; - rec_states = wfa->states; + rec_states = wfa->states; rec_pixels = c->pixels; rec_state_data = store_state_data (states, rec_states - 1, c->options.lc_max_level, wfa, c); - + /* * Restore probability models to the state before the recursive subdivision * has been started. @@ -141,14 +141,14 @@ predict_range (real_t max_costs, real_t price, range_t *range, wfa_t *wfa, c->coeff->model = c->coeff->model_duplicate (c->coeff, coeff_model); c->d_coeff->model = c->d_coeff->model_duplicate (c->d_coeff, d_coeff_model); - + if (c->mt->frame_type == I_FRAME) - costs = nd_prediction (max_costs, price, band, y_state, range, wfa, c); + costs = nd_prediction (max_costs, price, band, y_state, range, wfa, c); else costs = mc_prediction (max_costs, price, band, y_state, range, wfa, c); - + c->pixels = rec_pixels; - + if (costs < MAXCOSTS) { /* @@ -187,25 +187,25 @@ predict_range (real_t max_costs, real_t price, range_t *range, wfa_t *wfa, c->d_domain_pool->model_free (c->d_domain_pool->model); c->coeff->model_free (c->coeff->model); c->d_coeff->model_free (c->d_coeff->model); - + c->domain_pool->model = rec_domain_model; c->d_domain_pool->model = rec_d_domain_model; c->coeff->model = rec_coeff_model; c->d_coeff->model = rec_d_coeff_model; c->tree = rec_tree_model; c->p_tree = rec_p_tree_model; - + range->prediction = NO; - + if (wfa->states != states) remove_states (states, wfa); restore_state_data (states, rec_states - 1, c->options.lc_max_level, rec_state_data, wfa, c); costs = MAXCOSTS; } - + return costs; -} +} void clear_norms_table (unsigned level, const wfa_info_t *wi, motion_t *mt) @@ -238,11 +238,11 @@ update_norms_table (unsigned level, const wfa_info_t *wi, motion_t *mt) unsigned range_size = wi->half_pixel ? square (wi->search_range) : square (2 * wi->search_range); - + if (level > wi->p_min_level) { unsigned index; /* index of motion vector */ - + for (index = 0; index < range_size; index++) mt->mc_forward_norms [level][index] += mt->mc_forward_norms [level - 1][index]; @@ -256,7 +256,7 @@ update_norms_table (unsigned level, const wfa_info_t *wi, motion_t *mt) /***************************************************************************** private code - + *****************************************************************************/ static real_t @@ -273,7 +273,7 @@ mc_prediction (real_t max_costs, real_t price, unsigned band, int y_state, * If we are at the bottom level of the mc tree: * Fill in the norms table */ - if (prange.level == wfa->wfainfo->p_min_level) + if (prange.level == wfa->wfainfo->p_min_level) fill_norms_table (prange.x, prange.y, prange.level, wfa->wfainfo, c->mt); /* * Predict 'range' with motion compensation according to frame type. @@ -283,19 +283,19 @@ mc_prediction (real_t max_costs, real_t price, unsigned band, int y_state, find_P_frame_mc (mcpe, price, &prange, wfa->wfainfo, c->mt); else find_B_frame_mc (mcpe, price, &prange, wfa->wfainfo, c->mt); - + costs = (prange.mv_tree_bits + prange.mv_coord_bits) * price; - + if (costs < max_costs) /* motion vector not too expensive */ { unsigned last_state; /* last WFA state before recursion */ real_t *ipi [MAXSTATES]; /* inner products pointers */ unsigned state; real_t mvt, mvc; - + c->pixels = Calloc (width * height, sizeof (real_t)); cut_to_bintree (c->pixels, mcpe, width, height, 0, 0, width, height); - + /* * Approximate MCPE recursively. */ @@ -310,7 +310,7 @@ mc_prediction (real_t max_costs, real_t price, unsigned band, int y_state, mvc = prange.mv_coord_bits; mvt = prange.mv_tree_bits; - + prange.image = 0; prange.address = 0; prange.tree_bits = 0; @@ -329,7 +329,7 @@ mc_prediction (real_t max_costs, real_t price, unsigned band, int y_state, if (costs < max_costs) /* use motion compensation */ { unsigned img, adr; /* temp. values */ - + img = range->image; adr = range->address; *range = prange; @@ -362,7 +362,7 @@ mc_prediction (real_t max_costs, real_t price, unsigned band, int y_state, } else costs = MAXCOSTS; - + Free (mcpe); return costs; @@ -374,7 +374,7 @@ nd_prediction (real_t max_costs, real_t price, unsigned band, int y_state, { real_t costs; /* current approximation costs */ range_t lrange = *range; - + /* * Predict 'range' with DC component approximation */ @@ -397,11 +397,11 @@ nd_prediction (real_t max_costs, real_t price, unsigned band, int y_state, lrange.weights_bits = c->coeff->bits (&w, s, range->level, c->coeff); } costs = price * (lrange.weights_bits + lrange.nd_tree_bits); - + /* - * Recursive aproximation of difference image + * Recursive approximation of difference image */ - if (costs < max_costs) + if (costs < max_costs) { unsigned state; range_t rrange; /* range: recursive subdivision */ @@ -418,14 +418,14 @@ nd_prediction (real_t max_costs, real_t price, unsigned band, int y_state, unsigned n; real_t *src, *dst; /* pointers to image data */ real_t w = - lrange.weight [0] * c->images_of_state [0][0]; - - src = c->pixels + range->address * size_of_level (range->level); + + src = c->pixels + range->address * size_of_level (range->level); dst = c->pixels = pixels = Calloc (width * height, sizeof (real_t)); for (n = width * height; n; n--) *dst++ = *src++ + w; } - + /* * Approximate difference recursively. */ @@ -448,13 +448,13 @@ nd_prediction (real_t max_costs, real_t price, unsigned band, int y_state, c->ip_images_state[state] = Calloc (size_of_tree (c->products_level), sizeof (real_t)); } - + compute_ip_images_state (rrange.image, rrange.address, rrange.level, 1, 0, wfa, c); - + costs += subdivide (max_costs - costs, band, y_state, &rrange, wfa, c, NO, YES); - + Free (pixels); if (costs < max_costs && ischild (rrange.tree)) /* use prediction */ @@ -469,7 +469,7 @@ nd_prediction (real_t max_costs, real_t price, unsigned band, int y_state, range->address = adr; range->nd_tree_bits += lrange.nd_tree_bits; range->nd_weights_bits += lrange.weights_bits; - + for (edge = 0; isedge (lrange.into [edge]); edge++) { range->into [edge] = lrange.into [edge]; @@ -485,7 +485,7 @@ nd_prediction (real_t max_costs, real_t price, unsigned band, int y_state, } else costs = MAXCOSTS; - + for (state = 0; state <= last_state; state++) if (need_image (state, wfa)) { @@ -515,9 +515,9 @@ store_state_data (unsigned from, unsigned to, unsigned max_level, if (to < from) return NULL; /* nothing to do */ - + data = Calloc (to - from + 1, sizeof (state_data_t)); - + for (state = from; state <= to; state++) { sd = &data [state - from]; @@ -527,12 +527,12 @@ store_state_data (unsigned from, unsigned to, unsigned max_level, sd->domain_type = wfa->domain_type [state]; sd->images_of_state = c->images_of_state [state]; sd->inner_products = c->ip_images_state [state]; - + wfa->domain_type [state] = 0; c->images_of_state [state] = NULL; c->ip_images_state [state] = NULL; - - for (label = 0; label < MAXLABELS; label++) + + for (label = 0; label < MAXLABELS; label++) { sd->tree [label] = wfa->tree [state][label]; sd->y_state [label] = wfa->y_state [state][label]; @@ -542,11 +542,11 @@ store_state_data (unsigned from, unsigned to, unsigned max_level, sd->y [label] = wfa->y [state][label]; sd->prediction [label] = wfa->prediction [state][label]; - memcpy (sd->weight [label], wfa->weight [state][label], + memcpy (sd->weight [label], wfa->weight [state][label], sizeof (real_t) * (MAXEDGES + 1)); - memcpy (sd->int_weight [label], wfa->int_weight [state][label], + memcpy (sd->int_weight [label], wfa->int_weight [state][label], sizeof (word_t) * (MAXEDGES + 1)); - memcpy (sd->into [label], wfa->into [state][label], + memcpy (sd->into [label], wfa->into [state][label], sizeof (word_t) * (MAXEDGES + 1)); wfa->into [state][label][0] = NO_EDGE; @@ -569,7 +569,7 @@ restore_state_data (unsigned from, unsigned to, unsigned max_level, state_data_t *data, wfa_t *wfa, coding_t *c) /* * Restore all state data starting from state 'from'. - * + * * No return value. */ { @@ -578,15 +578,15 @@ restore_state_data (unsigned from, unsigned to, unsigned max_level, if (to < from) return; /* nothing to do */ - + for (state = from; state <= to; state++) { sd = &data [state - from]; - + wfa->final_distribution [state] = sd->final_distribution; wfa->level_of_state [state] = sd->level_of_state; wfa->domain_type [state] = sd->domain_type; - + if (c->images_of_state [state] != NULL) Free (c->images_of_state [state]); c->images_of_state [state] = sd->images_of_state; @@ -603,14 +603,14 @@ restore_state_data (unsigned from, unsigned to, unsigned max_level, wfa->x [state][label] = sd->x [label]; wfa->y [state][label] = sd->y [label]; wfa->prediction [state][label] = sd->prediction [label]; - - memcpy (wfa->weight [state][label], sd->weight [label], + + memcpy (wfa->weight [state][label], sd->weight [label], sizeof(real_t) * (MAXEDGES + 1)); - memcpy (wfa->int_weight [state][label], sd->int_weight [label], + memcpy (wfa->int_weight [state][label], sd->int_weight [label], sizeof(word_t) * (MAXEDGES + 1)); - memcpy (wfa->into [state][label], sd->into [label], + memcpy (wfa->into [state][label], sd->into [label], sizeof(word_t) * (MAXEDGES + 1)); - } + } for (level = c->options.images_level + 1; level <= max_level; level++) { diff --git a/converter/other/fiasco/codec/subdivide.c b/converter/other/fiasco/codec/subdivide.c index 348f838a..3ddf1ffc 100644 --- a/converter/other/fiasco/codec/subdivide.c +++ b/converter/other/fiasco/codec/subdivide.c @@ -2,7 +2,7 @@ * subdivide.c: Recursive subdivision of range images * * Written by: Ullrich Hafner - * + * * This file is part of FIASCO (Fractal Image And Sequence COdec) * Copyright (C) 1994-2000 Ullrich Hafner */ @@ -56,10 +56,10 @@ init_range (range_t *range, const image_t *image, unsigned band, /***************************************************************************** public code - + *****************************************************************************/ -real_t +real_t subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, wfa_t *wfa, coding_t *c, bool_t prediction, bool_t delta) /* @@ -71,7 +71,7 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, * If 'prediction' is TRUE then also test motion compensation or * nondeterministic approximation. * If 'delta' is TRUE then current range is already predicted. - * + * * Return value: * costs of the best approximation or MAXCOSTS if costs exceed 'max_costs' * @@ -82,7 +82,7 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, */ { real_t subdivide_costs; /* Costs arising from approx. the current - range with two childs */ + range with two children */ real_t lincomb_costs; /* Costs arising from approx. the current range with a linear combination */ int new_y_state [MAXLABELS]; /* Corresponding state of Y */ @@ -91,7 +91,7 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, bool_t try_nd; /* YES: try ND prediction */ unsigned states; /* Number of states before the recursive subdivision starts */ - void *domain_model; /* copy of domain pool model */ + void *domain_model; /* copy of domain pool model */ void *d_domain_model; /* copy of delta domain pool model */ void *lc_domain_model; /* copy of domain pool model */ void *lc_d_domain_model; /* copy of delta domain pool model */ @@ -103,17 +103,17 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, tree_t p_tree_model; /* copy of pred. tree model */ range_t lrange; /* range of lin. comb. approx. */ range_t rrange; /* range of recursive approx. */ - range_t child [MAXLABELS]; /* new childs of the current range */ + range_t child [MAXLABELS]; /* new children of the current range */ static unsigned percent = 0; /* status of progress meter */ if (wfa->wfainfo->level == range->level) percent = 0; - + range->into [0] = NO_EDGE; /* default approximation: empty */ range->tree = RANGE; if (range->level < 3) /* Don't process small ranges */ - return MAXCOSTS; + return MAXCOSTS; /* * If image permutation (tiling) is performed and the tiling level @@ -123,7 +123,7 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, && range->level == wfa->wfainfo->level - c->tiling->exponent) { unsigned width, height; /* size of range (dummies)*/ - + if (c->tiling->vorder [range->global_address] < 0) return 0; /* nothing to do */ else @@ -140,7 +140,7 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, * Check whether prediction is allowed or not * mc == motion compensation, nd == nondeterminism */ - try_mc = (prediction && c->mt->frame_type != I_FRAME + try_mc = (prediction && c->mt->frame_type != I_FRAME && range->level >= wfa->wfainfo->p_min_level && range->level <= wfa->wfainfo->p_max_level && (range->x + width_of_level (range->level) @@ -155,21 +155,21 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, if (try_mc) clear_norms_table (range->level, wfa->wfainfo, c->mt); - + /* * Check if current range must be initialized. I.e. range pixels must * be copied from entire image to bintree pixel buffer. Moreover, * all inner products tables must be initialized. */ - if (range->level == c->options.lc_max_level) + if (range->level == c->options.lc_max_level) init_range (range, c->mt->original, band, wfa, c); - + price = c->price; - if (band != Y) + if (band != Y) price *= c->options.chroma_decrease; /* less quality for chroma bands */ /* - * Compute childs of corresponding state in Y band + * Compute children of corresponding state in Y band */ if (band != Y) /* Cb and Cr bands only */ { @@ -183,7 +183,7 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, } else new_y_state [0] = new_y_state [1] = RANGE; - + /* * Store contents of all models that may get modified during recursion */ @@ -193,8 +193,8 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, d_coeff_model = c->d_coeff->model_duplicate (c->d_coeff, c->d_coeff->model); tree_model = c->tree; p_tree_model = c->p_tree; - states = wfa->states; - + states = wfa->states; + /* * First alternative of range approximation: * Compute costs of linear combination. @@ -208,10 +208,10 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, lrange.weights_bits = 0; lrange.mv_tree_bits = try_mc ? 1 : 0; /* mc allowed but not used */ lrange.mv_coord_bits = 0; - lrange.nd_tree_bits = 0; - lrange.nd_weights_bits = 0; + lrange.nd_tree_bits = 0; + lrange.nd_weights_bits = 0; lrange.prediction = NO; - + lincomb_costs = approximate_range (max_costs, price, c->options.max_elements, y_state, &lrange, @@ -219,7 +219,7 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, (delta ? c->d_coeff : c->coeff), wfa, c); } else - lincomb_costs = MAXCOSTS; + lincomb_costs = MAXCOSTS; /* * Store contents of models that have been modified @@ -237,7 +237,7 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, c->coeff->model = c->coeff->model_duplicate (c->coeff, coeff_model); c->d_coeff->model = c->d_coeff->model_duplicate (c->d_coeff, d_coeff_model); - + /* * Second alternative of range approximation: * Compute costs of recursive subdivision. @@ -245,8 +245,8 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, if (range->level > c->options.lc_min_level) /* range is large enough */ { unsigned label; - - memset (&child [0], 0, 2 * sizeof (range_t)); /* initialize childs */ + + memset (&child [0], 0, 2 * sizeof (range_t)); /* initialize children */ /* * Initialize a new range for recursive approximation @@ -260,7 +260,7 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, rrange.mv_coord_bits = 0; rrange.nd_tree_bits = try_nd ? tree_bits (CHILD, lrange.level, &c->p_tree): 0; - rrange.nd_weights_bits = 0; + rrange.nd_weights_bits = 0; rrange.prediction = NO; /* @@ -271,11 +271,11 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, + rrange.matrix_bits + rrange.mv_tree_bits + rrange.mv_coord_bits + rrange.nd_tree_bits + rrange.nd_weights_bits) * price; - - for (label = 0; label < MAXLABELS; label++) + + for (label = 0; label < MAXLABELS; label++) { real_t remaining_costs; /* upper limit for next recursion */ - + child[label].image = rrange.image * MAXLABELS + label + 1; child[label].address = rrange.address * MAXLABELS + label; child[label].global_address = rrange.global_address * MAXLABELS @@ -289,8 +289,8 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, ? (rrange.y + label * height_of_level (rrange.level - 1)) : rrange.y; - - /* + + /* * If necessary compute the inner products of the new states * (generated during the recursive approximation of child [0]) */ @@ -298,7 +298,7 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, compute_ip_images_state (child[label].image, child[label].address, child[label].level, 1, states, wfa, c); /* - * Call subdivide() for both childs. + * Call subdivide() for both children. * Abort the recursion if 'subdivide_costs' exceed 'lincomb_costs' * or 'max_costs'. */ @@ -315,10 +315,10 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, fill_norms_table (child[label].x, child[label].y, child[label].level, wfa->wfainfo, c->mt); } - + if (try_mc) update_norms_table (rrange.level, wfa->wfainfo, c->mt); - + /* * Update of progress meter */ @@ -327,7 +327,7 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, if (c->options.progress_meter == FIASCO_PROGRESS_PERCENT) { unsigned new_percent; /* new status of progress meter */ - + new_percent = (child[label].global_address + 1) * 100.0 / (1 << (wfa->wfainfo->level - child[label].level)); if (new_percent > percent) @@ -339,7 +339,7 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, else if (c->options.progress_meter == FIASCO_PROGRESS_BAR) { unsigned new_percent; /* new status of progress meter */ - + new_percent = (child[label].global_address + 1) * 50.0 / (1 << (wfa->wfainfo->level - child[label].level)); @@ -349,15 +349,15 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, } } } - + /* - * If costs of subdivision exceed costs of linear combination + * If costs of subdivision exceed costs of linear combination * then abort recursion. */ - if (subdivide_costs >= MIN(lincomb_costs, max_costs)) + if (subdivide_costs >= MIN(lincomb_costs, max_costs)) { subdivide_costs = MAXCOSTS; - break; + break; } rrange.err += child [label].err; rrange.tree_bits += child [label].tree_bits; @@ -379,8 +379,8 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, /* * Third alternative of range approximation: - * Predict range via motion compensation or nondeterminism and - * approximate delta image. + * Predict range via motion compensation or nondeterminism and + * approximate delta image. */ if (try_mc || try_nd) /* try prediction */ { @@ -403,7 +403,7 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, c->d_coeff->model_free (d_coeff_model); c->coeff->model_free (lc_coeff_model); c->d_coeff->model_free (lc_d_coeff_model); - + return prediction_costs; } } @@ -423,25 +423,25 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, c->d_coeff->model_free (c->d_coeff->model); c->coeff->model_free (lc_coeff_model); c->d_coeff->model_free (lc_d_coeff_model); - + c->domain_pool->model = domain_model; c->d_domain_pool->model = d_domain_model; c->coeff->model = coeff_model; c->d_coeff->model = d_coeff_model; c->tree = tree_model; c->p_tree = p_tree_model; - + if (wfa->states != states) remove_states (states, wfa); return MAXCOSTS; } - else if (lincomb_costs < subdivide_costs) + else if (lincomb_costs < subdivide_costs) { /* * Use the linear combination: The factors of the linear combination * are stored already in 'range', so revert the probability models - * only. + * only. */ c->domain_pool->model_free (c->domain_pool->model); c->d_domain_pool->model_free (c->d_domain_pool->model); @@ -452,7 +452,7 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, c->d_coeff->model_free (c->d_coeff->model); c->coeff->model_free (coeff_model); c->d_coeff->model_free (d_coeff_model); - + c->domain_pool->model = lc_domain_model; c->d_domain_pool->model = lc_d_domain_model; c->coeff->model = lc_coeff_model; @@ -461,7 +461,7 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, c->p_tree = p_tree_model; *range = lrange; - + if (wfa->states != states) remove_states (states, wfa); @@ -474,8 +474,8 @@ subdivide (real_t max_costs, unsigned band, int y_state, range_t *range, * given in child[]. * Don't use state in linear combinations in any of the following cases: * - if color component is Cb or Cr - * - if level of state > tiling level - * - if state is (partially) outside image geometry + * - if level of state > tiling level + * - if state is (partially) outside image geometry */ if (band > Y || (c->tiling->exponent @@ -545,7 +545,7 @@ cut_to_bintree (real_t *dst, const word_t *src, /***************************************************************************** private code - + *****************************************************************************/ static void @@ -558,7 +558,7 @@ init_new_state (bool_t auxiliary_state, bool_t delta, range_t *range, * If flag 'delta' is set then state represents a delta image (prediction via * nondeterminism or motion compensation). * 'range' the current range image, - * 'child []' the left and right childs of 'range'. + * 'child []' the left and right children of 'range'. * * No return value. * @@ -583,11 +583,11 @@ init_new_state (bool_t auxiliary_state, bool_t delta, range_t *range, } else state_is_domain = NO; - + range->into [0] = NO_EDGE; range->tree = wfa->states; - - for (label = 0; label < MAXLABELS; label++) + + for (label = 0; label < MAXLABELS; label++) { wfa->tree [wfa->states][label] = child [label].tree; wfa->y_state [wfa->states][label] = y_state [label]; @@ -605,7 +605,7 @@ init_new_state (bool_t auxiliary_state, bool_t delta, range_t *range, warning ("Negative image norm: %f, %f", child [0].err, child [1].err); /* state_is_domain = YES; */ - + append_state (!state_is_domain, compute_final_distribution (wfa->states, wfa), range->level, wfa, c); @@ -621,13 +621,13 @@ init_range (range_t *range, const image_t *image, unsigned band, * No return value. * * Side effects: - * 'c->pixels' are filled with pixel values of image block - * 'c->ip_images_state' are computed with respect to new image block + * 'c->pixels' are filled with pixel values of image block + * 'c->ip_images_state' are computed with respect to new image block * 'range->address' and 'range->image' are initialized with zero */ { unsigned state; - + /* * Clear already computed products */ @@ -640,7 +640,7 @@ init_range (range_t *range, const image_t *image, unsigned band, image->width, image->height, range->x, range->y, width_of_level (range->level), height_of_level (range->level)); - + range->address = range->image = 0; compute_ip_images_state (0, 0, range->level, 1, 0, wfa, c); } diff --git a/converter/other/fiasco/codec/wfa.h b/converter/other/fiasco/codec/wfa.h index 59020fc1..4e66ccbd 100644 --- a/converter/other/fiasco/codec/wfa.h +++ b/converter/other/fiasco/codec/wfa.h @@ -2,7 +2,7 @@ * wfa.h * * Written by: Ullrich Hafner - * + * * This file is part of FIASCO (Fractal Image And Sequence COdec) * Copyright (C) 1994-2000 Ullrich Hafner */ @@ -20,7 +20,7 @@ #define MAXEDGES 5 #define MAXSTATES 6000 #define MAXLABELS 2 /* only bintree possible anymore */ -#define MAXLEVEL 22 +#define MAXLEVEL 22 #define FIASCO_BINFILE_RELEASE 2 #define FIASCO_MAGIC "FIASCO" /* FIASCO magic number */ @@ -85,7 +85,7 @@ typedef struct wfa_info char *basis_name; /* filename of the initial basis */ char *title; /* title of FIASCO stream */ char *comment; /* comment for FIASCO stream */ - + unsigned max_states; /* max. cardinality of domain pool */ unsigned chroma_max_states; /* max. cardinality of domain pool for chroma band coding */ @@ -111,7 +111,7 @@ typedef struct wfa_info typedef struct wfa /* - * Used to store all informations and data structures of a WFA + * Used to store all information and data structures of a WFA */ { wfa_info_t *wfainfo; /* misc. information about the WFA */ |