Advertisement
jargon

// Shared :: "Legacy/Graphics/Minimal Video Exchange.js"

Sep 26th, 2024
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 17.90 KB | Gaming | 0 0
  1. // Shared :: "Legacy/Graphics/Minimal Video Exchange.js"
  2.  
  3. // Shared :: "Legacy/Graphics/Load TIL.js"
  4.  
  5. // Function to load a TIL file with variable bit depth (GW-BASIC TILE format).
  6. function loadTIL(fileData, tileWidth, tileHeight, bitDepth) {
  7.    
  8.     const tileSize = (tileWidth * tileHeight * bitDepth) / 8;
  9.     const tiles = [];
  10.     const numTiles = fileData.length / tileSize;
  11.  
  12.     for (let i = 0; i < numTiles; i++) {
  13.        
  14.         const tile = new Uint8Array(tileWidth * tileHeight);
  15.         const tileData = fileData.slice(i * tileSize, (i + 1) * tileSize);
  16.        
  17.         switch(bitDepth) {
  18.             case 8:
  19.                 for (let j = 0; j < tileWidth * tileHeight; j++) {
  20.                     tile[j] = tileData[j];
  21.                 }
  22.                 break;
  23.                
  24.             case 4:
  25.                 for (let j = 0; j < tileWidth * tileHeight / 2; j++) {
  26.                     tile[j * 2] = (tileData[j] & 0xF0) >> 4;
  27.                     tile[j * 2 + 1] = tileData[j] & 0x0F;
  28.                 }
  29.                 break;
  30.                
  31.             case 2:
  32.                 for (let j = 0; j < tileWidth * tileHeight / 4; j++) {
  33.                     tile[j * 2 + 0] = (tileData[j] & 0xC0) >> 6;
  34.                     tile[j * 2 + 1] = (tileData[j] & 0x30) >> 4;
  35.                     tile[j * 2 + 2] = (tileData[j] & 0x0C) >> 2;
  36.                     tile[j * 2 + 3] = (tileData[j] & 0x03) >> 0;
  37.                 }
  38.                 break;
  39.                
  40.             case 1:
  41.                 for (let j = 0; j < tileData.length; j++) {
  42.                     for (let bit = 0; bit < 8; bit++) {
  43.                         tile[j * 8 + bit] = (tileData[j] >> (7 - bit)) & 0x01;
  44.                     }
  45.                 }
  46.                 break;
  47.                
  48.             default:
  49.                 throw new Error(`Unsupported bit depth: ${bitDepth}`);
  50.             }
  51.  
  52.         tiles.push(tile);
  53.     }
  54.  
  55.     return tiles;
  56. }
  57.  
  58.  
  59.  
  60. // Shared :: "Legacy/Graphics/Save TIL.js"
  61.  
  62. // Function to save a TIL file with variable bit depth (GW-BASIC TILE format).
  63. function saveTIL(tiles, tileWidth, tileHeight, bitDepth) {
  64.    
  65.     const tileSize = (tileWidth * tileHeight * bitDepth) / 8;
  66.     const numTiles = tiles.length;
  67.     const fileData = new Uint8Array(numTiles * tileSize);
  68.  
  69.     for (let i = 0; i < numTiles; i++) {
  70.        
  71.         const tile = tiles[i];
  72.  
  73.         switch (bitDepth){
  74.             case 8:
  75.                 for (let j = 0; j < tileWidth * tileHeight; j++) {
  76.                     fileData[i * tileSize + j] = tile[j];
  77.                 }
  78.                 break;
  79.                
  80.             case 4:
  81.                 for (let j = 0; j < tileWidth * tileHeight / 2; j++) {
  82.                     const highNibble = tile[j * 2] << 4;
  83.                     const lowNibble = tile[j * 2 + 1] & 0x0F;
  84.                     fileData[i * tileSize + j] = highNibble | lowNibble;
  85.                 }
  86.                 break;
  87.                
  88.             case 2:
  89.                 for (let j = 0; j < tileWidth * tileHeight / 2; j++) {
  90.                     const bitC0 = ( tile[j * 4 + 0 ] << 6 ) & 0xC0;
  91.                     const bit30 = ( tile[j * 4 + 1 ] << 4 ) & 0x30;
  92.                     const bit0C = ( tile[j * 4 + 2 ] << 2 ) & 0x0C;
  93.                     const bit03 = ( tile[j * 4 + 3 ] << 0 ) & 0x03;
  94.                     fileData[i * tileSize + j] = bitC0 | bit30 | bit0C | bit03;
  95.                 }
  96.                 break;
  97.                
  98.             case 1:
  99.                 for (let j = 0; j < tileWidth * tileHeight / 8; j++) {
  100.                     let byte = 0;
  101.                     for (let bit = 0; bit < 8; bit++) {
  102.                         const pixelValue = tile[j * 8 + bit] & 0x01;
  103.                         byte |= (pixelValue << (7 - bit));
  104.                     }
  105.                     fileData[i * tileSize + j] = byte;
  106.                 }
  107.                 break;
  108.                
  109.             default:
  110.                 throw new Error(`Unsupported bit depth: ${bitDepth}`);
  111.         }
  112.     }
  113.  
  114.     return fileData;
  115. }
  116.  
  117.  
  118.  
  119. // Shared :: "Legacy/Graphics/Load BSV.js"
  120.  
  121. // Function to load a BSV file with variable bit depth (QBASIC BSAVE format).
  122. function loadBSV(fileData, bitDepth, tileWidth, tileHeight) {
  123.     const headerSize = 7; // Standard BSAVE header size in bytes.
  124.     const imageSize = calculateImageSize(bitDepth, tileWidth, tileHeight);
  125.     const header = fileData.slice(0, headerSize); // First 7 bytes are the header.
  126.     const pixelData = fileData.slice(headerSize, headerSize + imageSize); // The pixel data follows.
  127.    
  128.     const pixels = new Uint8Array(tileWidth * tileHeight);
  129.     switch(bitDepth){
  130.         case 8:
  131.             for (let i = 0; i < pixelData.length; i++) {
  132.                 pixels[i] = pixelData[i]; // Direct mapping for 8-bit depth.
  133.             }
  134.             break;
  135.         case 4:
  136.             for (let i = 0; i < pixelData.length; i++) {
  137.                 pixels[i * 2 + 0] = (pixelData[i] & 0xF0) >> 4; // High nibble.
  138.                 pixels[i * 2 + 1] = pixelData[i] & 0x0F; // Low nibble.
  139.             }
  140.             break;
  141.         case 2:
  142.             for (let i = 0; i < pixelData.length; i++) {
  143.                 pixels[i * 4 + 0] = (pixelData[i] & 0xC0) >> 2; // High nibble.
  144.                 pixels[i * 4 + 1] = pixelData[i] & 0x30; // Low nibble.
  145.                 pixels[i * 4 + 2] = pixelData[i] & 0x0C; // Low nibble.
  146.                 pixels[i * 4 + 3] = pixelData[i] & 0x03; // Low nibble.
  147.             }
  148.             break;
  149.         case 1:
  150.             for (let i = 0; i < pixelData.length; i++) {
  151.                 for (let bit = 0; bit < 8; bit++) {
  152.                     const pixelValue = (pixelData[i] >> (7 - bit)) & 0x01;
  153.                     pixels[i * 8 + bit] = pixelValue; // Extract individual bits.
  154.                 }
  155.             }
  156.             break;
  157.         default:
  158.             throw new Error(`Unsupported bit depth: ${bitDepth}`);
  159.     }
  160.     return pixels;
  161. }
  162.  
  163.  
  164.  
  165. // Shared :: "Legacy/Graphics/Save BSV.js"
  166.  
  167. // Function to save a BSV file with variable bit depth (QBASIC BSAVE format).
  168. function saveBSV(pixels, bitDepth, tileWidth, tileHeight) {
  169.     const headerSize = 7; // Standard BSAVE header size.
  170.     const imageSize = calculateImageSize(bitDepth, tileWidth, tileHeight);
  171.     const fileData = new Uint8Array(headerSize + imageSize);
  172.  
  173.     // Set up the BSAVE header.
  174.     fileData[0] = 0xFD; // 'BSAVE' magic byte.
  175.     fileData[1] = 0x00; // Offset (2 bytes), usually 0x0000 for mode 13h.
  176.     fileData[2] = 0x00;
  177.     fileData[3] = tileWidth & 0xFF; // Tile width.
  178.     fileData[4] = (tileWidth >> 8) & 0xFF;
  179.     fileData[5] = tileHeight & 0xFF; // Tile height.
  180.     fileData[6] = (tileHeight >> 8) & 0xFF;
  181.  
  182.     switch(bitDepth){
  183.         case 8:
  184.             for (let i = 0; i < tileWidth * tileHeight; i++) {
  185.                 fileData[headerSize + i] = pixels[i]; // Direct mapping for 8-bit depth.
  186.             }
  187.             break;
  188.         case 4:
  189.             for (let i = 0; i < tileWidth * tileHeight / 2; i++) {
  190.                 const highNibble = (pixels[i * 2 + 0] << 4) & 0xF0;
  191.                 const lowNibble = (pixels[i * 2 + 1] << 0) & 0x0F;
  192.                 fileData[headerSize + i] = highNibble | lowNibble;
  193.             }
  194.             break;
  195.         case 2:
  196.             for (let i = 0; i < tileWidth * tileHeight / 4; i++) {
  197.                 const bitsC0 = (pixels[i * 4 + 0] << 6) & 0xC0;
  198.                 const bits30 = (pixels[i * 4 + 1] << 4) & 0x30;
  199.                 const bits0C = (pixels[i * 4 + 2] << 2) & 0x0C;
  200.                 const bits03 = (pixels[i * 4 + 3] << 0) & 0x03;
  201.                 fileData[headerSize + i] = bitsC0 | bits30 | bits0C | bits03;
  202.             }
  203.             break;
  204.         case 1:
  205.             for (let i = 0; i < tileWidth * tileHeight / 8; i++) {
  206.                 let byte = 0;
  207.                 for (let bit = 0; bit < 8; bit++) {
  208.                     const pixelValue = pixels[i * 8 + bit] & 0x01;
  209.                     byte |= (pixelValue << (7 - bit));
  210.                 }
  211.                 fileData[headerSize + i] = byte;
  212.             }
  213.             break;
  214.         default:
  215.             throw new Error(`Unsupported bit depth: ${bitDepth}`);
  216.     }
  217.  
  218.     return fileData;
  219. }
  220.  
  221.  
  222.  
  223. // Shared :: "Legacy/Graphics/Support.js"
  224.  
  225. // Function to calculate image size based on bit depth.
  226. function calculateImageSize(bitDepth, tileWidth, tileHeight) {
  227.     return (tileWidth * tileHeight * bitDepth) / 8;
  228. }
  229.  
  230.  
  231.  
  232. // Shared :: "Legacy/Graphics/Rip MVX.js"
  233. // "Keal's Minimal Video Exchange Format"
  234.  
  235. function Import(params = { type: `bsv`, fileData = [], bitDepth = 8 }) {
  236.     let pixels = [];
  237.     let tiles = [];
  238.    
  239.     switch (params.type.toLowerCase()) {
  240.         case `bsv`:
  241.             tiles[0] = loadBSV(params.fileData, params.bitDepth);
  242.             break;
  243.         case `til`:
  244.             tiles = loadTIL(params.fileData, params.tileWidth, params.tileHeight, params.bitDepth);
  245.             break;
  246.         default:
  247.             break;
  248.     }
  249. }
  250.  
  251. function eachAsHex(tiles, width, height) {
  252.     let rips = [];
  253.     let ripsUnique = [];
  254.     let transformations = [];
  255.    
  256.     for (let i = 0; i < tiles.length; i++) {
  257.         rips[i] = asHex(tiles[i], width, height);
  258.         ripsUnique[i] = asUnique(rips[i], width, height);
  259.         transformations[i] = generateTransformations(tiles[i], width, height);
  260.     }
  261.    
  262.     return { ripsUnique, transformations };
  263. }
  264.  
  265. // Function to generate flipped and rotated versions of the tile
  266. function generateTransformations(tile, width, height) {
  267.     let transformed = {};
  268.     transformed.original = asHex(tile, width, height);
  269.     transformed.flippedHorizontal = asHex(flipHorizontal(tile, width, height), width, height);
  270.     transformed.flippedVertical = asHex(flipVertical(tile, width, height), width, height);
  271.     transformed.rotated90 = asHex(rotate90(tile, width, height), height, width);
  272.     transformed.rotated180 = asHex(rotate180(tile, width, height), width, height);
  273.     transformed.rotated270 = asHex(rotate270(tile, width, height), height, width);
  274.     return transformed;
  275. }
  276.  
  277. // Flip the tile horizontally
  278. function flipHorizontal(tile, width, height) {
  279.     let flipped = new Uint8Array(tile.length);
  280.     for (let y = 0; y < height; y++) {
  281.         for (let x = 0; x < width; x++) {
  282.             flipped[y * width + x] = tile[y * width + (width - x - 1)];
  283.         }
  284.     }
  285.     return flipped;
  286. }
  287.  
  288. // Flip the tile vertically
  289. function flipVertical(tile, width, height) {
  290.     let flipped = new Uint8Array(tile.length);
  291.     for (let y = 0; y < height; y++) {
  292.         for (let x = 0; x < width; x++) {
  293.             flipped[y * width + x] = tile[(height - y - 1) * width + x];
  294.         }
  295.     }
  296.     return flipped;
  297. }
  298.  
  299. // Rotate the tile by 90 degrees clockwise
  300. function rotate90(tile, width, height) {
  301.     let rotated = new Uint8Array(tile.length);
  302.     for (let y = 0; y < height; y++) {
  303.         for (let x = 0; x < width; x++) {
  304.             rotated[x * height + (height - y - 1)] = tile[y * width + x];
  305.         }
  306.     }
  307.     return rotated;
  308. }
  309.  
  310. // Rotate the tile by 180 degrees
  311. function rotate180(tile, width, height) {
  312.     let rotated = new Uint8Array(tile.length);
  313.     for (let y = 0; y < height; y++) {
  314.         for (let x = 0; x < width; x++) {
  315.             rotated[(height - y - 1) * width + (width - x - 1)] = tile[y * width + x];
  316.         }
  317.     }
  318.     return rotated;
  319. }
  320.  
  321. // Rotate the tile by 270 degrees clockwise
  322. function rotate270(tile, width, height) {
  323.     let rotated = new Uint8Array(tile.length);
  324.     for (let y = 0; y < height; y++) {
  325.         for (let x = 0; x < width; x++) {
  326.             rotated[(width - x - 1) * height + y] = tile[y * width + x];
  327.         }
  328.     }
  329.     return rotated;
  330. }
  331.  
  332. function asHex(tile, width, height) {
  333.     const depth = 32; // Assuming each pixel is 32 bits (4 bytes)
  334.     let hexData = ""; // Empty string to store hex values
  335.  
  336.     for (let y = 0; y < height; y++) {
  337.         for (let x = 0; x < width; x++) {
  338.             const pixelIndex = y * width + x; // Calculate the current pixel index
  339.             const pixelValue = tile[pixelIndex]; // Get the value of the pixel
  340.             const hexPixel = pixelValue.toString(16).padStart(depth / 4, '0'); // Convert pixel value to hex
  341.             hexData += hexPixel;
  342.         }
  343.     }
  344.     return hexData;
  345. }
  346.  
  347. function asUnique(hexData, width, height) {
  348.     const depth = 32;
  349.     let palette = ""; // To store unique hex values (colors)
  350.     let field = ""; // To store indices for the unique palette
  351.  
  352.     for (let y = 0; y < height; y++) {
  353.         for (let x = 0; x < width; x++) {
  354.             let startIndex = (y * width + x) * (depth / 4); // Calculate start index for the current pixel in hexData
  355.             let pixel = hexData.slice(startIndex, startIndex + (depth / 4)); // Extract the hex value for the pixel
  356.             let paletteIndex = palette.indexOf(pixel);
  357.             if (paletteIndex === -1) {
  358.                 paletteIndex = palette.length / (depth / 4); // Calculate the new index
  359.                 palette += pixel; // Add the new pixel to the palette
  360.             }
  361.             field += paletteIndex.toString(16).padStart(2, '0'); // Assuming a 2-digit hex index
  362.         }
  363.     }
  364.     return { palette, field };
  365. }
  366.  
  367. function paletteUnique(ripsUnique) {
  368.     let ripsMaster = { palette: "", field: "" };
  369.     let allPalettes = ripsUnique.map(ru => ru.palette).join('');
  370.     let allFields = ripsUnique.map(ru => ru.field).join('');
  371.  
  372.     for (let i = 0; i < ripsUnique.length; i++) {
  373.         let current = ripsUnique[i];
  374.         let paletteIndex = allPalettes.indexOf(current.palette);
  375.         let fieldIndex = allFields.indexOf(current.field);
  376.  
  377.         if (paletteIndex !== -1 && paletteIndex <= i * current.palette.length) {
  378.             ripsMaster.palette += paletteIndex.toString(16).padStart(2, '0');
  379.         } else {
  380.             ripsMaster.palette += i.toString(16).padStart(2, '0');
  381.         }
  382.         if (fieldIndex !== -1 && fieldIndex <= i * current.field.length) {
  383.             ripsMaster.field += fieldIndex.toString(16).padStart(2, '0');
  384.         } else {
  385.             ripsMaster.field += i.toString(16).padStart(2, '0');
  386.         }
  387.     }
  388.     return ripsMaster;
  389. }
  390.  
  391. // Function to create a frequency table from the data
  392. function createFrequencyTable(data) {
  393.     let freqTable = {};
  394.     for (let i = 0; i < data.length; i++) {
  395.         let char = data[i];
  396.         freqTable[char] = (freqTable[char] || 0) + 1;
  397.     }
  398.     return freqTable;
  399. }
  400.  
  401. // Function to create Huffman tree from the frequency table
  402. function createHuffmanTree(freqTable) {
  403.     let nodes = Object.entries(freqTable).map(([char, freq]) => ({ char, freq }));
  404.  
  405.     while (nodes.length > 1) {
  406.         nodes.sort((a, b) => a.freq - b.freq);
  407.         let left = nodes.shift();
  408.         let right = nodes.shift();
  409.         let newNode = { char: null, freq: left.freq + right.freq, left, right };
  410.         nodes.push(newNode);
  411.     }
  412.     return nodes[0];
  413. }
  414.  
  415. // Function to generate Huffman codes from the tree
  416. function generateHuffmanCodes(tree, prefix = '', codes = {}) {
  417.     if (tree.char !== null) {
  418.         codes[tree.char] = prefix;
  419.     } else {
  420.         generateHuffmanCodes(tree.left, prefix + '0', codes);
  421.         generateHuffmanCodes(tree.right, prefix + '1', codes);
  422.     }
  423.     return codes;
  424. }
  425.  
  426. // Function to compress data using Huffman codes
  427. function huffmanCompress(data, huffmanCodes) {
  428.     let binaryString = '';
  429.     for (let i = 0; i < data.length; i++) {
  430.         binaryString += huffmanCodes[data[i]];
  431.     }
  432.     let byteArray = [];
  433.     for (let i = 0; i < binaryString.length; i += 8) {
  434.         let byte = binaryString.slice(i, i + 8);
  435.         byteArray.push(parseInt(byte.padEnd(8, '0'), 2)); // Pack into bytes
  436.     }
  437.     return new Uint8Array(byteArray);
  438. }
  439.  
  440. // Function to unpack the compressed byte array into a binary string
  441. function unpackBits(byteArray) {
  442.     let binaryString = '';
  443.     for (let i = 0; i < byteArray.length; i++) {
  444.         let byte = byteArray[i].toString(2).padStart(8, '0');
  445.         binaryString += byte;
  446.     }
  447.     return binaryString;
  448. }
  449.  
  450. // Function to rebuild the Huffman tree from the Huffman codes
  451. function rebuildHuffmanTree(huffmanCodes) {
  452.     let root = {};
  453.     for (let char in huffmanCodes) {
  454.         let code = huffmanCodes[char];
  455.         let node = root;
  456.         for (let bit of code) {
  457.             if (!node[bit]) node[bit] = {};
  458.             node = node[bit];
  459.         }
  460.         node.char = char;
  461.     }
  462.     return root;
  463. }
  464.  
  465. // Function to decode the compressed binary data using the Huffman tree
  466. function huffmanDecompress(binaryString, huffmanTree) {
  467.     let originalData = '';
  468.     let node = huffmanTree;
  469.     for (let bit of binaryString) {
  470.         node = node[bit]; // Traverse the tree
  471.         if (node.char) {
  472.             originalData += node.char;
  473.             node = huffmanTree; // Reset to root
  474.         }
  475.     }
  476.     return originalData;
  477. }
  478.  
  479. // Rebuild images from the original data
  480. function rebuildImages(palette, field, width, height, depth = 32) {
  481.     let tiles = [];
  482.     let paletteEntries = [];
  483.  
  484.     for (let i = 0; i < palette.length; i += (depth / 4)) {
  485.         paletteEntries.push(palette.slice(i, i + (depth / 4)));
  486.     }
  487.  
  488.     for (let i = 0; i < field.length / (width * height); i++) {
  489.         let tile = new Uint8Array(width * height);
  490.         for (let j = 0; j < width * height; j++) {
  491.             let paletteIndex = parseInt(field.slice((i * width * height + j) * 2, (i * width * height + j) * 2 + 2), 16);
  492.             let color = parseInt(paletteEntries[paletteIndex], 16);
  493.             tile[j] = color;
  494.         }
  495.         tiles.push(tile);
  496.     }
  497.     return tiles;
  498. }
  499.  
  500. // Full reversal process to convert compressed data back into original images
  501. function decompressMasterData(compressedData, huffmanCodes, width, height, depth = 32) {
  502.     let binaryString = unpackBits(compressedData);
  503.     let huffmanTree = rebuildHuffmanTree(huffmanCodes);
  504.     let originalData = huffmanDecompress(binaryString, huffmanTree);
  505.  
  506.     let paletteLength = originalData.indexOf("fieldStart");
  507.     let palette = originalData.slice(0, paletteLength);
  508.     let field = originalData.slice(paletteLength + "fieldStart".length);
  509.  
  510.     let originalTiles = rebuildImages(palette, field, width, height, depth);
  511.     return originalTiles;
  512. }
  513.  
  514. // Example Huffman codes (must be saved or generated along with compression)
  515. let huffmanCodes = {
  516.     'a': '00',
  517.     'b': '01',
  518.     'c': '10',
  519.     'd': '110',
  520.     'e': '1110',
  521.     'f': '1111'
  522. };
  523.  
  524. // Function to decompress the Huffman data back to BSV format
  525. function decompressToBSV(compressedData, huffmanCodes, width, height, bitDepth) {
  526.     let binaryString = unpackBits(compressedData);
  527.     let huffmanTree = rebuildHuffmanTree(huffmanCodes);
  528.     let originalData = huffmanDecompress(binaryString, huffmanTree);
  529.  
  530.     // Split palette and field data
  531.     let paletteLength = originalData.indexOf("fieldStart");
  532.     let palette = originalData.slice(0, paletteLength);
  533.     let field = originalData.slice(paletteLength + "fieldStart".length);
  534.  
  535.     // Rebuild image tiles
  536.     let originalTiles = rebuildImages(palette, field, width, height, bitDepth);
  537.  
  538.     // Convert image back into BSV format
  539.     let bsvFile = saveBSV(originalTiles, bitDepth, width, height);
  540.  
  541.     return bsvFile;
  542. }
  543.  
  544. // Function to decompress the Huffman data back to TIL format
  545. function decompressToTIL(compressedData, huffmanCodes, width, height, bitDepth, tileWidth, tileHeight) {
  546.     let binaryString = unpackBits(compressedData);
  547.     let huffmanTree = rebuildHuffmanTree(huffmanCodes);
  548.     let originalData = huffmanDecompress(binaryString, huffmanTree);
  549.  
  550.     // Split palette and field data
  551.     let paletteLength = originalData.indexOf("fieldStart");
  552.     let palette = originalData.slice(0, paletteLength);
  553.     let field = originalData.slice(paletteLength + "fieldStart".length);
  554.  
  555.     // Rebuild image tiles
  556.     let originalTiles = rebuildImages(palette, field, tileWidth, tileHeight, bitDepth);
  557.  
  558.     // Convert image back into TIL format
  559.     let tilFile = saveTIL(originalTiles, tileWidth, tileHeight, bitDepth);
  560.  
  561.     return tilFile;
  562. }
  563.  
  564. // Example of compressing and decompressing the data
  565. let ripsUnique = eachAsHex(tiles, width, height);
  566. let masterData = paletteUnique(ripsUnique.ripsUnique);
  567. let compressedMasterData = huffmanCompress(masterData);
  568.  
  569. // Decompress and save to BSV
  570. let originalBSVFile = decompressToBSV(compressedMasterData, huffmanCodes, width, height, bitDepth);
  571. console.log("Original BSV:", originalBSVFile);
  572.  
  573. // Decompress and save to TIL
  574. let originalTILFile = decompressToTIL(compressedMasterData, huffmanCodes, width, height, bitDepth, tileWidth, tileHeight);
  575. console.log("Original TIL:", originalTILFile);
  576.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement