From a0c7df892cfd9c17bdd61d508b02250caf311519 Mon Sep 17 00:00:00 2001 From: Oliver Hertel Date: Wed, 4 Feb 2026 19:11:05 +0100 Subject: [PATCH 01/25] weighted wildcards: corrections after automated tests --- modules/styles.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/modules/styles.py b/modules/styles.py index 16bb0f9b5..072b03390 100644 --- a/modules/styles.py +++ b/modules/styles.py @@ -65,7 +65,7 @@ def select_from_weighted_list(inner: str) -> str: w = float(wstr.strip()) except Exception: w = 0.0 - w = max(0.0, min(1.0, w)) + w = max(0.0, w) weighted[name] = weighted.get(name, 0.0) + w else: unweighted.append(p) @@ -78,34 +78,32 @@ def select_from_weighted_list(inner: str) -> str: if not keys: return '' if W == 0.0: - return random.choice(keys) + return '' if abs(W - 1.0) > 1e-12: - for k in weighted: - weighted[k] = weighted[k] / W + weighted = {k: v / W for k, v in weighted.items()} else: # mix of weighted and unweighted - if W >= 1.0: # weighted probabilities consume whole mass -> normalize them, unweighted get 0 - for k in weighted: - weighted[k] = weighted[k] / W + if W > 1.0: # weighted probabilities consume whole mass -> normalize them, unweighted get 0 + for name in unweighted: + weighted[name] = weighted.get(name, 0.0) + 1.0 + total_before = sum(weighted.values()) + if total_before > 0.0: + weighted = {k: v / total_before for k, v in weighted.items()} else: remaining = 1.0 - W - per = remaining / U + per = remaining / U if U > 0 else 0.0 for name in unweighted: weighted[name] = weighted.get(name, 0.0) + per items = list(weighted.items()) if not items: return '' + total = sum(v for _, v in items) if total <= 0.0: return items[0][0] - r = random.random() * total - cum = 0.0 - for name, prob in items: - cum += prob - if r <= cum: - return name - return items[-1][0] + names, weights = zip(*items) + return random.choices(names, weights=weights, k=1)[0] def apply_curly_braces_to_prompt(prompt, seed=-1): From 2d6cc5addb0c6d62e1b55e4fdd50f3842cc3b4ba Mon Sep 17 00:00:00 2001 From: vladmandic Date: Thu, 5 Feb 2026 10:21:12 +0100 Subject: [PATCH 02/25] metadata restore to always-on scrips Signed-off-by: vladmandic --- CHANGELOG.md | 6 + cli/create-previews.py | 301 ------------------- cli/{download.py => download-file.py} | 0 cli/{clone.py => git-clone.py} | 0 cli/{install-sf.py => install-stablefast.py} | 0 cli/{docs.py => search-docs.py} | 14 +- modules/scripts_manager.py | 23 +- scripts/xyz_grid.py | 30 +- scripts/xyz_grid_on.py | 2 + 9 files changed, 46 insertions(+), 330 deletions(-) delete mode 100755 cli/create-previews.py rename cli/{download.py => download-file.py} (100%) mode change 100755 => 100644 rename cli/{clone.py => git-clone.py} (100%) mode change 100755 => 100644 rename cli/{install-sf.py => install-stablefast.py} (100%) mode change 100755 => 100644 rename cli/{docs.py => search-docs.py} (90%) mode change 100755 => 100644 diff --git a/CHANGELOG.md b/CHANGELOG.md index a56e32e33..168ca2ae4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log for SD.Next +## Update for 2026-02-05 + +Bugfix refresh +- metadata restore to always-on scripts +- wildcard weights parsing, thanks @Tillerz + ## Update for 2026-02-04 ### Highlights for 2026-02-04 diff --git a/cli/create-previews.py b/cli/create-previews.py deleted file mode 100755 index 25f266441..000000000 --- a/cli/create-previews.py +++ /dev/null @@ -1,301 +0,0 @@ -#!/usr/bin/env python -# pylint: disable=no-member -import os -import re -import json -import time -import logging -import importlib -import asyncio -import argparse -from pathlib import Path -from util import Map, log -from sdapi import get, post, close -from generate import generate # pylint: disable=import-error -grid = importlib.import_module('image-grid').grid - - -options = Map({ - # used by extra networks - 'prompt': 'photo of , photograph, posing, pose, high detailed, intricate, elegant, sharp focus, skin texture, looking forward, facing camera, 135mm, shot on dslr, canon 5d, 4k, modelshoot style, cinematic lighting', - # used by models - 'prompts': [ - ('photo citiscape', 'cityscape during night, photorealistic, high detailed, sharp focus, depth of field, 4k'), - ('photo car', 'photo of a sports car, high detailed, sharp focus, dslr, cinematic lighting, realistic'), - ('photo woman', 'portrait photo of beautiful woman, high detailed, dslr, 35mm'), - ('photo naked', 'full body photo of beautiful sexy naked woman, high detailed, dslr, 35mm'), - - ('photo taylor', 'portrait photo of beautiful woman taylor swift, high detailed, sharp focus, depth of field, dslr, 35mm '), - ('photo ti-mia', 'portrait photo of beautiful woman "ti-mia", naked, high detailed, dslr, 35mm'), - ('photo ti-vlado', 'portrait photo of man "ti-vlado", high detailed, dslr, 35mm'), - ('photo lora-vlado', 'portrait photo of man vlado, high detailed, dslr, 35mm '), - - ('wlop', 'a stunning portrait of sexy teen girl in a wet t-shirt, vivid color palette, digital painting, octane render, highly detailed, particles, light effect, volumetric lighting, art by wlop'), - ('greg rutkowski', 'beautiful woman, high detailed, sharp focus, depth of field, 4k, art by greg rutkowski'), - ('carne griffiths', 'beautiful woman taylor swift, high detailed, sharp focus, depth of field, art by carne griffiths '), - ('carne griffiths', 'man vlado, high detailed, sharp focus, depth of field, art by carne griffiths '), - ], - # save format - 'format': '.jpg', - # used by generate script - 'paths': { - "root": "/mnt/c/Users/mandi/OneDrive/Generative/Generate", - "generate": "image", - "upscale": "upscale", - "grid": "grid", - }, - # generate params - 'generate': { - 'detailer': True, - 'prompt': '', - 'negative_prompt': 'foggy, blurry, blurred, duplicate, ugly, mutilated, mutation, mutated, out of frame, bad anatomy, disfigured, deformed, censored, low res, low resolution, watermark, text, poorly drawn face, poorly drawn hands, signature', - 'steps': 20, - 'batch_size': 2, - 'n_iter': 1, - 'seed': -1, - 'sampler_name': 'UniPC', - 'cfg_scale': 6, - 'width': 512, - 'height': 512, - }, - 'lora': { - 'strength': 1.0, - }, -}) - - -def preview_exists(folder, model): - model = os.path.splitext(model)[0] - for suffix in ['', '.preview']: - for ext in ['.jpg', '.png', '.webp']: - fn = os.path.join(folder, f'{model}{suffix}{ext}') - if os.path.exists(fn): - return True - return False - - -async def preview_models(params): - data = await get('/sdapi/v1/sd-models') - allmodels = [m['title'] for m in data] - models = [] - excluded = [] - for m in allmodels: # loop through all registered models - ok = True - for e in params.exclude: # check if model is excluded - if e in m: - excluded.append(m) - ok = False - break - if ok: - short = m.split(' [')[0] - short = short.replace('.ckpt', '').replace('.safetensors', '') - models.append(short) - if len(params.input) > 0: # check if model is included in cmd line - filtered = [] - for m in params.input: - if m in models: - filtered.append(m) - else: - log.error({ 'model not found': m }) - return - models = filtered - log.info({ 'models preview' }) - log.info({ 'models': len(models), 'excluded': len(excluded) }) - opt = await get('/sdapi/v1/options') - log.info({ 'total jobs': len(models) * options.generate.batch_size, 'per-model': options.generate.batch_size }) - log.info(json.dumps(options, indent=2)) - for model in models: - if preview_exists(opt['ckpt_dir'], model) and len(params.input) == 0: # if model preview exists and not manually included - log.info({ 'model preview exists': model }) - continue - fn = os.path.join(opt['ckpt_dir'], os.path.splitext(model)[0] + options.format) - log.info({ 'model load': model }) - - opt['sd_model_checkpoint'] = model - del opt['sd_lora'] - del opt['sd_lyco'] - await post('/sdapi/v1/options', opt) - opt = await get('/sdapi/v1/options') - images = [] - labels = [] - t0 = time.time() - for label, p in options.prompts: - options.generate.prompt = p - log.info({ 'model generating': model, 'label': label, 'prompt': options.generate.prompt }) - data = await generate(options = options, quiet=True) - if 'image' in data: - for img in data['image']: - images.append(img) - labels.append(label) - else: - log.error({ 'model': model, 'error': data }) - t1 = time.time() - if len(images) == 0: - log.error({ 'model': model, 'error': 'no images generated' }) - continue - image = grid(images = images, labels = labels, border = 8) - log.info({ 'saving preview': fn, 'images': len(images), 'size': [image.width, image.height] }) - image.save(fn) - t = t1 - t0 - its = 1.0 * options.generate.steps * len(images) / t - log.info({ 'model preview created': model, 'image': fn, 'images': len(images), 'grid': [image.width, image.height], 'time': round(t, 2), 'its': round(its, 2) }) - - opt = await get('/sdapi/v1/options') - if opt['sd_model_checkpoint'] != params.model: - log.info({ 'model set default': params.model }) - opt['sd_model_checkpoint'] = params.model - del opt['sd_lora'] - del opt['sd_lyco'] - await post('/sdapi/v1/options', opt) - - -async def lora(params): - opt = await get('/sdapi/v1/options') - folder = opt['lora_dir'] - if not os.path.exists(folder): - log.error({ 'lora directory not found': folder }) - return - models1 = list(Path(folder).glob('**/*.safetensors')) - models2 = list(Path(folder).glob('**/*.ckpt')) - models = [os.path.splitext(f)[0] for f in models1 + models2] - log.info({ 'loras': len(models) }) - for model in models: - if preview_exists('', model) and len(params.input) == 0: # if model preview exists and not manually included - log.info({ 'lora preview exists': model }) - continue - fn = model + options.format - model = os.path.basename(model) - images = [] - labels = [] - t0 = time.time() - keywords = re.sub(r'\d', '', model) - keywords = keywords.replace('-v', ' ').replace('-', ' ').strip().split(' ') - keyword = '\"' + '\" \"'.join(keywords) + '\"' - options.generate.prompt = options.prompt.replace('', keyword) - options.generate.prompt = options.generate.prompt.replace('', '') - options.generate.prompt += f' ' - log.info({ 'lora generating': model, 'keyword': keyword, 'prompt': options.generate.prompt }) - data = await generate(options = options, quiet=True) - if 'image' in data: - for img in data['image']: - images.append(img) - labels.append(keyword) - else: - log.error({ 'lora': model, 'keyword': keyword, 'error': data }) - t1 = time.time() - if len(images) == 0: - log.error({ 'model': model, 'error': 'no images generated' }) - continue - image = grid(images = images, labels = labels, border = 8) - log.info({ 'saving preview': fn, 'images': len(images), 'size': [image.width, image.height] }) - image.save(fn) - t = t1 - t0 - its = 1.0 * options.generate.steps * len(images) / t - log.info({ 'lora preview created': model, 'image': fn, 'images': len(images), 'grid': [image.width, image.height], 'time': round(t, 2), 'its': round(its, 2) }) - - -async def lyco(params): - opt = await get('/sdapi/v1/options') - folder = opt['lyco_dir'] - if not os.path.exists(folder): - log.error({ 'lyco directory not found': folder }) - return - models1 = list(Path(folder).glob('**/*.safetensors')) - models2 = list(Path(folder).glob('**/*.ckpt')) - models = [os.path.splitext(f)[0] for f in models1 + models2] - log.info({ 'lycos': len(models) }) - for model in models: - if preview_exists('', model) and len(params.input) == 0: # if model preview exists and not manually included - log.info({ 'lyco preview exists': model }) - continue - fn = model + options.format - model = os.path.basename(model) - images = [] - labels = [] - t0 = time.time() - keywords = re.sub(r'\d', '', model) - keywords = keywords.replace('-v', ' ').replace('-', ' ').strip().split(' ') - keyword = '\"' + '\" \"'.join(keywords) + '\"' - options.generate.prompt = options.prompt.replace('', keyword) - options.generate.prompt = options.generate.prompt.replace('', '') - options.generate.prompt += f' ' - log.info({ 'lyco generating': model, 'keyword': keyword, 'prompt': options.generate.prompt }) - data = await generate(options = options, quiet=True) - if 'image' in data: - for img in data['image']: - images.append(img) - labels.append(keyword) - else: - log.error({ 'lyco': model, 'keyword': keyword, 'error': data }) - t1 = time.time() - if len(images) == 0: - log.error({ 'model': model, 'error': 'no images generated' }) - continue - image = grid(images = images, labels = labels, border = 8) - log.info({ 'saving preview': fn, 'images': len(images), 'size': [image.width, image.height] }) - image.save(fn) - t = t1 - t0 - its = 1.0 * options.generate.steps * len(images) / t - log.info({ 'lyco preview created': model, 'image': fn, 'images': len(images), 'grid': [image.width, image.height], 'time': round(t, 2), 'its': round(its, 2) }) - - -async def embedding(params): - opt = await get('/sdapi/v1/options') - folder = opt['embeddings_dir'] - if not os.path.exists(folder): - log.error({ 'embeddings directory not found': folder }) - return - models = [os.path.splitext(f)[0] for f in Path(folder).glob('**/*.pt')] - log.info({ 'embeddings': len(models) }) - for model in models: - if preview_exists(folder, model) and len(params.input) == 0: # if model preview exists and not manually included - log.info({ 'embedding preview exists': model }) - continue - fn = os.path.join(folder, model + '.preview' + options.format) - images = [] - labels = [] - t0 = time.time() - keyword = '\"' + re.sub(r'\d', '', model) + '\"' - options.generate.batch_size = 4 - options.generate.prompt = options.prompt.replace('', keyword) - options.generate.prompt = options.generate.prompt.replace('', '') - log.info({ 'embedding generating': model, 'keyword': keyword, 'prompt': options.generate.prompt }) - data = await generate(options = options, quiet=True) - if 'image' in data: - for img in data['image']: - images.append(img) - labels.append(keyword) - else: - log.error({ 'embeding': model, 'keyword': keyword, 'error': data }) - t1 = time.time() - if len(images) == 0: - log.error({ 'model': model, 'error': 'no images generated' }) - continue - image = grid(images = images, labels = labels, border = 8) - log.info({ 'saving preview': fn, 'images': len(images), 'size': [image.width, image.height] }) - image.save(fn) - t = t1 - t0 - its = 1.0 * options.generate.steps * len(images) / t - log.info({ 'embeding preview created': model, 'image': fn, 'images': len(images), 'grid': [image.width, image.height], 'time': round(t, 2), 'its': round(its, 2) }) - - -async def create_previews(params): - await preview_models(params) - await lora(params) - await lyco(params) - await embedding(params) - await close() - - -if __name__ == '__main__': - parser = argparse.ArgumentParser(description = 'generate model previews') - parser.add_argument('--model', default='best/icbinp-icantbelieveIts-final.safetensors [73f48afbdc]', help="model used to create extra network previews") - parser.add_argument('--exclude', default=['sd-v20', 'sd-v21', 'inpainting', 'pix2pix'], help="exclude models with keywords") - parser.add_argument('--debug', default = False, action='store_true', help = 'print extra debug information') - parser.add_argument('input', type = str, nargs = '*') - args = parser.parse_args() - if args.debug: - log.setLevel(logging.DEBUG) - log.debug({ 'debug': True }) - log.debug({ 'args': args.__dict__ }) - asyncio.run(create_previews(args)) diff --git a/cli/download.py b/cli/download-file.py old mode 100755 new mode 100644 similarity index 100% rename from cli/download.py rename to cli/download-file.py diff --git a/cli/clone.py b/cli/git-clone.py old mode 100755 new mode 100644 similarity index 100% rename from cli/clone.py rename to cli/git-clone.py diff --git a/cli/install-sf.py b/cli/install-stablefast.py old mode 100755 new mode 100644 similarity index 100% rename from cli/install-sf.py rename to cli/install-stablefast.py diff --git a/cli/docs.py b/cli/search-docs.py old mode 100755 new mode 100644 similarity index 90% rename from cli/docs.py rename to cli/search-docs.py index 11200d206..ef6661ba2 --- a/cli/docs.py +++ b/cli/search-docs.py @@ -89,7 +89,7 @@ class Page(): return '' def __str__(self): - return f'Page(title="{self.title.strip()}" fn="{self.fn}" mtime={self.mtime} h1={[h.strip() for h in self.h1]} h2={len(self.h2)} h3={len(self.h3)} lines={len(self.lines)} size={self.size})' + return f'Page(title="{self.title.strip()}" file="{self.fn}" mtime={self.mtime} h1={[h.strip() for h in self.h1]} h2={len(self.h2)} h3={len(self.h3)} lines={len(self.lines)} size={self.size})' class Pages(): @@ -129,16 +129,14 @@ if __name__ == "__main__": sys.argv.pop(0) if len(sys.argv) < 1: log.error("Usage: python cli/docs.py ") - text = ' '.join(sys.argv) - topk = 10 - full = True - log.info(f'Search: "{text}" topk={topk}, full={full}') + term = ' '.join(sys.argv) + log.info(f'Search: "{term}" topk=10, full=True') t0 = time.time() - results = index.search(text, topk=topk, full=full) + results = index.search(term, topk=10, full=True) t1 = time.time() log.info(f'Results: pages={len(results)} size={index.size} time={t1-t0:.3f}') - for score, page in results: - log.info(f'Score: {score:.2f} {page}') + for _score, _page in results: + log.info(f'Score: {_score:.2f} {_page}') # if len(results) > 0: # log.info('Top result:') # log.info(results[0][1].get()) diff --git a/modules/scripts_manager.py b/modules/scripts_manager.py index 1fbe6e630..3ded208db 100644 --- a/modules/scripts_manager.py +++ b/modules/scripts_manager.py @@ -336,6 +336,7 @@ class ScriptRunner: self.alwayson_scripts = [] self.auto_processing_scripts = [] self.titles = [] + self.alwayson_titles = [] self.infotext_fields = [] self.paste_field_names = [] self.script_load_ctr = 0 @@ -376,6 +377,7 @@ class ScriptRunner: self.selectable_scripts.clear() self.alwayson_scripts.clear() self.titles.clear() + self.alwayson_titles.clear() self.infotext_fields.clear() self.paste_field_names.clear() self.script_load_ctr = 0 @@ -405,6 +407,7 @@ class ScriptRunner: def setup_ui(self, parent='unknown', accordion=True): import modules.api.models as api_models self.titles = [wrap_call(script.title, script.filename, "title") or f"{script.filename} [error]" for script in self.selectable_scripts] + self.alwayson_titles = [wrap_call(script.title, script.filename, "title") or f"{script.filename} [error]" for script in self.alwayson_scripts] inputs = [] inputs_alwayson = [True] @@ -501,7 +504,7 @@ class ScriptRunner: if title == 'None': # called when an initial value is set from ui-config.json to show script's UI components return if title not in self.titles: - errors.log.error(f'Script not found: {title}') + errors.log.error(f'Script: title="{title}" op=init not found') return script_index = self.titles.index(title) self.selectable_scripts[script_index].group.visible = True @@ -511,12 +514,18 @@ class ScriptRunner: def onload_script_visibility(params): title = params.get('Script', None) - if title: + if title and title in self.titles: title_index = self.titles.index(title) visibility = title_index == self.script_load_ctr self.script_load_ctr = (self.script_load_ctr + 1) % len(self.titles) return gr.update(visible=visibility) + elif title and title in self.alwayson_titles: + title_index = self.alwayson_titles.index(title) + visibility = title_index == self.script_load_ctr + self.script_load_ctr = (self.script_load_ctr + 1) % len(self.titles) + return gr.update(visible=visibility) else: + errors.log.warning(f'Script: title="{title}" op=visibility not found') return gr.update(visible=False) self.infotext_fields.append((dropdown, lambda x: gr.update(value=x.get('Script', 'None')))) @@ -526,9 +535,11 @@ class ScriptRunner: def run(self, p, *args): s = ScriptSummary('run') script_index = args[0] if len(args) > 0 else 0 - if script_index == 0: + if (script_index is None) or (script_index == 0): return None - script = self.selectable_scripts[script_index-1] + script = self.selectable_scripts[script_index - 1] + if script is None: + script = self.alwayson_scripts[script_index - 1] if script is None: return None if 'upscale' in script.title(): @@ -549,9 +560,9 @@ class ScriptRunner: def after(self, p, processed, *args): s = ScriptSummary('after') script_index = args[0] if len(args) > 0 else 0 - if script_index == 0: + if (script_index is None) or (script_index == 0): return processed - script = self.selectable_scripts[script_index-1] + script = self.selectable_scripts[script_index - 1] if script is None or not hasattr(script, 'after'): return processed parsed = [] diff --git a/scripts/xyz_grid.py b/scripts/xyz_grid.py index 1bd51d232..a518657b0 100644 --- a/scripts/xyz_grid.py +++ b/scripts/xyz_grid.py @@ -25,7 +25,7 @@ class Script(scripts_manager.Script): current_axis_options = [] def title(self): - return "XYZ Grid" + return "XYZ Grid Script" def ui(self, is_img2img): self.current_axis_options = [x for x in axis_options if type(x) == AxisOption or x.is_img2img == is_img2img] @@ -135,14 +135,14 @@ class Script(scripts_manager.Script): return gr.update(value = valslist) self.infotext_fields = ( - (x_type, "X Type"), - (x_values, "X Values"), + (x_type, "X Script Type"), + (x_values, "X Script Values"), (x_values_dropdown, lambda params:get_dropdown_update_from_params("X",params)), - (y_type, "Y Type"), - (y_values, "Y Values"), + (y_type, "Y Script Type"), + (y_values, "Y Script Values"), (y_values_dropdown, lambda params:get_dropdown_update_from_params("Y",params)), - (z_type, "Z Type"), - (z_values, "Z Values"), + (z_type, "Z Script Type"), + (z_values, "Z Script Values"), (z_values_dropdown, lambda params:get_dropdown_update_from_params("Z",params)), ) @@ -334,21 +334,21 @@ class Script(scripts_manager.Script): pc.extra_generation_params = copy(pc.extra_generation_params) pc.extra_generation_params['Script'] = self.title() if x_opt.label != 'Nothing': - pc.extra_generation_params["X Type"] = x_opt.label - pc.extra_generation_params["X Values"] = x_values + pc.extra_generation_params["X Script Type"] = x_opt.label + pc.extra_generation_params["X Script Values"] = x_values if x_opt.label in ["[Param] Seed", "[Param] Variation seed"] and not no_fixed_seeds: - pc.extra_generation_params["Fixed X Values"] = ", ".join([str(x) for x in xs]) + pc.extra_generation_params["Fixed X Script Values"] = ", ".join([str(x) for x in xs]) if y_opt.label != 'Nothing': - pc.extra_generation_params["Y Type"] = y_opt.label - pc.extra_generation_params["Y Values"] = y_values + pc.extra_generation_params["Y Script Type"] = y_opt.label + pc.extra_generation_params["Y Script Values"] = y_values if y_opt.label in ["[Param] Seed", "[Param] Variation seed"] and not no_fixed_seeds: - pc.extra_generation_params["Fixed Y Values"] = ", ".join([str(y) for y in ys]) + pc.extra_generation_params["Fixed Y Script Values"] = ", ".join([str(y) for y in ys]) grid_infotext[subgrid_index] = processing.create_infotext(pc, pc.all_prompts, pc.all_seeds, pc.all_subseeds, grid=f'{len(xs)}x{len(ys)}') if grid_infotext[0] is None and ix == 0 and iy == 0 and iz == 0: # Sets main grid infotext pc.extra_generation_params = copy(pc.extra_generation_params) if z_opt.label != 'Nothing': - pc.extra_generation_params["Z Type"] = z_opt.label - pc.extra_generation_params["Z Values"] = z_values + pc.extra_generation_params["Z Script Type"] = z_opt.label + pc.extra_generation_params["Z Script Values"] = z_values if z_opt.label in ["[Param] Seed", "[Param] Variation seed"] and not no_fixed_seeds: pc.extra_generation_params["Fixed Z Values"] = ", ".join([str(z) for z in zs]) grid_text = f'{len(zs)}x{len(xs)}x{len(ys)}' if len(zs) > 0 else f'{len(xs)}x{len(ys)}' diff --git a/scripts/xyz_grid_on.py b/scripts/xyz_grid_on.py index 99bc89fa3..6e4c245f2 100644 --- a/scripts/xyz_grid_on.py +++ b/scripts/xyz_grid_on.py @@ -141,6 +141,7 @@ class Script(scripts_manager.Script): return gr.update(value = valslist) self.infotext_fields = ( + (enabled, "XYZ Grid Enabled"), (x_type, "X Type"), (x_values, "X Values"), (x_values_dropdown, lambda params:get_dropdown_update_from_params("X",params)), @@ -357,6 +358,7 @@ class Script(scripts_manager.Script): if ix == 0 and iy == 0: # create subgrid info text pc.extra_generation_params = copy(pc.extra_generation_params) pc.extra_generation_params['Script'] = self.title() + pc.extra_generation_params['XYZ Grid Enabled'] = enabled if x_opt.label != 'Nothing': pc.extra_generation_params["X Type"] = x_opt.label pc.extra_generation_params["X Values"] = x_values From 5009b70ed83322078b4875fd2c707192e25ab188 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Thu, 5 Feb 2026 10:25:58 +0100 Subject: [PATCH 03/25] fix anima model detection Signed-off-by: vladmandic --- CHANGELOG.md | 6 ++++-- modules/sd_detect.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 168ca2ae4..445433ffe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,10 @@ ## Update for 2026-02-05 Bugfix refresh -- metadata restore to always-on scripts -- wildcard weights parsing, thanks @Tillerz + +- add metadata restore to always-on scripts +- improve wildcard weights parsing, thanks @Tillerz +- fix `anima` model detection ## Update for 2026-02-04 diff --git a/modules/sd_detect.py b/modules/sd_detect.py index 440b79a44..a6de43d4e 100644 --- a/modules/sd_detect.py +++ b/modules/sd_detect.py @@ -103,7 +103,7 @@ def guess_by_name(fn, current_guess): new_guess = 'FLUX' elif 'flex.2' in fn.lower(): new_guess = 'FLEX' - elif 'anima' in fn.lower() and 'animat' not in fn.lower(): + elif fn.lower().strip().endswith('anima'): new_guess = 'Anima' elif 'cosmos-predict2' in fn.lower(): new_guess = 'Cosmos' From 605d87cb2dc2a8f634fb7f1cf2934729a6f4c55c Mon Sep 17 00:00:00 2001 From: vladmandic Date: Thu, 5 Feb 2026 10:33:42 +0100 Subject: [PATCH 04/25] reorg cli Signed-off-by: vladmandic --- CHANGELOG.md | 1 + cli/{random.json => generate-random.json} | 0 cli/generate.py | 2 +- cli/process.py | 4 ++-- cli/{options.py => process_options.py} | 0 5 files changed, 4 insertions(+), 3 deletions(-) rename cli/{random.json => generate-random.json} (100%) rename cli/{options.py => process_options.py} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 445433ffe..5f3c72d27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Bugfix refresh - add metadata restore to always-on scripts - improve wildcard weights parsing, thanks @Tillerz - fix `anima` model detection +- reorganize `cli` scripts ## Update for 2026-02-04 diff --git a/cli/random.json b/cli/generate-random.json similarity index 100% rename from cli/random.json rename to cli/generate-random.json diff --git a/cli/generate.py b/cli/generate.py index 9b784373a..1e533adc3 100755 --- a/cli/generate.py +++ b/cli/generate.py @@ -221,7 +221,7 @@ def args(): # parse cmd arguments global random # pylint: disable=global-statement parser = argparse.ArgumentParser(description = 'sd pipeline') parser.add_argument('--config', type = str, default = 'generate.json', required = False, help = 'configuration file') - parser.add_argument('--random', type = str, default = 'random.json', required = False, help = 'prompt file with randomized sections') + parser.add_argument('--random', type = str, default = 'generate-random.json', required = False, help = 'prompt file with randomized sections') parser.add_argument('--max', type = int, default = 1, required = False, help = 'maximum number of generated images') parser.add_argument('--prompt', type = str, default = 'dynamic', required = False, help = 'prompt') parser.add_argument('--negative', type = str, default = 'dynamic', required = False, help = 'negative prompt') diff --git a/cli/process.py b/cli/process.py index 0ad9a6347..cdeff0848 100644 --- a/cli/process.py +++ b/cli/process.py @@ -12,7 +12,7 @@ from scipy.stats import beta import util import sdapi -import options +import process_options as options face_model = None body_model = None @@ -42,7 +42,7 @@ def detect_blur(image: Image): cx, cy = image.size[0] // 2, image.size[1] // 2 fft = np.fft.fft2(bw) fftShift = np.fft.fftshift(fft) - fftShift[cy - options.process.blur_samplesize: cy + options.process.blur_samplesize, cx - options.process.blur_samplesize: cx + options.process.blur_samplesize] = 0 + fftShift[cy - options.process.blur_samplesize: cy + options.process.blur_samplesize, cx - options.process.blur_samplesize: cx + options.process.blur_samplesize] = 0 # pylint: disable=unsupported-assignment-operation fftShift = np.fft.ifftshift(fftShift) recon = np.fft.ifft2(fftShift) magnitude = np.log(np.abs(recon)) diff --git a/cli/options.py b/cli/process_options.py similarity index 100% rename from cli/options.py rename to cli/process_options.py From 59654d68ea2622801c614dddfed6a68cd85557fd Mon Sep 17 00:00:00 2001 From: vladmandic Date: Thu, 5 Feb 2026 11:21:17 +0100 Subject: [PATCH 05/25] add hqx and icb interpolations Signed-off-by: vladmandic --- CHANGELOG.md | 9 +- TODO.md | 6 - modules/postprocess/hqx.py | 7724 +++++++++++++++++++++++++++++++++++ modules/postprocess/icbi.py | 225 + modules/upscaler_algo.py | 116 + modules/upscaler_simple.py | 157 - modules/upscaler_vae.py | 87 + webui.py | 2 + 8 files changed, 8159 insertions(+), 167 deletions(-) create mode 100644 modules/postprocess/hqx.py create mode 100644 modules/postprocess/icbi.py create mode 100644 modules/upscaler_algo.py create mode 100644 modules/upscaler_vae.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f3c72d27..9a3739845 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,11 @@ Bugfix refresh -- add metadata restore to always-on scripts -- improve wildcard weights parsing, thanks @Tillerz -- fix `anima` model detection -- reorganize `cli` scripts +- add metadata restore to always-on scripts +- improve wildcard weights parsing, thanks @Tillerz +- fix `anima` model detection +- reorganize `cli` scripts +- upscalers: hqx, icbi ## Update for 2026-02-04 diff --git a/TODO.md b/TODO.md index 2cb6503ff..c754f50ed 100644 --- a/TODO.md +++ b/TODO.md @@ -41,12 +41,6 @@ TODO: Investigate which models are diffusers-compatible and prioritize! -### Upscalers - -- [HQX](https://github.com/uier/py-hqx/blob/main/hqx.py) -- [DCCI](https://every-algorithm.github.io/2024/11/06/directional_cubic_convolution_interpolation.html) -- [ICBI](https://github.com/gyfastas/ICBI/blob/master/icbi.py) - ### Image-Base - [Chroma Zeta](https://huggingface.co/lodestones/Zeta-Chroma): Image and video generator for creative effects and professional filters - [Chroma Radiance](https://huggingface.co/lodestones/Chroma1-Radiance): Pixel-space model eliminating VAE artifacts for high visual fidelity diff --git a/modules/postprocess/hqx.py b/modules/postprocess/hqx.py new file mode 100644 index 000000000..44aa93ed1 --- /dev/null +++ b/modules/postprocess/hqx.py @@ -0,0 +1,7724 @@ +# pylint: disable=superfluous-parens + +import cv2 +import numpy as np + +MASK_2 = 0x00FF00 +MASK_13 = 0xFF00FF + +Ymask = 0x00FF0000 +Umask = 0x0000FF00 +Vmask = 0x000000FF + +trY = 0x00300000 +trU = 0x00000700 +trV = 0x00000006 + + +def RGBtoYUV(c): + r = (c & 0xFF0000) >> 16 + g = (c & 0x00FF00) >> 8 + b = (c & 0x0000FF) + ret = (int(0.299*r + 0.587*g + 0.114*b) << 16) + (int((-0.169*r - 0.331*g + 0.5*b) + 128) << 8) + (int((0.5*r - 0.419*g - 0.081*b) + 128)) + return ret + + +def Diff(w1, w2): + # Mask against RGBMASK to discard the alpha channel + YUV1 = RGBtoYUV(w1) + YUV2 = RGBtoYUV(w2) + return ((abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) or ( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) or ( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV )) + + +def Interp1( pc, c1, c2, dest ): + # pc = (c1*3+c2) >> 2 + if c1 == c2: + dest[pc] = c1 + return + dest[pc] = ((((c1 & MASK_2) * 3 + (c2 & MASK_2)) >> 2) & MASK_2) + ((((c1 & MASK_13) * 3 + (c2 & MASK_13)) >> 2) & MASK_13) + dest[pc] |= (c1 & 0xFF000000) + + +def Interp2( pc, c1, c2, c3, dest ): + # pc = (c1*2+c2+c3) >> 2 + dest[pc] = (((((c1 & MASK_2) << 1) + (c2 & MASK_2) + (c3 & MASK_2)) >> 2) & MASK_2) + (((((c1 & MASK_13) << 1) + (c2 & MASK_13) + (c3 & MASK_13)) >> 2) & MASK_13) + dest[pc] |= (c1 & 0xFF000000) + + +def Interp3( pc, c1, c2, dest ): + # pc = (c1*7+c2)/8 + if c1 == c2: + dest[pc] = c1 + return + dest[pc] = ((((c1 & MASK_2) * 7 + (c2 & MASK_2)) >> 3) & MASK_2) + ((((c1 & MASK_13) * 7 + (c2 & MASK_13)) >> 3) & MASK_13) + dest[pc] |= (c1 & 0xFF000000) + + +def Interp4( pc, c1, c2, c3, dest ): + # pc = (c1*2+(c2+c3)*7)/16 + dest[pc] = (((((c1 & MASK_2) << 1) + (c2 & MASK_2) * 7 + (c3 & MASK_2) * 7) >> 4) & MASK_2) + (((((c1 & MASK_13) << 1) + (c2 & MASK_13) * 7 + (c3 & MASK_13) * 7) >> 4) & MASK_13) + dest[pc] |= (c1 & 0xFF000000) + + +def Interp5( pc, c1, c2, dest ): + # pc = (c1+c2) >> 1 + if c1 == c2: + dest[pc] = c1 + return + dest[pc] = ((((c1 & MASK_2) + (c2 & MASK_2)) >> 1) & MASK_2) + ((((c1 & MASK_13) + (c2 & MASK_13)) >> 1) & MASK_13) + dest[pc] |= (c1 & 0xFF000000) + + +def Interp6( pc, c1, c2, c3, dest ): + # pc = (c1*5+c2*2+c3)/8 + dest[pc] = ((((c1 & MASK_2) * 5 + ((c2 & MASK_2) << 1) + (c3 & MASK_2)) >> 3) & MASK_2) + ((((c1 & MASK_13) * 5 + ((c2 & MASK_13) << 1) + (c3 & MASK_13)) >> 3) & MASK_13) + dest[pc] |= (c1 & 0xFF000000) + + +def Interp7( pc, c1, c2, c3, dest ): + # pc = (c1*6+c2+c3)/8 + dest[pc] = ((((c1 & MASK_2) * 6 + (c2 & MASK_2) + (c3 & MASK_2)) >> 3) & MASK_2) + ((((c1 & MASK_13) * 6 + (c2 & MASK_13) + (c3 & MASK_13)) >> 3) & MASK_13) + dest[pc] |= (c1 & 0xFF000000) + + +def Interp8( pc, c1, c2, dest ): + # pc = (c1*5+c2*3)/8 + if c1 == c2: + dest[pc] = c1 + return + dest[pc] = ((((c1 & MASK_2) * 5 + (c2 & MASK_2) * 3) >> 3) & MASK_2) + ((((c1 & MASK_13) * 5 + (c2 & MASK_13) * 3) >> 3) & MASK_13) + dest[pc] |= (c1 & 0xFF000000) + + +def Interp9( pc, c1, c2, c3, dest ): + # pc = (c1*2+(c2+c3)*3)/8 + dest[pc] = (((((c1 & MASK_2) << 1) + (c2 & MASK_2) * 3 + (c3 & MASK_2) * 3) >> 3) & MASK_2) + (((((c1 & MASK_13) << 1) + (c2 & MASK_13) * 3 + (c3 & MASK_13) * 3) >> 3) & MASK_13) + dest[pc] |= (c1 & 0xFF000000) + + +def Interp10( pc, c1, c2, c3, dest ): + # pc = (c1*14+c2+c3)/16 + dest[pc] = ((((c1 & MASK_2) * 14 + (c2 & MASK_2) + (c3 & MASK_2)) >> 4) & MASK_2) + ((((c1 & MASK_13) * 14 + (c2 & MASK_13) + (c3 & MASK_13)) >> 4) & MASK_13) + dest[pc] |= (c1 & 0xFF000000) + + +def hqx( img: cv2.Mat, scale_factor: int ) -> cv2.Mat: + # We can only scale with a factor of 2, 3 or 4 + if scale_factor not in [2, 3, 4]: + return img + + height, width = img.shape[0], img.shape[1] + + # pack RGB colors into integers + src = [] + dest = [None] * (height * width * scale_factor * scale_factor) + for row in range(height): + for col in range(width): + b, g, r = img[row][col] + src.append((r << 16) + (g << 8) + b) + + if scale_factor == 2: + hq2x( width, height, src, dest ) + elif scale_factor == 3: + hq3x( width, height, src, dest ) + elif scale_factor == 4: + hq4x( width, height, src, dest ) + + scaled_img = np.zeros((height * scale_factor, width * scale_factor, 3)) + cnt = 0 + for row in range(scaled_img.shape[0]): + for col in range(scaled_img.shape[1]): + pc = dest[cnt] + r, g, b = (pc & 0x00FF0000) >> 16, (pc & 0x0000FF00) >> 8, (pc & 0x000000FF) + scaled_img[row][col] = [b, g, r] + cnt += 1 + + return scaled_img + + +def hq2x( width: int, height: int, src, dest ) -> None: # noqa:C901 + w = [None] * 10 + dpL = width << 1 + dp = 0 + sp = 0 + + # +----+----+----+ + # | | | | + # | w1 | w2 | w3 | + # +----+----+----+ + # | | | | + # | w4 | w5 | w6 | + # +----+----+----+ + # | | | | + # | w7 | w8 | w9 | + # +----+----+----+ + + for j in range(height): + prevline = -width if j > 0 else 0 + nextline = width if j < height - 1 else 0 + + for i in range(width): + w[2] = src[sp + prevline] + w[5] = src[sp] + w[8] = src[sp + nextline] + + if i > 0: + w[1] = src[sp + prevline - 1] + w[4] = src[sp - 1] + w[7] = src[sp + nextline - 1] + else: + w[1] = w[2] + w[4] = w[5] + w[7] = w[8] + + if i < width - 1: + w[3] = src[sp + prevline + 1] + w[6] = src[sp + 1] + w[9] = src[sp + nextline + 1] + else: + w[3] = w[2] + w[6] = w[5] + w[9] = w[8] + + pattern = 0 + flag = 1 + + YUV1 = RGBtoYUV(w[5]) + + for k in range(1, 10): + if k == 5: + continue + + if w[k] != w[5]: + YUV2 = RGBtoYUV(w[k]) + if ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) or ( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) or ( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) ): + pattern |= flag + flag <<= 1 + + match pattern: + case 0|1|4|32|128|5|132|160|33|129|36|133|164|161|37|165: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 2|34|130|162: + Interp2(dp, w[5], w[1], w[4], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 16|17|48|49: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 64|65|68|69: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 8|12|136|140: + Interp2(dp, w[5], w[1], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 3|35|131|163: + Interp1(dp, w[5], w[4], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 6|38|134|166: + Interp2(dp, w[5], w[1], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 20|21|52|53: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 144|145|176|177: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 192|193|196|197: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 96|97|100|101: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 40|44|168|172: + Interp2(dp, w[5], w[1], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 9|13|137|141: + Interp1(dp, w[5], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 18|50: + Interp2(dp, w[5], w[1], w[4], dest) + if (Diff(w[2], w[6])): + Interp1(dp+1, w[5], w[3], dest) + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 80|81: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL+1, w[5], w[9], dest) + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 72|76: + Interp2(dp, w[5], w[1], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+dpL, w[5], w[7], dest) + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 10|138: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[4], dest) + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 66: + Interp2(dp, w[5], w[1], w[4], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 24: + Interp2(dp, w[5], w[1], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 7|39|135: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 148|149|180: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 224|228|225: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 41|169|45: + Interp1(dp, w[5], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 22|54: + Interp2(dp, w[5], w[1], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 208|209: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 104|108: + Interp2(dp, w[5], w[1], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 11|139: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 19|51: + if (Diff(w[2], w[6])): + Interp1(dp, w[5], w[4], dest) + Interp1(dp+1, w[5], w[3], dest) + else: + Interp6(dp, w[5], w[2], w[4], dest) + Interp9(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 146|178: + Interp2(dp, w[5], w[1], w[4], dest) + if (Diff(w[2], w[6])): + Interp1(dp+1, w[5], w[3], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + else: + Interp9(dp+1, w[5], w[2], w[6], dest) + Interp6(dp+dpL+1, w[5], w[6], w[8], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + case 84|85: + Interp2(dp, w[5], w[4], w[2], dest) + if (Diff(w[6], w[8])): + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL+1, w[5], w[9], dest) + else: + Interp6(dp+1, w[5], w[6], w[2], dest) + Interp9(dp+dpL+1, w[5], w[6], w[8], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + case 112|113: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL, w[5], w[4], dest) + Interp1(dp+dpL+1, w[5], w[9], dest) + else: + Interp6(dp+dpL, w[5], w[8], w[4], dest) + Interp9(dp+dpL+1, w[5], w[6], w[8], dest) + case 200|204: + Interp2(dp, w[5], w[1], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+dpL, w[5], w[7], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + else: + Interp9(dp+dpL, w[5], w[8], w[4], dest) + Interp6(dp+dpL+1, w[5], w[8], w[6], dest) + case 73|77: + if (Diff(w[8], w[4])): + Interp1(dp, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[7], dest) + else: + Interp6(dp, w[5], w[4], w[2], dest) + Interp9(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 42|170: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[4], dest) + Interp1(dp+dpL, w[5], w[8], dest) + else: + Interp9(dp, w[5], w[4], w[2], dest) + Interp6(dp+dpL, w[5], w[4], w[8], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 14|142: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + else: + Interp9(dp, w[5], w[4], w[2], dest) + Interp6(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 67: + Interp1(dp, w[5], w[4], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 70: + Interp2(dp, w[5], w[1], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 28: + Interp2(dp, w[5], w[1], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 152: + Interp2(dp, w[5], w[1], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 194: + Interp2(dp, w[5], w[1], w[4], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 98: + Interp2(dp, w[5], w[1], w[4], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 56: + Interp2(dp, w[5], w[1], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 25: + Interp1(dp, w[5], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 26|31: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 82|214: + Interp2(dp, w[5], w[1], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 88|248: + Interp2(dp, w[5], w[1], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 74|107: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 27: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[3], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 86: + Interp2(dp, w[5], w[1], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + Interp1(dp+dpL+1, w[5], w[9], dest) + case 216: + Interp2(dp, w[5], w[1], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + Interp1(dp+dpL, w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 106: + Interp1(dp, w[5], w[4], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 30: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 210: + Interp2(dp, w[5], w[1], w[4], dest) + Interp1(dp+1, w[5], w[3], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 120: + Interp2(dp, w[5], w[1], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp1(dp+dpL+1, w[5], w[9], dest) + case 75: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + Interp1(dp+dpL, w[5], w[7], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 29: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 198: + Interp2(dp, w[5], w[1], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 184: + Interp2(dp, w[5], w[1], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 99: + Interp1(dp, w[5], w[4], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 57: + Interp1(dp, w[5], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 71: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 156: + Interp2(dp, w[5], w[1], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 226: + Interp2(dp, w[5], w[1], w[4], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 60: + Interp2(dp, w[5], w[1], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 195: + Interp1(dp, w[5], w[4], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 102: + Interp2(dp, w[5], w[1], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 153: + Interp1(dp, w[5], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 58: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[4], dest) + else: + Interp7(dp, w[5], w[4], w[2], dest) + if (Diff(w[2], w[6])): + Interp1(dp+1, w[5], w[3], dest) + else: + Interp7(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 83: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + Interp1(dp+1, w[5], w[3], dest) + else: + Interp7(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL+1, w[5], w[9], dest) + else: + Interp7(dp+dpL+1, w[5], w[6], w[8], dest) + case 92: + Interp2(dp, w[5], w[1], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + if (Diff(w[8], w[4])): + Interp1(dp+dpL, w[5], w[7], dest) + else: + Interp7(dp+dpL, w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL+1, w[5], w[9], dest) + else: + Interp7(dp+dpL+1, w[5], w[6], w[8], dest) + case 202: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[4], dest) + else: + Interp7(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+dpL, w[5], w[7], dest) + else: + Interp7(dp+dpL, w[5], w[8], w[4], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 78: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[4], dest) + else: + Interp7(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+dpL, w[5], w[7], dest) + else: + Interp7(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 154: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[4], dest) + else: + Interp7(dp, w[5], w[4], w[2], dest) + if (Diff(w[2], w[6])): + Interp1(dp+1, w[5], w[3], dest) + else: + Interp7(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 114: + Interp2(dp, w[5], w[1], w[4], dest) + if (Diff(w[2], w[6])): + Interp1(dp+1, w[5], w[3], dest) + else: + Interp7(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL+1, w[5], w[9], dest) + else: + Interp7(dp+dpL+1, w[5], w[6], w[8], dest) + case 89: + Interp1(dp, w[5], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + if (Diff(w[8], w[4])): + Interp1(dp+dpL, w[5], w[7], dest) + else: + Interp7(dp+dpL, w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL+1, w[5], w[9], dest) + else: + Interp7(dp+dpL+1, w[5], w[6], w[8], dest) + case 90: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[4], dest) + else: + Interp7(dp, w[5], w[4], w[2], dest) + if (Diff(w[2], w[6])): + Interp1(dp+1, w[5], w[3], dest) + else: + Interp7(dp+1, w[5], w[2], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+dpL, w[5], w[7], dest) + else: + Interp7(dp+dpL, w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL+1, w[5], w[9], dest) + else: + Interp7(dp+dpL+1, w[5], w[6], w[8], dest) + case 55|23: + if (Diff(w[2], w[6])): + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + else: + Interp6(dp, w[5], w[2], w[4], dest) + Interp9(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 182|150: + Interp2(dp, w[5], w[1], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + Interp1(dp+dpL+1, w[5], w[8], dest) + else: + Interp9(dp+1, w[5], w[2], w[6], dest) + Interp6(dp+dpL+1, w[5], w[6], w[8], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + case 213|212: + Interp2(dp, w[5], w[4], w[2], dest) + if (Diff(w[6], w[8])): + Interp1(dp+1, w[5], w[2], dest) + dest[dp+dpL+1] = w[5] + else: + Interp6(dp+1, w[5], w[6], w[2], dest) + Interp9(dp+dpL+1, w[5], w[6], w[8], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + case 241|240: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + else: + Interp6(dp+dpL, w[5], w[8], w[4], dest) + Interp9(dp+dpL+1, w[5], w[6], w[8], dest) + case 236|232: + Interp2(dp, w[5], w[1], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + Interp1(dp+dpL+1, w[5], w[6], dest) + else: + Interp9(dp+dpL, w[5], w[8], w[4], dest) + Interp6(dp+dpL+1, w[5], w[8], w[6], dest) + case 109|105: + if (Diff(w[8], w[4])): + Interp1(dp, w[5], w[2], dest) + dest[dp+dpL] = w[5] + else: + Interp6(dp, w[5], w[4], w[2], dest) + Interp9(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 171|43: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + Interp1(dp+dpL, w[5], w[8], dest) + else: + Interp9(dp, w[5], w[4], w[2], dest) + Interp6(dp+dpL, w[5], w[4], w[8], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 143|15: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + Interp1(dp+1, w[5], w[6], dest) + else: + Interp9(dp, w[5], w[4], w[2], dest) + Interp6(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 124: + Interp2(dp, w[5], w[1], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp1(dp+dpL+1, w[5], w[9], dest) + case 203: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + Interp1(dp+dpL, w[5], w[7], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 62: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 211: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+1, w[5], w[3], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 118: + Interp2(dp, w[5], w[1], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + Interp1(dp+dpL+1, w[5], w[9], dest) + case 217: + Interp1(dp, w[5], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + Interp1(dp+dpL, w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 110: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 155: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[3], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 188: + Interp2(dp, w[5], w[1], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 185: + Interp1(dp, w[5], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 61: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 157: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 103: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 227: + Interp1(dp, w[5], w[4], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 230: + Interp2(dp, w[5], w[1], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 199: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 220: + Interp2(dp, w[5], w[1], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + if (Diff(w[8], w[4])): + Interp1(dp+dpL, w[5], w[7], dest) + else: + Interp7(dp+dpL, w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 158: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[4], dest) + else: + Interp7(dp, w[5], w[4], w[2], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 234: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[4], dest) + else: + Interp7(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 242: + Interp2(dp, w[5], w[1], w[4], dest) + if (Diff(w[2], w[6])): + Interp1(dp+1, w[5], w[3], dest) + else: + Interp7(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 59: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + if (Diff(w[2], w[6])): + Interp1(dp+1, w[5], w[3], dest) + else: + Interp7(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 121: + Interp1(dp, w[5], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL+1, w[5], w[9], dest) + else: + Interp7(dp+dpL+1, w[5], w[6], w[8], dest) + case 87: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL+1, w[5], w[9], dest) + else: + Interp7(dp+dpL+1, w[5], w[6], w[8], dest) + case 79: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+dpL, w[5], w[7], dest) + else: + Interp7(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 122: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[4], dest) + else: + Interp7(dp, w[5], w[4], w[2], dest) + if (Diff(w[2], w[6])): + Interp1(dp+1, w[5], w[3], dest) + else: + Interp7(dp+1, w[5], w[2], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL+1, w[5], w[9], dest) + else: + Interp7(dp+dpL+1, w[5], w[6], w[8], dest) + case 94: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[4], dest) + else: + Interp7(dp, w[5], w[4], w[2], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+dpL, w[5], w[7], dest) + else: + Interp7(dp+dpL, w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL+1, w[5], w[9], dest) + else: + Interp7(dp+dpL+1, w[5], w[6], w[8], dest) + case 218: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[4], dest) + else: + Interp7(dp, w[5], w[4], w[2], dest) + if (Diff(w[2], w[6])): + Interp1(dp+1, w[5], w[3], dest) + else: + Interp7(dp+1, w[5], w[2], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+dpL, w[5], w[7], dest) + else: + Interp7(dp+dpL, w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 91: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + if (Diff(w[2], w[6])): + Interp1(dp+1, w[5], w[3], dest) + else: + Interp7(dp+1, w[5], w[2], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+dpL, w[5], w[7], dest) + else: + Interp7(dp+dpL, w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL+1, w[5], w[9], dest) + else: + Interp7(dp+dpL+1, w[5], w[6], w[8], dest) + case 229: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 167: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 173: + Interp1(dp, w[5], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 181: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 186: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[4], dest) + else: + Interp7(dp, w[5], w[4], w[2], dest) + if (Diff(w[2], w[6])): + Interp1(dp+1, w[5], w[3], dest) + else: + Interp7(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 115: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + Interp1(dp+1, w[5], w[3], dest) + else: + Interp7(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL+1, w[5], w[9], dest) + else: + Interp7(dp+dpL+1, w[5], w[6], w[8], dest) + case 93: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + if (Diff(w[8], w[4])): + Interp1(dp+dpL, w[5], w[7], dest) + else: + Interp7(dp+dpL, w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL+1, w[5], w[9], dest) + else: + Interp7(dp+dpL+1, w[5], w[6], w[8], dest) + case 206: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[4], dest) + else: + Interp7(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+dpL, w[5], w[7], dest) + else: + Interp7(dp+dpL, w[5], w[8], w[4], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 205|201: + Interp1(dp, w[5], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+dpL, w[5], w[7], dest) + else: + Interp7(dp+dpL, w[5], w[8], w[4], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 174|46: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[4], dest) + else: + Interp7(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 179|147: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + Interp1(dp+1, w[5], w[3], dest) + else: + Interp7(dp+1, w[5], w[2], w[6], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 117|116: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL+1, w[5], w[9], dest) + else: + Interp7(dp+dpL+1, w[5], w[6], w[8], dest) + case 189: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 231: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 126: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp1(dp+dpL+1, w[5], w[9], dest) + case 219: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 125: + if (Diff(w[8], w[4])): + Interp1(dp, w[5], w[2], dest) + dest[dp+dpL] = w[5] + else: + Interp6(dp, w[5], w[4], w[2], dest) + Interp9(dp+dpL, w[5], w[8], w[4], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL+1, w[5], w[9], dest) + case 221: + Interp1(dp, w[5], w[2], dest) + if (Diff(w[6], w[8])): + Interp1(dp+1, w[5], w[2], dest) + dest[dp+dpL+1] = w[5] + else: + Interp6(dp+1, w[5], w[6], w[2], dest) + Interp9(dp+dpL+1, w[5], w[6], w[8], dest) + Interp1(dp+dpL, w[5], w[7], dest) + case 207: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + Interp1(dp+1, w[5], w[6], dest) + else: + Interp9(dp, w[5], w[4], w[2], dest) + Interp6(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[7], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 238: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + Interp1(dp+dpL+1, w[5], w[6], dest) + else: + Interp9(dp+dpL, w[5], w[8], w[4], dest) + Interp6(dp+dpL+1, w[5], w[8], w[6], dest) + case 190: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + Interp1(dp+dpL+1, w[5], w[8], dest) + else: + Interp9(dp+1, w[5], w[2], w[6], dest) + Interp6(dp+dpL+1, w[5], w[6], w[8], dest) + Interp1(dp+dpL, w[5], w[8], dest) + case 187: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + Interp1(dp+dpL, w[5], w[8], dest) + else: + Interp9(dp, w[5], w[4], w[2], dest) + Interp6(dp+dpL, w[5], w[4], w[8], dest) + Interp1(dp+1, w[5], w[3], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 243: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+1, w[5], w[3], dest) + if (Diff(w[6], w[8])): + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + else: + Interp6(dp+dpL, w[5], w[8], w[4], dest) + Interp9(dp+dpL+1, w[5], w[6], w[8], dest) + case 119: + if (Diff(w[2], w[6])): + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + else: + Interp6(dp, w[5], w[2], w[4], dest) + Interp9(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + Interp1(dp+dpL+1, w[5], w[9], dest) + case 237|233: + Interp1(dp, w[5], w[2], dest) + Interp2(dp+1, w[5], w[2], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp1(dp+dpL, w[5], w[7], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 175|47: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 183|151: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp1(dp+1, w[5], w[3], dest) + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 245|244: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp1(dp+dpL+1, w[5], w[9], dest) + case 250: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+1, w[5], w[3], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 123: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[3], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp1(dp+dpL+1, w[5], w[9], dest) + case 95: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[7], dest) + Interp1(dp+dpL+1, w[5], w[9], dest) + case 222: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 252: + Interp2(dp, w[5], w[1], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp1(dp+dpL+1, w[5], w[9], dest) + case 249: + Interp1(dp, w[5], w[2], dest) + Interp2(dp+1, w[5], w[3], w[2], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp1(dp+dpL, w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 235: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp2(dp+1, w[5], w[3], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp1(dp+dpL, w[5], w[7], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 111: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp2(dp+dpL+1, w[5], w[9], w[6], dest) + case 63: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp2(dp+dpL+1, w[5], w[9], w[8], dest) + case 159: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp1(dp+1, w[5], w[3], dest) + Interp2(dp+dpL, w[5], w[7], w[8], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 215: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp1(dp+1, w[5], w[3], dest) + Interp2(dp+dpL, w[5], w[7], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 246: + Interp2(dp, w[5], w[1], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp1(dp+dpL+1, w[5], w[9], dest) + case 254: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp1(dp+dpL+1, w[5], w[9], dest) + case 253: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp1(dp+dpL, w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp1(dp+dpL+1, w[5], w[9], dest) + case 251: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[3], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp1(dp+dpL, w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 239: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+1, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp1(dp+dpL, w[5], w[7], dest) + Interp1(dp+dpL+1, w[5], w[6], dest) + case 127: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp2(dp+1, w[5], w[2], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp2(dp+dpL, w[5], w[8], w[4], dest) + Interp1(dp+dpL+1, w[5], w[9], dest) + case 191: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp1(dp+1, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[8], dest) + Interp1(dp+dpL+1, w[5], w[8], dest) + case 223: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp1(dp+1, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp2(dp+dpL+1, w[5], w[6], w[8], dest) + case 247: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp1(dp+1, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp1(dp+dpL+1, w[5], w[9], dest) + case 255: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + else: + Interp1(dp+1, w[5], w[3], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + else: + Interp1(dp+dpL, w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+1] = w[5] + else: + Interp1(dp+dpL+1, w[5], w[9], dest) + sp += 1 + dp += 2 + dp += dpL + + +def hq3x( width: int, height: int, src, dest ) -> None: # noqa:C901 + w = [None] * 10 + dpL = width * 3 + dp = 0 + sp = 0 + + # +----+----+----+ + # | | | | + # | w1 | w2 | w3 | + # +----+----+----+ + # | | | | + # | w4 | w5 | w6 | + # +----+----+----+ + # | | | | + # | w7 | w8 | w9 | + # +----+----+----+ + + for j in range(height): + prevline = -width if j > 0 else 0 + nextline = width if j < height - 1 else 0 + + for i in range(width): + w[2] = src[sp + prevline] + w[5] = src[sp] + w[8] = src[sp + nextline] + + if i > 0: + w[1] = src[sp + prevline - 1] + w[4] = src[sp - 1] + w[7] = src[sp + nextline - 1] + else: + w[1] = w[2] + w[4] = w[5] + w[7] = w[8] + + if i < width - 1: + w[3] = src[sp + prevline + 1] + w[6] = src[sp + 1] + w[9] = src[sp + nextline + 1] + else: + w[3] = w[2] + w[6] = w[5] + w[9] = w[8] + + pattern = 0 + flag = 1 + + YUV1 = RGBtoYUV(w[5]) + + for k in range(1, 10): + if k == 5: + continue + if w[k] != w[5]: + YUV2 = RGBtoYUV(w[k]) + if ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) or ( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) or ( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) ): + pattern |= flag + flag <<= 1 + + match pattern: + case 0|1|4|32|128|5|132|160|33|129|36|133|164|161|37|165: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 2|34|130|162: + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 16|17|48|49: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 64|65|68|69: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 8|12|136|140: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 3|35|131|163: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 6|38|134|166: + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 20|21|52|53: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 144|145|176|177: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 192|193|196|197: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 96|97|100|101: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 40|44|168|172: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 9|13|137|141: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 18|50: + Interp1(dp, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+2] = w[5] + else: + Interp3(dp+1, w[5], w[2], dest) + Interp4(dp+2, w[5], w[2], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 80|81: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + else: + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 72|76: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp3(dp+dpL, w[5], w[4], dest) + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 10|138: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+1, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 66: + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 24: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 7|39|135: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 148|149|180: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 224|228|225: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 41|169|45: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 22|54: + Interp1(dp, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + else: + Interp3(dp+1, w[5], w[2], dest) + Interp4(dp+2, w[5], w[2], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 208|209: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 104|108: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp3(dp+dpL, w[5], w[4], dest) + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 11|139: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+1, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 19|51: + if (Diff(w[2], w[6])): + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+2] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[2], w[5], dest) + Interp5(dp+2, w[2], w[6], dest) + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 146|178: + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + else: + Interp1(dp+1, w[5], w[2], dest) + Interp5(dp+2, w[2], w[6], dest) + Interp1(dp+dpL+2, w[6], w[5], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp1(dp, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + case 84|85: + if (Diff(w[6], w[8])): + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL+2, w[6], w[5], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp5(dp+(dpL << 1)+2, w[6], w[8], dest) + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + case 112|113: + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + else: + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[8], w[5], dest) + Interp5(dp+(dpL << 1)+2, w[6], w[8], dest) + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + case 200|204: + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + else: + Interp1(dp+dpL, w[5], w[4], dest) + Interp5(dp+(dpL << 1), w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[8], w[5], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + case 73|77: + if (Diff(w[8], w[4])): + Interp1(dp, w[5], w[2], dest) + dest[dp+dpL] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+dpL, w[4], w[5], dest) + Interp5(dp+(dpL << 1), w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 42|170: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + else: + Interp5(dp, w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[4], w[5], dest) + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 14|142: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[4], w[2], dest) + Interp1(dp+1, w[2], w[5], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 67: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 70: + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 28: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 152: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 194: + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 98: + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 56: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 25: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 26|31: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+dpL] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+dpL, w[5], w[4], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + else: + Interp4(dp+2, w[5], w[2], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 82|214: + Interp1(dp, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + dest[dp+2] = w[5] + else: + Interp3(dp+1, w[5], w[2], dest) + Interp4(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 88|248: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + else: + Interp3(dp+dpL, w[5], w[4], dest) + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 74|107: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 27: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+1, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 86: + Interp1(dp, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + else: + Interp3(dp+1, w[5], w[2], dest) + Interp4(dp+2, w[5], w[2], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 216: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 106: + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp3(dp+dpL, w[5], w[4], dest) + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 30: + Interp1(dp, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + else: + Interp3(dp+1, w[5], w[2], dest) + Interp4(dp+2, w[5], w[2], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 210: + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 120: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp3(dp+dpL, w[5], w[4], dest) + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 75: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+1, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 29: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 198: + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 184: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 99: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 57: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 71: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 156: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 226: + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 60: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 195: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 102: + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 153: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 58: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 83: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 92: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 202: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 78: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 154: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 114: + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 89: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 90: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 55|23: + if (Diff(w[2], w[6])): + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[2], w[5], dest) + Interp5(dp+2, w[2], w[6], dest) + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 182|150: + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + else: + Interp1(dp+1, w[5], w[2], dest) + Interp5(dp+2, w[2], w[6], dest) + Interp1(dp+dpL+2, w[6], w[5], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp1(dp, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + case 213|212: + if (Diff(w[6], w[8])): + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL+2, w[6], w[5], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp5(dp+(dpL << 1)+2, w[6], w[8], dest) + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + case 241|240: + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[8], w[5], dest) + Interp5(dp+(dpL << 1)+2, w[6], w[8], dest) + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + case 236|232: + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + else: + Interp1(dp+dpL, w[5], w[4], dest) + Interp5(dp+(dpL << 1), w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[8], w[5], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + case 109|105: + if (Diff(w[8], w[4])): + Interp1(dp, w[5], w[2], dest) + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+dpL, w[4], w[5], dest) + Interp5(dp+(dpL << 1), w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 171|43: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + else: + Interp5(dp, w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[4], w[5], dest) + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 143|15: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[4], w[2], dest) + Interp1(dp+1, w[2], w[5], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 124: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp3(dp+dpL, w[5], w[4], dest) + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 203: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+1, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 62: + Interp1(dp, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + else: + Interp3(dp+1, w[5], w[2], dest) + Interp4(dp+2, w[5], w[2], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 211: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 118: + Interp1(dp, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + else: + Interp3(dp+1, w[5], w[2], dest) + Interp4(dp+2, w[5], w[2], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 217: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 110: + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp3(dp+dpL, w[5], w[4], dest) + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 155: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+1, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 188: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 185: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 61: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 157: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 103: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 227: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 230: + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 199: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 220: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 158: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[4], w[2], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + else: + Interp3(dp+1, w[5], w[2], dest) + Interp4(dp+2, w[5], w[2], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 234: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp3(dp+dpL, w[5], w[4], dest) + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 242: + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 59: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+1, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[4], dest) + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 121: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp3(dp+dpL, w[5], w[4], dest) + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + if (Diff(w[6], w[8])): + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 87: + Interp1(dp, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + else: + Interp3(dp+1, w[5], w[2], dest) + Interp4(dp+2, w[5], w[2], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 79: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+1, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[4], dest) + Interp1(dp+2, w[5], w[6], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 122: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp3(dp+dpL, w[5], w[4], dest) + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + if (Diff(w[6], w[8])): + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 94: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[4], w[2], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + else: + Interp3(dp+1, w[5], w[2], dest) + Interp4(dp+2, w[5], w[2], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 218: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 91: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+1, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[4], dest) + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 229: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 167: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 173: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 181: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 186: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 115: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 93: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 206: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 205|201: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 174|46: + if (Diff(w[4], w[2])): + Interp1(dp, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 179|147: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 117|116: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 189: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 231: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 126: + Interp1(dp, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + else: + Interp3(dp+1, w[5], w[2], dest) + Interp4(dp+2, w[5], w[2], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + dest[dp+dpL+1] = w[5] + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp3(dp+dpL, w[5], w[4], dest) + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 219: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+1, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 125: + if (Diff(w[8], w[4])): + Interp1(dp, w[5], w[2], dest) + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+dpL, w[4], w[5], dest) + Interp5(dp+(dpL << 1), w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 221: + if (Diff(w[6], w[8])): + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL+2, w[6], w[5], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp5(dp+(dpL << 1)+2, w[6], w[8], dest) + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + case 207: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[4], w[2], dest) + Interp1(dp+1, w[2], w[5], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 238: + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + else: + Interp1(dp+dpL, w[5], w[4], dest) + Interp5(dp+(dpL << 1), w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[8], w[5], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + case 190: + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + else: + Interp1(dp+1, w[5], w[2], dest) + Interp5(dp+2, w[2], w[6], dest) + Interp1(dp+dpL+2, w[6], w[5], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp1(dp, w[5], w[1], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + case 187: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + else: + Interp5(dp, w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[4], w[5], dest) + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 243: + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[8], w[5], dest) + Interp5(dp+(dpL << 1)+2, w[6], w[8], dest) + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + case 119: + if (Diff(w[2], w[6])): + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[2], w[5], dest) + Interp5(dp+2, w[2], w[6], dest) + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 237|233: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 175|47: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 183|151: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 245|244: + Interp2(dp, w[5], w[4], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 250: + Interp1(dp, w[5], w[1], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + else: + Interp3(dp+dpL, w[5], w[4], dest) + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 123: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 95: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+dpL] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+dpL, w[5], w[4], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + else: + Interp4(dp+2, w[5], w[2], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 222: + Interp1(dp, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + dest[dp+2] = w[5] + else: + Interp3(dp+1, w[5], w[2], dest) + Interp4(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 252: + Interp1(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + else: + Interp3(dp+dpL, w[5], w[4], dest) + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 249: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 235: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 111: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 63: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + else: + Interp4(dp+2, w[5], w[2], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 159: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+dpL] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+dpL, w[5], w[4], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 215: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 246: + Interp1(dp, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + dest[dp+2] = w[5] + else: + Interp3(dp+1, w[5], w[2], dest) + Interp4(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 254: + Interp1(dp, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + dest[dp+2] = w[5] + else: + Interp3(dp+1, w[5], w[2], dest) + Interp4(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL+1] = w[5] + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + else: + Interp3(dp+dpL, w[5], w[4], dest) + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 253: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[2], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 251: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+1, w[5], w[2], dest) + Interp1(dp+2, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + if (Diff(w[8], w[4])): + dest[dp+dpL] = w[5] + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp3(dp+dpL, w[5], w[4], dest) + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + if (Diff(w[6], w[8])): + dest[dp+dpL+2] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 239: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + Interp1(dp+2, w[5], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp1(dp+dpL+2, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp1(dp+(dpL << 1)+2, w[5], w[6], dest) + case 127: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + Interp3(dp+1, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + else: + Interp4(dp+2, w[5], w[2], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + dest[dp+dpL+1] = w[5] + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + else: + Interp4(dp+(dpL << 1), w[5], w[8], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[9], dest) + case 191: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[8], dest) + Interp1(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp1(dp+(dpL << 1)+2, w[5], w[8], dest) + case 223: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+dpL] = w[5] + else: + Interp4(dp, w[5], w[4], w[2], dest) + Interp3(dp+dpL, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+1] = w[5] + dest[dp+2] = w[5] + dest[dp+dpL+2] = w[5] + else: + Interp3(dp+1, w[5], w[2], dest) + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp4(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 247: + Interp1(dp, w[5], w[4], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + case 255: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[4], w[2], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + else: + Interp2(dp+2, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + else: + Interp2(dp+(dpL << 1), w[5], w[8], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+2] = w[5] + else: + Interp2(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + sp += 1 + dp += 3 + dp += (dpL << 1) + + +def hq4x( width: int, height: int, src, dest ) -> None: # noqa:C901 + w = [None] * 10 + dpL = width << 2 + dp = 0 + sp = 0 + + # +----+----+----+ + # | | | | + # | w1 | w2 | w3 | + # +----+----+----+ + # | | | | + # | w4 | w5 | w6 | + # +----+----+----+ + # | | | | + # | w7 | w8 | w9 | + # +----+----+----+ + + for j in range(height): + prevline = -width if j > 0 else 0 + nextline = width if j < height - 1 else 0 + + for i in range(width): + w[2] = src[sp + prevline] + w[5] = src[sp] + w[8] = src[sp + nextline] + + if i > 0: + w[1] = src[sp + prevline - 1] + w[4] = src[sp - 1] + w[7] = src[sp + nextline - 1] + else: + w[1] = w[2] + w[4] = w[5] + w[7] = w[8] + + if i < width - 1: + w[3] = src[sp + prevline + 1] + w[6] = src[sp + 1] + w[9] = src[sp + nextline + 1] + else: + w[3] = w[2] + w[6] = w[5] + w[9] = w[8] + + pattern = 0 + flag = 1 + + YUV1 = RGBtoYUV(w[5]) + + for k in range(1, 10): + if k == 5: + continue + + if w[k] != w[5]: + YUV2 = RGBtoYUV(w[k]) + if ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) or ( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) or ( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) ): + pattern |= flag + flag <<= 1 + + match pattern: + case 0|1|4|32|128|5|132|160|33|129|36|133|164|161|37|165: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 2|34|130|162: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 16|17|48|49: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 64|65|68|69: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 8|12|136|140: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 3|35|131|163: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 6|38|134|166: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 20|21|52|53: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 144|145|176|177: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 192|193|196|197: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 96|97|100|101: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 40|44|168|172: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 9|13|137|141: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 18|50: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + dest[dp+dpL+2] = w[5] + Interp5(dp+dpL+3, w[6], w[5], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 80|81: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + if (Diff(w[6], w[8])): + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + else: + dest[dp+(dpL << 1)+2] = w[5] + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + case 72|76: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 10|138: + if (Diff(w[4], w[2])): + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 66: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 24: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 7|39|135: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 148|149|180: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 224|228|225: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 41|169|45: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 22|54: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + dest[dp+dpL+2] = w[5] + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 208|209: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + case 104|108: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 11|139: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 19|51: + if (Diff(w[2], w[6])): + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + else: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[2], w[5], dest) + Interp8(dp+2, w[2], w[6], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp2(dp+dpL+3, w[6], w[5], w[2], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 146|178: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + else: + Interp2(dp+2, w[2], w[5], w[6], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp8(dp+dpL+3, w[6], w[2], dest) + Interp1(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp1(dp+(dpL * 3)+3, w[5], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + case 84|85: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp8(dp+2, w[5], w[2], dest) + if (Diff(w[6], w[8])): + Interp8(dp+3, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + else: + Interp1(dp+3, w[5], w[6], dest) + Interp1(dp+dpL+3, w[6], w[5], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp8(dp+(dpL << 1)+3, w[6], w[8], dest) + Interp2(dp+(dpL * 3)+2, w[8], w[5], w[6], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + case 112|113: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + if (Diff(w[6], w[8])): + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + else: + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp2(dp+(dpL << 1)+3, w[6], w[5], w[8], dest) + Interp1(dp+(dpL * 3), w[5], w[8], dest) + Interp1(dp+(dpL * 3)+1, w[8], w[5], dest) + Interp8(dp+(dpL * 3)+2, w[8], w[6], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + case 200|204: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + else: + Interp2(dp+(dpL << 1), w[4], w[5], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp8(dp+(dpL * 3)+1, w[8], w[4], dest) + Interp1(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp1(dp+(dpL * 3)+3, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + case 73|77: + if (Diff(w[8], w[4])): + Interp8(dp, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + else: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+dpL, w[4], w[5], dest) + Interp8(dp+(dpL << 1), w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp2(dp+(dpL * 3)+1, w[8], w[5], w[4], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 42|170: + if (Diff(w[4], w[2])): + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + else: + Interp5(dp, w[2], w[4], dest) + Interp2(dp+1, w[2], w[5], w[4], dest) + Interp8(dp+dpL, w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp1(dp+(dpL << 1), w[4], w[5], dest) + Interp1(dp+(dpL * 3), w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 14|142: + if (Diff(w[4], w[2])): + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + else: + Interp5(dp, w[2], w[4], dest) + Interp8(dp+1, w[2], w[4], dest) + Interp1(dp+2, w[2], w[5], dest) + Interp1(dp+3, w[5], w[2], dest) + Interp2(dp+dpL, w[4], w[5], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 67: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 70: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 28: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 152: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 194: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 98: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 56: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 25: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 26|31: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 82|214: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + dest[dp+dpL+2] = w[5] + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + case 88|248: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + case 74|107: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 27: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 86: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + dest[dp+dpL+2] = w[5] + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 216: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + case 106: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 30: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 210: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + case 120: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 75: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 29: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 198: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 184: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 99: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 57: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 71: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 156: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 226: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 60: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 195: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 102: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 153: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 58: + if (Diff(w[4], w[2])): + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[2], w[4], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + else: + Interp1(dp+2, w[5], w[2], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+dpL+3, w[5], w[6], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 83: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + else: + Interp1(dp+2, w[5], w[2], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+dpL+3, w[5], w[6], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + if (Diff(w[6], w[8])): + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + else: + dest[dp+(dpL << 1)+2] = w[5] + Interp1(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + case 92: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + else: + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[8], dest) + if (Diff(w[6], w[8])): + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + else: + dest[dp+(dpL << 1)+2] = w[5] + Interp1(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 202: + if (Diff(w[4], w[2])): + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[2], w[4], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + else: + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 78: + if (Diff(w[4], w[2])): + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[2], w[4], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + else: + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 154: + if (Diff(w[4], w[2])): + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[2], w[4], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + else: + Interp1(dp+2, w[5], w[2], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+dpL+3, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 114: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + else: + Interp1(dp+2, w[5], w[2], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+dpL+3, w[5], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + if (Diff(w[6], w[8])): + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + else: + dest[dp+(dpL << 1)+2] = w[5] + Interp1(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + case 89: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + else: + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[8], dest) + if (Diff(w[6], w[8])): + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + else: + dest[dp+(dpL << 1)+2] = w[5] + Interp1(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 90: + if (Diff(w[4], w[2])): + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[2], w[4], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + else: + Interp1(dp+2, w[5], w[2], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+dpL+3, w[5], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + else: + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[8], dest) + if (Diff(w[6], w[8])): + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + else: + dest[dp+(dpL << 1)+2] = w[5] + Interp1(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 55|23: + if (Diff(w[2], w[6])): + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+2] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[2], w[5], dest) + Interp8(dp+2, w[2], w[6], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp2(dp+dpL+3, w[6], w[5], w[2], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 182|150: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+2] = w[5] + dest[dp+dpL+3] = w[5] + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + else: + Interp2(dp+2, w[2], w[5], w[6], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp8(dp+dpL+3, w[6], w[2], dest) + Interp1(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp1(dp+(dpL * 3)+3, w[5], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + case 213|212: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp8(dp+2, w[5], w[2], dest) + if (Diff(w[6], w[8])): + Interp8(dp+3, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + dest[dp+(dpL << 1)+2] = w[5] + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp1(dp+3, w[5], w[6], dest) + Interp1(dp+dpL+3, w[6], w[5], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp8(dp+(dpL << 1)+3, w[6], w[8], dest) + Interp2(dp+(dpL * 3)+2, w[8], w[5], w[6], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + case 241|240: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+2] = w[5] + dest[dp+(dpL << 1)+3] = w[5] + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp2(dp+(dpL << 1)+3, w[6], w[5], w[8], dest) + Interp1(dp+(dpL * 3), w[5], w[8], dest) + Interp1(dp+(dpL * 3)+1, w[8], w[5], dest) + Interp8(dp+(dpL * 3)+2, w[8], w[6], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + case 236|232: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + else: + Interp2(dp+(dpL << 1), w[4], w[5], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp8(dp+(dpL * 3)+1, w[8], w[4], dest) + Interp1(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp1(dp+(dpL * 3)+3, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + case 109|105: + if (Diff(w[8], w[4])): + Interp8(dp, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[2], dest) + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+dpL, w[4], w[5], dest) + Interp8(dp+(dpL << 1), w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp2(dp+(dpL * 3)+1, w[8], w[5], w[4], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 171|43: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + else: + Interp5(dp, w[2], w[4], dest) + Interp2(dp+1, w[2], w[5], w[4], dest) + Interp8(dp+dpL, w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp1(dp+(dpL << 1), w[4], w[5], dest) + Interp1(dp+(dpL * 3), w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 143|15: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp8(dp+1, w[2], w[4], dest) + Interp1(dp+2, w[2], w[5], dest) + Interp1(dp+3, w[5], w[2], dest) + Interp2(dp+dpL, w[4], w[5], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 124: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 203: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 62: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + dest[dp+dpL+2] = w[5] + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 211: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + case 118: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + dest[dp+dpL+2] = w[5] + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 217: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + case 110: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 155: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 188: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 185: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 61: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 157: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 103: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 227: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 230: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 199: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 220: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + else: + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[8], dest) + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + case 158: + if (Diff(w[4], w[2])): + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[2], w[4], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 234: + if (Diff(w[4], w[2])): + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[2], w[4], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 242: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + else: + Interp1(dp+2, w[5], w[2], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+dpL+3, w[5], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + case 59: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + else: + Interp1(dp+2, w[5], w[2], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+dpL+3, w[5], w[6], dest) + dest[dp+dpL+1] = w[5] + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 121: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + else: + dest[dp+(dpL << 1)+2] = w[5] + Interp1(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 87: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + dest[dp+dpL+2] = w[5] + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + if (Diff(w[6], w[8])): + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + else: + dest[dp+(dpL << 1)+2] = w[5] + Interp1(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + case 79: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + dest[dp+dpL+1] = w[5] + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + else: + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 122: + if (Diff(w[4], w[2])): + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[2], w[4], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + else: + Interp1(dp+2, w[5], w[2], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+dpL+3, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + if (Diff(w[6], w[8])): + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + else: + dest[dp+(dpL << 1)+2] = w[5] + Interp1(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 94: + if (Diff(w[4], w[2])): + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[2], w[4], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + else: + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[8], dest) + if (Diff(w[6], w[8])): + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + else: + dest[dp+(dpL << 1)+2] = w[5] + Interp1(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 218: + if (Diff(w[4], w[2])): + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[2], w[4], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + else: + Interp1(dp+2, w[5], w[2], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+dpL+3, w[5], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + else: + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[8], dest) + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + case 91: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + else: + Interp1(dp+2, w[5], w[2], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+dpL+3, w[5], w[6], dest) + dest[dp+dpL+1] = w[5] + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + else: + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[8], dest) + if (Diff(w[6], w[8])): + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + else: + dest[dp+(dpL << 1)+2] = w[5] + Interp1(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 229: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 167: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 173: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 181: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 186: + if (Diff(w[4], w[2])): + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[2], w[4], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + else: + Interp1(dp+2, w[5], w[2], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+dpL+3, w[5], w[6], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 115: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + else: + Interp1(dp+2, w[5], w[2], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+dpL+3, w[5], w[6], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + if (Diff(w[6], w[8])): + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + else: + dest[dp+(dpL << 1)+2] = w[5] + Interp1(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + case 93: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + else: + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[8], dest) + if (Diff(w[6], w[8])): + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + else: + dest[dp+(dpL << 1)+2] = w[5] + Interp1(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 206: + if (Diff(w[4], w[2])): + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[2], w[4], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + else: + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 205|201: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + if (Diff(w[8], w[4])): + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + else: + Interp1(dp+(dpL << 1), w[5], w[4], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 174|46: + if (Diff(w[4], w[2])): + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + else: + Interp2(dp, w[5], w[2], w[4], dest) + Interp1(dp+1, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[4], dest) + dest[dp+dpL+1] = w[5] + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 179|147: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + if (Diff(w[2], w[6])): + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + else: + Interp1(dp+2, w[5], w[2], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+dpL+3, w[5], w[6], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 117|116: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + if (Diff(w[6], w[8])): + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + else: + dest[dp+(dpL << 1)+2] = w[5] + Interp1(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + case 189: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 231: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 126: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 219: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + case 125: + if (Diff(w[8], w[4])): + Interp8(dp, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[2], dest) + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp1(dp, w[5], w[4], dest) + Interp1(dp+dpL, w[4], w[5], dest) + Interp8(dp+(dpL << 1), w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp2(dp+(dpL * 3)+1, w[8], w[5], w[4], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 221: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp8(dp+2, w[5], w[2], dest) + if (Diff(w[6], w[8])): + Interp8(dp+3, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + dest[dp+(dpL << 1)+2] = w[5] + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp1(dp+3, w[5], w[6], dest) + Interp1(dp+dpL+3, w[6], w[5], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp8(dp+(dpL << 1)+3, w[6], w[8], dest) + Interp2(dp+(dpL * 3)+2, w[8], w[5], w[6], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + case 207: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp8(dp+1, w[2], w[4], dest) + Interp1(dp+2, w[2], w[5], dest) + Interp1(dp+3, w[5], w[2], dest) + Interp2(dp+dpL, w[4], w[5], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 238: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + else: + Interp2(dp+(dpL << 1), w[4], w[5], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp8(dp+(dpL * 3)+1, w[8], w[4], dest) + Interp1(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp1(dp+(dpL * 3)+3, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + case 190: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+2] = w[5] + dest[dp+dpL+3] = w[5] + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + else: + Interp2(dp+2, w[2], w[5], w[6], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp8(dp+dpL+3, w[6], w[2], dest) + Interp1(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp1(dp+(dpL * 3)+3, w[5], w[6], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + case 187: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + else: + Interp5(dp, w[2], w[4], dest) + Interp2(dp+1, w[2], w[5], w[4], dest) + Interp8(dp+dpL, w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp1(dp+(dpL << 1), w[4], w[5], dest) + Interp1(dp+(dpL * 3), w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 243: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+2] = w[5] + dest[dp+(dpL << 1)+3] = w[5] + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp2(dp+(dpL << 1)+3, w[6], w[5], w[8], dest) + Interp1(dp+(dpL * 3), w[5], w[8], dest) + Interp1(dp+(dpL * 3)+1, w[8], w[5], dest) + Interp8(dp+(dpL * 3)+2, w[8], w[6], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + case 119: + if (Diff(w[2], w[6])): + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+2] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp1(dp, w[5], w[2], dest) + Interp1(dp+1, w[2], w[5], dest) + Interp8(dp+2, w[2], w[6], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp2(dp+dpL+3, w[6], w[5], w[2], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 237|233: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp6(dp+2, w[5], w[2], w[6], dest) + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp7(dp+dpL+2, w[5], w[6], w[2], dest) + Interp6(dp+dpL+3, w[5], w[6], w[2], dest) + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL * 3)] = w[5] + else: + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + dest[dp+(dpL * 3)+1] = w[5] + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 175|47: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[2], w[4], dest) + dest[dp+1] = w[5] + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp7(dp+(dpL << 1)+2, w[5], w[6], w[8], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[6], dest) + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 183|151: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + dest[dp+2] = w[5] + if (Diff(w[2], w[6])): + dest[dp+3] = w[5] + else: + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + dest[dp+dpL+2] = w[5] + dest[dp+dpL+3] = w[5] + Interp6(dp+(dpL << 1), w[5], w[4], w[8], dest) + Interp7(dp+(dpL << 1)+1, w[5], w[4], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[4], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 245|244: + Interp2(dp, w[5], w[2], w[4], dest) + Interp6(dp+1, w[5], w[2], w[4], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp6(dp+dpL, w[5], w[4], w[2], dest) + Interp7(dp+dpL+1, w[5], w[4], w[2], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + dest[dp+(dpL << 1)+2] = w[5] + dest[dp+(dpL << 1)+3] = w[5] + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + dest[dp+(dpL * 3)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 250: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + case 123: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 95: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 222: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + dest[dp+dpL+2] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + case 252: + Interp8(dp, w[5], w[1], dest) + Interp6(dp+1, w[5], w[2], w[1], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 249: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp6(dp+2, w[5], w[2], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL * 3)] = w[5] + else: + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + dest[dp+(dpL * 3)+1] = w[5] + case 235: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp6(dp+dpL+3, w[5], w[6], w[3], dest) + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL * 3)] = w[5] + else: + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + dest[dp+(dpL * 3)+1] = w[5] + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 111: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[2], w[4], dest) + dest[dp+1] = w[5] + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp6(dp+(dpL << 1)+3, w[5], w[6], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 63: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[2], w[4], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp6(dp+(dpL * 3)+2, w[5], w[8], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 159: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + dest[dp+2] = w[5] + if (Diff(w[2], w[6])): + dest[dp+3] = w[5] + else: + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + dest[dp+dpL+3] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp6(dp+(dpL * 3)+1, w[5], w[8], w[7], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 215: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + dest[dp+2] = w[5] + if (Diff(w[2], w[6])): + dest[dp+3] = w[5] + else: + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + dest[dp+dpL+2] = w[5] + dest[dp+dpL+3] = w[5] + Interp6(dp+(dpL << 1), w[5], w[4], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + case 246: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + Interp6(dp+dpL, w[5], w[4], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + dest[dp+dpL+2] = w[5] + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + dest[dp+(dpL << 1)+2] = w[5] + dest[dp+(dpL << 1)+3] = w[5] + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + dest[dp+(dpL * 3)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 254: + Interp8(dp, w[5], w[1], dest) + Interp1(dp+1, w[5], w[1], dest) + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + Interp1(dp+dpL, w[5], w[1], dest) + Interp3(dp+dpL+1, w[5], w[1], dest) + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 253: + Interp8(dp, w[5], w[2], dest) + Interp8(dp+1, w[5], w[2], dest) + Interp8(dp+2, w[5], w[2], dest) + Interp8(dp+3, w[5], w[2], dest) + Interp3(dp+dpL, w[5], w[2], dest) + Interp3(dp+dpL+1, w[5], w[2], dest) + Interp3(dp+dpL+2, w[5], w[2], dest) + Interp3(dp+dpL+3, w[5], w[2], dest) + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + dest[dp+(dpL << 1)+3] = w[5] + if (Diff(w[8], w[4])): + dest[dp+(dpL * 3)] = w[5] + else: + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + dest[dp+(dpL * 3)+1] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 251: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + Interp1(dp+2, w[5], w[3], dest) + Interp8(dp+3, w[5], w[3], dest) + dest[dp+dpL+1] = w[5] + Interp3(dp+dpL+2, w[5], w[3], dest) + Interp1(dp+dpL+3, w[5], w[3], dest) + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL * 3)] = w[5] + else: + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + dest[dp+(dpL * 3)+1] = w[5] + case 239: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[2], w[4], dest) + dest[dp+1] = w[5] + Interp3(dp+2, w[5], w[6], dest) + Interp8(dp+3, w[5], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + Interp3(dp+dpL+2, w[5], w[6], dest) + Interp8(dp+dpL+3, w[5], w[6], dest) + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + Interp3(dp+(dpL << 1)+2, w[5], w[6], dest) + Interp8(dp+(dpL << 1)+3, w[5], w[6], dest) + if (Diff(w[8], w[4])): + dest[dp+(dpL * 3)] = w[5] + else: + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + dest[dp+(dpL * 3)+1] = w[5] + Interp3(dp+(dpL * 3)+2, w[5], w[6], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[6], dest) + case 127: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[2], w[4], dest) + dest[dp+1] = w[5] + if (Diff(w[2], w[6])): + dest[dp+2] = w[5] + dest[dp+3] = w[5] + dest[dp+dpL+3] = w[5] + else: + Interp5(dp+2, w[2], w[5], dest) + Interp5(dp+3, w[2], w[6], dest) + Interp5(dp+dpL+3, w[6], w[5], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + if (Diff(w[8], w[4])): + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL * 3)] = w[5] + dest[dp+(dpL * 3)+1] = w[5] + else: + Interp5(dp+(dpL << 1), w[4], w[5], dest) + Interp5(dp+(dpL * 3), w[8], w[4], dest) + Interp5(dp+(dpL * 3)+1, w[8], w[5], dest) + dest[dp+(dpL << 1)+1] = w[5] + Interp3(dp+(dpL << 1)+2, w[5], w[9], dest) + Interp1(dp+(dpL << 1)+3, w[5], w[9], dest) + Interp1(dp+(dpL * 3)+2, w[5], w[9], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[9], dest) + case 191: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[2], w[4], dest) + dest[dp+1] = w[5] + dest[dp+2] = w[5] + if (Diff(w[2], w[6])): + dest[dp+3] = w[5] + else: + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + dest[dp+dpL+3] = w[5] + Interp3(dp+(dpL << 1), w[5], w[8], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+2, w[5], w[8], dest) + Interp3(dp+(dpL << 1)+3, w[5], w[8], dest) + Interp8(dp+(dpL * 3), w[5], w[8], dest) + Interp8(dp+(dpL * 3)+1, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+2, w[5], w[8], dest) + Interp8(dp+(dpL * 3)+3, w[5], w[8], dest) + case 223: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + dest[dp+1] = w[5] + dest[dp+dpL] = w[5] + else: + Interp5(dp, w[2], w[4], dest) + Interp5(dp+1, w[2], w[5], dest) + Interp5(dp+dpL, w[4], w[5], dest) + dest[dp+2] = w[5] + if (Diff(w[2], w[6])): + dest[dp+3] = w[5] + else: + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + dest[dp+dpL+3] = w[5] + Interp1(dp+(dpL << 1), w[5], w[7], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[7], dest) + dest[dp+(dpL << 1)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL << 1)+3] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp5(dp+(dpL << 1)+3, w[6], w[5], dest) + Interp5(dp+(dpL * 3)+2, w[8], w[5], dest) + Interp5(dp+(dpL * 3)+3, w[8], w[6], dest) + Interp8(dp+(dpL * 3), w[5], w[7], dest) + Interp1(dp+(dpL * 3)+1, w[5], w[7], dest) + case 247: + Interp8(dp, w[5], w[4], dest) + Interp3(dp+1, w[5], w[4], dest) + dest[dp+2] = w[5] + if (Diff(w[2], w[6])): + dest[dp+3] = w[5] + else: + Interp2(dp+3, w[5], w[2], w[6], dest) + Interp8(dp+dpL, w[5], w[4], dest) + Interp3(dp+dpL+1, w[5], w[4], dest) + dest[dp+dpL+2] = w[5] + dest[dp+dpL+3] = w[5] + Interp8(dp+(dpL << 1), w[5], w[4], dest) + Interp3(dp+(dpL << 1)+1, w[5], w[4], dest) + dest[dp+(dpL << 1)+2] = w[5] + dest[dp+(dpL << 1)+3] = w[5] + Interp8(dp+(dpL * 3), w[5], w[4], dest) + Interp3(dp+(dpL * 3)+1, w[5], w[4], dest) + dest[dp+(dpL * 3)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + case 255: + if (Diff(w[4], w[2])): + dest[dp] = w[5] + else: + Interp2(dp, w[5], w[2], w[4], dest) + dest[dp+1] = w[5] + dest[dp+2] = w[5] + if (Diff(w[2], w[6])): + dest[dp+3] = w[5] + else: + Interp2(dp+3, w[5], w[2], w[6], dest) + dest[dp+dpL] = w[5] + dest[dp+dpL+1] = w[5] + dest[dp+dpL+2] = w[5] + dest[dp+dpL+3] = w[5] + dest[dp+(dpL << 1)] = w[5] + dest[dp+(dpL << 1)+1] = w[5] + dest[dp+(dpL << 1)+2] = w[5] + dest[dp+(dpL << 1)+3] = w[5] + if (Diff(w[8], w[4])): + dest[dp+(dpL * 3)] = w[5] + else: + Interp2(dp+(dpL * 3), w[5], w[8], w[4], dest) + dest[dp+(dpL * 3)+1] = w[5] + dest[dp+(dpL * 3)+2] = w[5] + if (Diff(w[6], w[8])): + dest[dp+(dpL * 3)+3] = w[5] + else: + Interp2(dp+(dpL * 3)+3, w[5], w[8], w[6], dest) + sp += 1 + dp += 4 + dp += (dpL * 3) + + +def main(): + try: + import sys + file_path = sys.argv[1] + out_path = sys.argv[2] + scale_factor = int(sys.argv[3]) + except Exception: + print('usage: python hqx.py ') + exit(-1) + + img = cv2.imread(file_path) + cv2.imwrite(out_path, hqx(img, scale_factor)) + + +if __name__ == '__main__': + main() diff --git a/modules/postprocess/icbi.py b/modules/postprocess/icbi.py new file mode 100644 index 000000000..e65706069 --- /dev/null +++ b/modules/postprocess/icbi.py @@ -0,0 +1,225 @@ +''' +This is the python implementation of icbi.m + +Author: gyf +Begin: 2019-1-16 +''' +import numpy as np +import cv2 + + +def icbi(IM,ZK = 1,SZ = 8,PF = 1,ST = 20,TM = 100,TC = 50,SC = 1,TS = 100,AL = 1,BT = -1,GM = 5): + ''' + + :param IM: Source image + :param ZK: Power of zoom factor (default:1) + :param SZ: Number of image bits per layer (default:8) + :param PF: Potential to be minimized (default:1) + :param ST: Maximum number of iterations (default:20) + :param TM: Maximum edge step (default:100) + :param TC: Edge continuity threshold (deafult:50). + :param SC: Stopping criterion: 1 = change under threshold, 0 = ST iterations (default:1). + :param TS: Threshold on image change for stopping iterations (default:100). + :param AL: Weight for Curvature Continuity energy (default:1.0). + :param BT: Weight for Curvature enhancement energy (default:-1.0). + :param GM: Weight for Isophote smoothing energy (default:5.0). + :return: EI: Enlarged image + ''' + H = IM.shape[0] + W = IM.shape[1] + if ZK < 1: + EI = cv2.resize(IM,(H*(2**ZK),W*(2**ZK))) + + #check image type + IDIM = np.ndim(IM) + if IDIM == 3: + CL = IM.shape[2] #number of colors + + elif IDIM == 2: + IM = np.reshape(IM,(H,W,1)) + CL = 1 + else: + print('Unrecognized image type, please use RGB or grayscale images') + return 0 + + + #calculate final size + fm = H * (2**ZK) - (2**ZK - 1) + fn = W * (2**ZK) - (2**ZK - 1) + + #initialize output image + if SZ>32: + EI = np.zeros([fm,fn,CL],dtype= np.uint64) + + elif SZ>16: + EI = np.zeros([fm,fn,CL],dtype= np.uint32) + + elif SZ>8: + EI = np.zeros([fm,fn,CL],dtype= np.uint16) + + else: + EI = np.zeros([fm,fn,CL],dtype= np.uint8) + + #each image color + IMG = IM.copy() + for CID in range(CL): + IMG = IM[:,:,CID] + #The image is enlarged by scaling factor 2**ZK-1 at each cycle + for _ZF in range(ZK): + + #size of enlarged image + mm = 2*H - 1 + nn = 2*W - 1 + + #initialize expanded and support matrix + IMGEXP = np.zeros([mm,nn]) + D1 = np.zeros([mm,nn]) + D2 = np.zeros([mm,nn]) + D3 = np.zeros([mm,nn]) + C1 = np.zeros([mm,nn]) + C2 = np.zeros([mm,nn]) + + #copy low resolution grid on high resolution grid + IMGEXP[::2,::2] = IMG + + #interpolation at borders (average value of 2 neighbors) + for i in range(1,mm-1,2): + #left col + IMGEXP[i,0] = (IMGEXP[i-1,0]+IMGEXP[i+1,0])/2 + #right col + IMGEXP[i,nn-1] = (IMGEXP[i-1,nn-1]+IMGEXP[i+1,nn-1])/2 + + for i in range(1,nn,2): + #top row + IMGEXP[0,i] = (IMGEXP[0,i-1] + IMGEXP[0,i+1])/2 + #bottom row + IMGEXP[mm-1,i] = (IMGEXP[mm-1,i-1]+IMGEXP[mm-1,i+1])/2 + + #Calculate interpolated points in two steps + #s = 0 calculates on diagonal directions + #s = 1 calculates on vertical and horizontal directions + for s in range(2): + #FCBI (Fast Curvature Based Interpolation) + for i in range(1,mm-s,2-s): + for j in range(1+(s*(1-np.mod(i+1,2))),nn-s,2): + v1 = np.abs(IMGEXP[i-1,j-1+s]-IMGEXP[i+1,j+1-s]) + v2 = np.abs(IMGEXP[i+1-s,j-1]-IMGEXP[i-1+s,j+1]) + p1 = (IMGEXP[i-1,j-1+s]+IMGEXP[i+1,j+1-s])/2 + p2 = (IMGEXP[i+1-s,j-1]+IMGEXP[i-1+s,j+1])/2 + if (v12-s) and i2-s and j np.abs( IMGEXP[i-3+2*s,j+1+s] + IMGEXP[i-1+2*s,j+3-s] + IMGEXP[i+3-2*s,j-1-s] +IMGEXP[i+1-2*s,j-3+s] + 2*p1-6*p2): + IMGEXP[i,j] = p1 + + else: + IMGEXP[i,j] = p2 + + else: + if v1TC: + c_1 = 0 + + if np.abs(IMGEXP[i-1+s,j-1] - IMGEXP[i,j])>TC: + c_2 = 0 + + if np.abs(IMGEXP[i+1,j-1+s] - IMGEXP[i,j])>TC: + c_3 = 0 + + if np.abs(IMGEXP[i-1,j+1-s] - IMGEXP[i,j])>TC: + c_4 = 0 + + + EN1 = c_1*np.abs(D1[i,j] - D1[i+1-s,j+1]) + c_2*np.abs(D1[i,j] - D1[i-1+s,j-1]) + EN2 = c_3*np.abs(D1[i,j] - D1[i+1,j-1+s]) + c_4*np.abs(D1[i,j] - D1[i-1,j+1-s]) + EN3 = c_1*np.abs(D2[i,j] - D2[i+1-s,j+1]) + c_2*np.abs(D2[i,j] - D2[i-1+s,j-1]) + EN4 = c_3*np.abs(D2[i,j] - D2[i+1,j-1+s]) + c_4*np.abs(D2[i,j] - D2[i-1,j+1-s]) + EN5 = np.abs(IMGEXP[i-2+2*s,j-2] + IMGEXP[i+2-2*s,j+2] - 2*IMGEXP[i,j]) + EN6 = np.abs(IMGEXP[i+2,j-2+2*s] + IMGEXP[i-2,j+2-2*s] - 2*IMGEXP[i,j]) + + EA1 = c_1*np.abs(D1[i,j] - D1[i+1-s,j+1] - 3*step) + c_2*np.abs(D1[i,j] - D1[i-1+s,j-1] - 3*step) + EA2 = c_3*np.abs(D1[i,j] - D1[i+1,j-1+s] - 3*step) + c_4*np.abs(D1[i,j] - D1[i-1,j+1-s] - 3*step) + EA3 = c_1*np.abs(D2[i,j] - D2[i+1-s,j+1] - 3*step) + c_2*np.abs(D2[i,j] - D2[i-1+s,j-1] - 3*step) + EA4 = c_3*np.abs(D2[i,j] - D2[i+1,j-1+s] - 3*step) + c_4*np.abs(D2[i,j] - D2[i-1,j+1-s] - 3*step) + EA5 = np.abs(IMGEXP[i-2+2*s,j-2] + IMGEXP[i+2-2*s,j+2] - 2*IMGEXP[i,j] - 2*step) + EA6 = np.abs(IMGEXP[i+2,j-2+2*s] + IMGEXP[i-2,j+2-2*s] - 2*IMGEXP[i,j] - 2*step) + + ES1 = c_1*np.abs(D1[i,j] - D1[i+1-s,j+1] + 3*step) + c_2*np.abs(D1[i,j] - D1[i-1+s,j-1] + 3*step) + ES2 = c_3*np.abs(D1[i,j] - D1[i+1,j-1+s] + 3*step) + c_4*np.abs(D1[i,j] - D1[i-1,j+1-s] + 3*step) + ES3 = c_1*np.abs(D2[i,j] - D2[i+1-s,j+1] + 3*step) + c_2*np.abs(D2[i,j] - D2[i-1+s,j-1] + 3*step) + ES4 = c_3*np.abs(D2[i,j] - D2[i+1,j-1+s] + 3*step) + c_4*np.abs(D2[i,j] - D2[i-1,j+1-s] + 3*step) + ES5 = np.abs(IMGEXP[i-2+2*s,j-2] + IMGEXP[i+2-2*s,j+2] - 2*IMGEXP[i,j] + 2*step) + ES6 = np.abs(IMGEXP[i+2,j-2+2*s] + IMGEXP[i-2,j+2-2*s] - 2*IMGEXP[i,j] + 2*step) + + EISO = (C1[i,j]*C1[i,j]*D2[i,j] - 2*C1[i,j]*C2[i,j]*D3[i,j] + C2[i,j]*C2[i,j]*D1[i,j])/(C1[i,j]*C1[i,j]+C2[i,j]*C2[i,j]) + + if np.abs(EISO) < 0.2: + EISO = 0 + + if PF==1: + EN = AL*(EN1 + EN2 + EN3 + EN4) + BT*(EN5 + EN6) + EA = AL*(EA1 + EA2 + EA3 + EA4) + BT*(EA5 + EA6) + ES = AL*(ES1 + ES2 + ES3 + ES4) + BT*(ES5 + ES6) + + elif PF==2: + EN = AL*(EN1 + EN2 + EN3 + EN4) + EA = AL*(EA1 + EA2 + EA3 + EA4) - GM*np.sign(EISO) + ES = AL*(ES1 + ES2 + ES3 + ES4) - GM*np.sign(EISO) + + else: + EN = AL*(EN1 + EN2 + EN3 + EN4) + BT*(EN5 + EN6) + EA = AL*(EA1 + EA2 + EA3 + EA4) + BT*(EA5 + EA6) - GM*np.sign(EISO) + ES = AL*(ES1 + ES2 + ES3 + ES4) + BT*(ES5 + ES6) + GM*np.sign(EISO) + + if (EN>EA) and (ES>EA): + IMGEXP[i,j] = IMGEXP[i,j] + step + diff = diff + step + + elif (EN>ES) and (EA>ES): + IMGEXP[i,j] = IMGEXP[i,j] - step + diff = diff + step + + if (SC==1) and (diff Date: Thu, 5 Feb 2026 11:21:59 +0100 Subject: [PATCH 06/25] update modernui Signed-off-by: vladmandic --- extensions-builtin/sdnext-modernui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions-builtin/sdnext-modernui b/extensions-builtin/sdnext-modernui index 188dd69e7..90182f887 160000 --- a/extensions-builtin/sdnext-modernui +++ b/extensions-builtin/sdnext-modernui @@ -1 +1 @@ -Subproject commit 188dd69e7532f1d9db8174c8fcc67b47b2625aed +Subproject commit 90182f8875d05584005ea8e477387827cb11fb36 From e5ebc4e5a2458b085277e3d40583b9d18c9b1cf1 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Thu, 5 Feb 2026 12:14:09 +0100 Subject: [PATCH 07/25] update changelog Signed-off-by: vladmandic --- CHANGELOG.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a3739845..8d964c589 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,12 @@ Bugfix refresh -- add metadata restore to always-on scripts -- improve wildcard weights parsing, thanks @Tillerz -- fix `anima` model detection -- reorganize `cli` scripts +- fix: add metadata restore to always-on scripts +- fix: improve wildcard weights parsing, thanks @Tillerz +- fix: `anima` model detection +- refactor: reorganize `cli` scripts - upscalers: hqx, icbi +- ui: add CTD-NT64Light theme, thanks @resonantsky ## Update for 2026-02-04 From dd80e15cfda63583791fe27d7a5880f01d3c96aa Mon Sep 17 00:00:00 2001 From: vladmandic Date: Thu, 5 Feb 2026 14:06:17 +0100 Subject: [PATCH 08/25] add RealPLKSR NomosWebPhoto and AnimeSharpV2 using spandrel engine Signed-off-by: vladmandic --- CHANGELOG.md | 21 ++++++++------ modules/upscaler_spandrel.py | 55 ++++++++++++++++++++++++++++++++++++ modules/upscaler_vae.py | 7 +++++ webui.py | 1 + 4 files changed, 76 insertions(+), 8 deletions(-) create mode 100644 modules/upscaler_spandrel.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d964c589..580d649bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,14 +2,19 @@ ## Update for 2026-02-05 -Bugfix refresh - -- fix: add metadata restore to always-on scripts -- fix: improve wildcard weights parsing, thanks @Tillerz -- fix: `anima` model detection -- refactor: reorganize `cli` scripts -- upscalers: hqx, icbi -- ui: add CTD-NT64Light theme, thanks @resonantsky +- **UI** + - ui: add CTD-NT64Light theme, thanks @resonantsky +- **Internal** + - refactor: reorganize `cli` scripts +- **Upscalers** + - add support for [spandrel](https://github.com/chaiNNer-org/spandrel) + upscaling engine with suport for new upscaling families + - add two new ai upscalers: *RealPLKSR NomosWebPhoto* and *RealPLKSR AnimeSharpV2* + - add two new interpolation methods: *HQX* and *ICB* +- **Fixes** + - fix: add metadata restore to always-on scripts + - fix: improve wildcard weights parsing, thanks @Tillerz + - fix: `anima` model detection ## Update for 2026-02-04 diff --git a/modules/upscaler_spandrel.py b/modules/upscaler_spandrel.py new file mode 100644 index 000000000..975685efe --- /dev/null +++ b/modules/upscaler_spandrel.py @@ -0,0 +1,55 @@ +import os +import time +from PIL import Image +from modules.upscaler import Upscaler, UpscalerData +from modules import devices, paths +from modules.shared import log + + +MODELS = { + "Spandrel 4x RealPLKSR NomosWebPhoto": "https://huggingface.co/vladmandic/sdnext-upscalers/resolve/main/4xNomosWebPhoto_RealPLKSR.safetensors", + "Spandrel 2x RealPLKSR AnimeSharpV2": "https://huggingface.co/vladmandic/sdnext-upscalers/resolve/main/2x-AnimeSharpV2_RPLKSR_Sharp.pth", +} + +class UpscalerSpandrel(Upscaler): + def __init__(self, dirname=None): # pylint: disable=unused-argument + super().__init__(False) + self.name = "Spandrel" + self.model_path = os.path.join(paths.models_path, 'Spandrel') + self.user_path = os.path.join(paths.models_path, 'Spandrel') + self.selected = None + self.model = None + self.scalers = [] + for model_name, model_path in MODELS.items(): + scaler = UpscalerData(name=model_name, path=model_path, upscaler=self) + self.scalers.append(scaler) + + def process(self, img: Image.Image) -> Image.Image: + import torchvision.transforms.functional as TF + tensor = TF.to_tensor(img).unsqueeze(0).to(devices.device) + img = img.convert('RGB') + t0 = time.time() + with devices.inference_context(): + tensor = self.model(tensor) + tensor = tensor.clamp(0, 1).squeeze(0).cpu() + t1 = time.time() + upscaled = TF.to_pil_image(tensor) + log.debug(f'Upscale: name="{self.selected}" input={img.size} output={upscaled.size} time={t1 - t0:.2f}') + return upscaled + + def do_upscale(self, img: Image, selected_model=None): + from installer import install + if selected_model is None: + return img + install('spandrel') + try: + import spandrel + if (self.model is None) or (self.selected != selected_model): + self.selected = selected_model + model = self.find_model(selected_model) + self.model = spandrel.ModelLoader().load_from_file(model.local_data_path) + self.model.to(devices.device).eval() + return self.process(img) + except Exception as e: + log.error(f'Spandrel: {e}') + return img diff --git a/modules/upscaler_vae.py b/modules/upscaler_vae.py index b8887bc6a..a8c014ee4 100644 --- a/modules/upscaler_vae.py +++ b/modules/upscaler_vae.py @@ -1,3 +1,4 @@ +import time from PIL import Image from modules.upscaler import Upscaler, UpscalerData @@ -30,12 +31,15 @@ class UpscalerAsymmetricVAE(Upscaler): self.vae.eval() self.selected = selected_model shared.log.debug(f'Upscaler load: selected="{self.selected}" vae="{repo_id}"') + t0 = time.time() img = img.resize((8 * (img.width // 8), 8 * (img.height // 8)), resample=Image.Resampling.LANCZOS).convert('RGB') tensor = (F.pil_to_tensor(img).unsqueeze(0) / 255.0).to(device=devices.device, dtype=devices.dtype) self.vae = self.vae.to(device=devices.device) tensor = self.vae(tensor).sample upscaled = F.to_pil_image(tensor.squeeze().clamp(0.0, 1.0).float().cpu()) self.vae = self.vae.to(device=devices.cpu) + t1 = time.time() + shared.log.debug(f'Upscale: name="{self.selected}" input={img.size} output={upscaled.size} time={t1 - t0:.2f}') return upscaled @@ -73,6 +77,7 @@ class UpscalerWanUpscale(Upscaler): self.selected = selected_model shared.log.debug(f'Upscaler load: selected="{self.selected}" encode="{repo_encode}" decode="{repo_decode}"') + t0 = time.time() self.vae_encode = self.vae_encode.to(device=devices.device) tensor = (F.pil_to_tensor(img).unsqueeze(0).unsqueeze(2) / 255.0).to(device=devices.device, dtype=devices.dtype) tensor = self.vae_encode.encode(tensor).latent_dist.mode() @@ -84,4 +89,6 @@ class UpscalerWanUpscale(Upscaler): self.vae_decode.to(device=devices.cpu) upscaled = F.to_pil_image(tensor.squeeze().clamp(0.0, 1.0).float().cpu()) + t1 = time.time() + shared.log.debug(f'Upscale: name="{self.selected}" input={img.size} output={upscaled.size} time={t1 - t0:.2f}') return upscaled diff --git a/webui.py b/webui.py index 55e459781..de6ecf832 100644 --- a/webui.py +++ b/webui.py @@ -39,6 +39,7 @@ import modules.upscaler import modules.upscaler_simple import modules.upscaler_vae import modules.upscaler_algo +import modules.upscaler_spandrel import modules.extra_networks import modules.ui_extra_networks import modules.textual_inversion From 9df9b84752874f7c6c64af312581e7a343e6d633 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Thu, 5 Feb 2026 16:55:06 +0100 Subject: [PATCH 09/25] fix anima Signed-off-by: vladmandic --- modules/postprocess/hqx.py | 6 +++--- modules/sd_detect.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/postprocess/hqx.py b/modules/postprocess/hqx.py index 44aa93ed1..70de47c25 100644 --- a/modules/postprocess/hqx.py +++ b/modules/postprocess/hqx.py @@ -136,7 +136,7 @@ def hqx( img: cv2.Mat, scale_factor: int ) -> cv2.Mat: return scaled_img -def hq2x( width: int, height: int, src, dest ) -> None: # noqa:C901 +def hq2x( width: int, height: int, src, dest ) -> None: # noqa:C901 # pylint: disable=too-many-branches, too-many-statements w = [None] * 10 dpL = width << 1 dp = 0 @@ -1558,7 +1558,7 @@ def hq2x( width: int, height: int, src, dest ) -> None: # noqa:C901 dp += dpL -def hq3x( width: int, height: int, src, dest ) -> None: # noqa:C901 +def hq3x( width: int, height: int, src, dest ) -> None: # noqa:C901 # pylint: disable=too-many-branches, too-many-statements w = [None] * 10 dpL = width * 3 dp = 0 @@ -3952,7 +3952,7 @@ def hq3x( width: int, height: int, src, dest ) -> None: # noqa:C901 dp += (dpL << 1) -def hq4x( width: int, height: int, src, dest ) -> None: # noqa:C901 +def hq4x( width: int, height: int, src, dest ) -> None: # noqa:C901 # pylint: disable=too-many-branches, too-many-statements w = [None] * 10 dpL = width << 2 dp = 0 diff --git a/modules/sd_detect.py b/modules/sd_detect.py index a6de43d4e..53a6cccf9 100644 --- a/modules/sd_detect.py +++ b/modules/sd_detect.py @@ -103,7 +103,7 @@ def guess_by_name(fn, current_guess): new_guess = 'FLUX' elif 'flex.2' in fn.lower(): new_guess = 'FLEX' - elif fn.lower().strip().endswith('anima'): + elif fn.lower().endswith('anima') or 'anima-' in fn.lower(): new_guess = 'Anima' elif 'cosmos-predict2' in fn.lower(): new_guess = 'Cosmos' From 059cbaf4702b8f78f092166b7ddcb7dfb5d2988f Mon Sep 17 00:00:00 2001 From: vladmandic Date: Thu, 5 Feb 2026 16:55:21 +0100 Subject: [PATCH 10/25] update modernui Signed-off-by: vladmandic --- extensions-builtin/sdnext-modernui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions-builtin/sdnext-modernui b/extensions-builtin/sdnext-modernui index 90182f887..761d4a0fe 160000 --- a/extensions-builtin/sdnext-modernui +++ b/extensions-builtin/sdnext-modernui @@ -1 +1 @@ -Subproject commit 90182f8875d05584005ea8e477387827cb11fb36 +Subproject commit 761d4a0fe28ce839795ccd3336791cd7ab57257a From 40cbd33cbd3fc26cead08dd07f026b3918cb3c9c Mon Sep 17 00:00:00 2001 From: vladmandic Date: Thu, 5 Feb 2026 16:57:30 +0100 Subject: [PATCH 11/25] add CTD-NT64Dark theme Signed-off-by: vladmandic --- CHANGELOG.md | 2 +- extensions-builtin/sdnext-modernui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 580d649bf..fa6b81912 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## Update for 2026-02-05 - **UI** - - ui: add CTD-NT64Light theme, thanks @resonantsky + - ui: add *CTD-NT64Light* and *CTD-NT64Dark* themes, thanks @resonantsky - **Internal** - refactor: reorganize `cli` scripts - **Upscalers** diff --git a/extensions-builtin/sdnext-modernui b/extensions-builtin/sdnext-modernui index 761d4a0fe..ead16e144 160000 --- a/extensions-builtin/sdnext-modernui +++ b/extensions-builtin/sdnext-modernui @@ -1 +1 @@ -Subproject commit 761d4a0fe28ce839795ccd3336791cd7ab57257a +Subproject commit ead16e14410ff177e2e4e105bcbec3eaa737de7d From 339dff59f80f5bec80c9d97110510587985fbd62 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Thu, 5 Feb 2026 17:04:49 +0100 Subject: [PATCH 12/25] update diffusers Signed-off-by: vladmandic --- CHANGELOG.md | 1 + installer.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa6b81912..67cfc203c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - **UI** - ui: add *CTD-NT64Light* and *CTD-NT64Dark* themes, thanks @resonantsky - **Internal** + - pipelines: add ZImageInpaint, thanks @CalamitousFelicitousness - refactor: reorganize `cli` scripts - **Upscalers** - add support for [spandrel](https://github.com/chaiNNer-org/spandrel) diff --git a/installer.py b/installer.py index 84790cac0..40dc76c24 100644 --- a/installer.py +++ b/installer.py @@ -665,7 +665,7 @@ def check_diffusers(): t_start = time.time() if args.skip_all: return - sha = '430c557b6a66a3c2b5740fb186324cb8a9f0f2e9' # diffusers commit hash + sha = '99e2cfff27dec514a43e260e885c5e6eca038b36' # diffusers commit hash # if args.use_rocm or args.use_zluda or args.use_directml: # sha = '043ab2520f6a19fce78e6e060a68dbc947edb9f9' # lock diffusers versions for now pkg = pkg_resources.working_set.by_key.get('diffusers', None) From 6520784487b155bd8a50bff3022322a5abfafffe Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Thu, 5 Feb 2026 15:11:23 -0800 Subject: [PATCH 13/25] Fix recursive folder cleanup --- javascript/gallery.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/javascript/gallery.js b/javascript/gallery.js index f72ddc29f..5b18205be 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -999,7 +999,9 @@ async function thumbCacheCleanup(folder, imgCount, controller, force = false) { log(`Thumbnail DB cleanup: Checking if "${folder}" needs cleaning`); const t0 = performance.now(); const keptGalleryHashes = force ? new Set() : new Set(galleryHashes.values()); // External context should be safe since this function run is guarded by AbortController/AbortSignal in the SimpleFunctionQueue - const cachedHashesCount = await idbCount(folder) + const folderNormalized = folder.replace(/\/+/g, '/').replace(/\/$/, ''); + const recursiveFolder = IDBKeyRange.bound(folderNormalized, `${folderNormalized}\uffff`, false, true); + const cachedHashesCount = await idbCount(recursiveFolder) .catch((e) => { error(`Thumbnail DB cleanup: Error when getting entry count for "${folder}".`, e); return Infinity; // Forces next check to fail if something went wrong @@ -1015,7 +1017,7 @@ async function thumbCacheCleanup(folder, imgCount, controller, force = false) { return; } const cb_clearMsg = showCleaningMsg(cleanupCount); - await idbFolderCleanup(keptGalleryHashes, folder, controller.signal) + await idbFolderCleanup(keptGalleryHashes, recursiveFolder, controller.signal) .then((delcount) => { const t1 = performance.now(); log(`Thumbnail DB cleanup: folder=${folder} kept=${keptGalleryHashes.size} deleted=${delcount} time=${Math.floor(t1 - t0)}ms`); From e7d382dc29b24d7f3ae3ada2e7658d40921e177a Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Thu, 5 Feb 2026 15:15:33 -0800 Subject: [PATCH 14/25] Restore saving full folder path to database --- javascript/gallery.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/javascript/gallery.js b/javascript/gallery.js index 5b18205be..0d7498bef 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -391,13 +391,14 @@ class GalleryFile extends HTMLElement { this.folder = folder; this.name = file; this.#signal = signal; + this.src = `${this.folder}/${this.name}`; + this.fullFolder = this.src.replace(/\/+/g, '/').replace(/\/[^/]+$/, ''); this.size = 0; this.mtime = 0; this.hash = undefined; this.exif = ''; this.width = 0; this.height = 0; - this.src = `${this.folder}/${this.name}`; this.shadow = this.attachShadow({ mode: 'open' }); this.shadow.adoptedStyleSheets = [fileStylesheet]; @@ -458,7 +459,7 @@ class GalleryFile extends HTMLElement { if (opts.browser_cache) { await idbAdd({ hash: this.hash, - folder: this.folder, + folder: this.fullFolder, file: this.name, size: this.size, mtime: this.mtime, From f4bb78b51cabcd7b67d2e000f22d561d38a59acf Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Thu, 5 Feb 2026 15:16:13 -0800 Subject: [PATCH 15/25] Update types in JSDoc --- javascript/indexdb.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/javascript/indexdb.js b/javascript/indexdb.js index 81c165f74..4e11e1498 100644 --- a/javascript/indexdb.js +++ b/javascript/indexdb.js @@ -144,10 +144,10 @@ async function idbGetAllKeys(index = null, query = null) { /** * Get the number of entries in the IndexedDB thumbnail cache. * @global - * @param {?string} folder - If specified, get the count for this gallery folder. Otherwise get the total count. + * @param {IDBValidKey | IDBKeyRange | undefined} folder - If specified, get the count for this gallery folder. Otherwise get the total count. * @returns {Promise} */ -async function idbCount(folder = null) { +async function idbCount(folder) { if (!db) return null; return new Promise((resolve, reject) => { try { @@ -173,7 +173,7 @@ async function idbCount(folder = null) { * Cleanup function for IndexedDB thumbnail cache. * @global * @param {Set} keepSet - Set containing the hashes of the current files in the folder - * @param {string} folder - Folder name/path + * @param {IDBValidKey | IDBKeyRange} folder - Folder name/path or range * @param {AbortSignal} signal - Signal from the AbortController for thumbCacheCleanup() */ async function idbFolderCleanup(keepSet, folder, signal) { From 137504de363bb33fe557f47c6021fa1a77e74a74 Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Thu, 5 Feb 2026 15:18:07 -0800 Subject: [PATCH 16/25] Remove extra type checking... - JSDoc should automatically apply the types to the variables/parameters in the IDE to provide a warning when the wrong value is being sent. --- javascript/indexdb.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/javascript/indexdb.js b/javascript/indexdb.js index 4e11e1498..6f5cb3d53 100644 --- a/javascript/indexdb.js +++ b/javascript/indexdb.js @@ -178,13 +178,6 @@ async function idbCount(folder) { */ async function idbFolderCleanup(keepSet, folder, signal) { if (!db) return null; - if (!(keepSet instanceof Set)) { - throw new TypeError('IndexedDB cleaning function must be given a Set() of the current gallery hashes'); - } - if (typeof folder !== 'string') { - throw new Error('IndexedDB cleaning function must be told the current active folder'); - } - let removals = new Set(await idbGetAllKeys('folder', folder)); removals = removals.difference(keepSet); // Don't need to keep full set in memory const totalRemovals = removals.size; From 6d30df7ed6744b6f29193c152e7e2259b715c690 Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Thu, 5 Feb 2026 15:55:18 -0800 Subject: [PATCH 17/25] Adjust input normalization --- javascript/gallery.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/javascript/gallery.js b/javascript/gallery.js index 0d7498bef..ecb3750c0 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -391,8 +391,8 @@ class GalleryFile extends HTMLElement { this.folder = folder; this.name = file; this.#signal = signal; - this.src = `${this.folder}/${this.name}`; - this.fullFolder = this.src.replace(/\/+/g, '/').replace(/\/[^/]+$/, ''); + this.src = `${this.folder}/${this.name}`.replace(/\/+/g, '/'); // Ensure no //, ///, etc... + this.fullFolder = this.src.replace(/\/[^/]+$/, ''); this.size = 0; this.mtime = 0; this.hash = undefined; From d7da93e814b280ffe3568e30ba7c5c5fafd9c8a1 Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Thu, 5 Feb 2026 16:25:11 -0800 Subject: [PATCH 18/25] Remove redundant code... - `src` is now normalized in advance. - There's no ending `/` to remove because it's a file. --- javascript/gallery.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/javascript/gallery.js b/javascript/gallery.js index ecb3750c0..44045cc4d 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -419,9 +419,7 @@ class GalleryFile extends HTMLElement { } } - // Normalize path to ensure consistent hash regardless of which folder view is used - const normalizedPath = this.src.replace(/\/+/g, '/').replace(/\/$/, ''); - this.hash = await getHash(`${normalizedPath}/${this.size}/${this.mtime}`); // eslint-disable-line no-use-before-define + this.hash = await getHash(`${this.src}/${this.size}/${this.mtime}`); // eslint-disable-line no-use-before-define const cachedData = (this.hash && opts.browser_cache) ? await idbGet(this.hash).catch(() => undefined) : undefined; const img = document.createElement('img'); img.className = 'gallery-file'; From 8bfa612902b5b7bff266c529782d4cd3da5049f4 Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Thu, 5 Feb 2026 16:43:37 -0800 Subject: [PATCH 19/25] Fix typo --- modules/shared.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/shared.py b/modules/shared.py index b3dec7abf..7227b9975 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -575,7 +575,7 @@ options_templates.update(options_section(('saving-paths', "Image Paths"), { "outdir_init_images": OptionInfo("outputs/inputs", "Folder for init images", component_args=hide_dirs, folder=True), "outdir_sep_grids": OptionInfo("

Grids

", "", gr.HTML), - "outdir_grids": OptionInfo("", "Base grids folde", component_args=hide_dirs, folder=True), + "outdir_grids": OptionInfo("", "Base grids folder", component_args=hide_dirs, folder=True), "outdir_txt2img_grids": OptionInfo("outputs/grids", 'Folder for txt2img grids', component_args=hide_dirs, folder=True), "outdir_img2img_grids": OptionInfo("outputs/grids", 'Folder for img2img grids', component_args=hide_dirs, folder=True), "outdir_control_grids": OptionInfo("outputs/grids", 'Folder for control grids', component_args=hide_dirs, folder=True), From 1696d0cd2954bf5117904cf608895679cff04cd6 Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Thu, 5 Feb 2026 16:54:23 -0800 Subject: [PATCH 20/25] Update monitored options --- javascript/gallery.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/javascript/gallery.js b/javascript/gallery.js index 44045cc4d..95ce842c6 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -1303,7 +1303,21 @@ async function initGallery() { // triggered on gradio change to monitor when ui monitorGalleries(); updateFolders(); - monitorOption('browser_folders', updateFolders); + [ + 'browser_folders', + 'outdir_samples', + 'outdir_txt2img_samples', + 'outdir_img2img_samples', + 'outdir_control_samples', + 'outdir_extras_samples', + 'outdir_save', + 'outdir_video', + 'outdir_init_images', + 'outdir_grids', + 'outdir_txt2img_grids', + 'outdir_img2img_grids', + 'outdir_control_grids', + ].forEach((op) => { monitorOption(op, updateFolders); }); } // register on startup From 0c0911eddcde66ae296e54d42f1e67fcca8f2a43 Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Fri, 6 Feb 2026 00:43:03 -0800 Subject: [PATCH 21/25] Adjust click handlers for `GalleryFolder` --- javascript/gallery.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/javascript/gallery.js b/javascript/gallery.js index f72ddc29f..f5ce1c51c 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -339,8 +339,8 @@ class GalleryFolder extends HTMLElement { this.div.className = 'gallery-folder'; this.div.innerHTML = `\uf03e ${this.label}`; this.div.title = this.name; // Show full path on hover - this.div.addEventListener('click', () => { this.updateSelected(); }); // Ensures 'this' isn't the div in the called method - this.div.addEventListener('click', fetchFilesWS); // eslint-disable-line no-use-before-define + this.addEventListener('click', this.updateSelected); + this.addEventListener('click', fetchFilesWS); // eslint-disable-line no-use-before-define this.shadow.appendChild(this.div); GalleryFolder.folders.add(this); } @@ -1150,7 +1150,7 @@ async function fetchFilesWS(evt) { // fetch file-by-file list over websockets let wsConnected = false; try { ws = new WebSocket(`${url}/sdapi/v1/browser/files`); - wsConnected = await wsConnect(ws); // Warning. This changes "evt". + wsConnected = await wsConnect(ws); } catch (err) { log('gallery: ws connect error', err); return; From 171ead0fa26f1b59bbb0fa6849b944c6e51aec28 Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Fri, 6 Feb 2026 00:43:58 -0800 Subject: [PATCH 22/25] Auto-select current folder after refresh --- javascript/gallery.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/javascript/gallery.js b/javascript/gallery.js index f5ce1c51c..625224609 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -343,6 +343,9 @@ class GalleryFolder extends HTMLElement { this.addEventListener('click', fetchFilesWS); // eslint-disable-line no-use-before-define this.shadow.appendChild(this.div); GalleryFolder.folders.add(this); + if (this.name === currentGalleryFolder) { + this.updateSelected(); + } } async disconnectedCallback() { From f84cb6ac64aa3dad5f19189b1c189e13730ea4ae Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Fri, 6 Feb 2026 00:44:48 -0800 Subject: [PATCH 23/25] Track active gallery element --- javascript/gallery.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/javascript/gallery.js b/javascript/gallery.js index 625224609..b61663c62 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -315,6 +315,8 @@ class SimpleFunctionQueue { class GalleryFolder extends HTMLElement { static folders = new Set(); + /** @type {GalleryFolder | null} */ + static #active = null; constructor(folder) { super(); @@ -352,10 +354,18 @@ class GalleryFolder extends HTMLElement { await Promise.resolve(); // Wait for other microtasks (such as element moving) if (this.isConnected) return; GalleryFolder.folders.delete(this); + if (GalleryFolder.#active === this) { + GalleryFolder.#active = null; + } + } + + static getActive() { + return GalleryFolder.#active; } updateSelected() { this.div.classList.add('gallery-folder-selected'); + GalleryFolder.#active = this; for (const folder of GalleryFolder.folders) { if (folder !== this) { folder.div.classList.remove('gallery-folder-selected'); From ade7c2e5f9564795e3cc466a3a23d6cee1825ffe Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Fri, 6 Feb 2026 00:50:04 -0800 Subject: [PATCH 24/25] Add auto-update setting and functionality --- javascript/gallery.js | 37 +++++++++++++++++++++++++++++++++++++ modules/shared.py | 1 + 2 files changed, 38 insertions(+) diff --git a/javascript/gallery.js b/javascript/gallery.js index b61663c62..78dda3bf2 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -1271,6 +1271,43 @@ async function galleryClearInit() { }, 1000); } +async function initGalleryAutoRefresh() { + const isModern = opts.theme_type?.toLowerCase() === 'modern'; + let galleryTab = isModern ? document.getElementById('gallery_tabitem') : document.getElementById('tab_gallery'); + let timeout = 0; + while (!galleryTab && timeout++ < 60) { + await new Promise((resolve) => { setTimeout(resolve, 1000); }); + galleryTab = isModern ? document.getElementById('gallery_tabitem') : document.getElementById('tab_gallery'); + } + if (!galleryTab) { + throw new Error('Timed out waiting for gallery tab element'); + } + const displayNoneRegEx = /display:\s*none/; + async function galleryAutoRefresh(mutations) { + if (!opts.browser_gallery_autoupdate) return; + for (const mutation of mutations) { + switch (mutation.attributeName) { + case 'class': + if (mutation.oldValue.includes('hidden') && !mutation.target.classList.contains('hidden')) { + await updateFolders(); + GalleryFolder.getActive()?.click(); + } + break; + case 'style': + if (displayNoneRegEx.test(mutation.oldValue) && !displayNoneRegEx.test(mutation.target.style.display)) { + await updateFolders(); + GalleryFolder.getActive()?.click(); + } + break; + default: + break; + } + } + } + const galleryVisObserver = new MutationObserver(galleryAutoRefresh); + galleryVisObserver.observe(galleryTab, { attributeFilter: ['class', 'style'], attributeOldValue: true }); +} + async function blockQueueUntilReady() { // Add block to maintenanceQueue until cache is ready maintenanceQueue.enqueue({ diff --git a/modules/shared.py b/modules/shared.py index b3dec7abf..a29874001 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -535,6 +535,7 @@ options_templates.update(options_section(('saving-images', "Image Options"), { "image_sep_browser": OptionInfo("

Image Gallery

", "", gr.HTML), "browser_cache": OptionInfo(True, "Use image gallery cache"), "browser_folders": OptionInfo("", "Additional image browser folders"), + "browser_gallery_autoupdate": OptionInfo(False, "Automatically update when switching to the gallery"), "browser_fixed_width": OptionInfo(False, "Use fixed width thumbnails"), "viewer_show_metadata": OptionInfo(True, "Show metadata in full screen image browser"), From ef75acffb40814a6a4fe9b3d568c6e97fe9665c1 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Fri, 6 Feb 2026 14:11:43 +0100 Subject: [PATCH 25/25] update changelog Signed-off-by: vladmandic --- CHANGELOG.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67cfc203c..7dc0133ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,20 +1,23 @@ # Change Log for SD.Next -## Update for 2026-02-05 +## Update for 2026-02-06 -- **UI** - - ui: add *CTD-NT64Light* and *CTD-NT64Dark* themes, thanks @resonantsky -- **Internal** - - pipelines: add ZImageInpaint, thanks @CalamitousFelicitousness - - refactor: reorganize `cli` scripts - **Upscalers** - add support for [spandrel](https://github.com/chaiNNer-org/spandrel) - upscaling engine with suport for new upscaling families + upscaling engine with suport for new upscaling model families - add two new ai upscalers: *RealPLKSR NomosWebPhoto* and *RealPLKSR AnimeSharpV2* - add two new interpolation methods: *HQX* and *ICB* +- **Features** + - pipelines: add **ZImageInpaint**, thanks @CalamitousFelicitousness +- **UI** + - ui: **themes** add *CTD-NT64Light* and *CTD-NT64Dark*, thanks @resonantsky + - ui: **gallery** add option to auto-refresh gallery, thanks @awsr +- **Internal** + - refactor: reorganize `cli` scripts - **Fixes** - fix: add metadata restore to always-on scripts - fix: improve wildcard weights parsing, thanks @Tillerz + - fix: ui gallery cace recursive cleanup, thanks @awsr - fix: `anima` model detection ## Update for 2026-02-04