diff --git a/DAT_Image_File.txt b/DAT_Image_File.txt index 49f8dc5..40e642c 100644 --- a/DAT_Image_File.txt +++ b/DAT_Image_File.txt @@ -11,7 +11,6 @@ etc. Portions of the format are similar or directly ripped from the .ACT format of TIE and XvT. The images are separated into "Groups" and "Subs", with the Group being the base image, and the Sub being variants or animation frames. -**NOTE** Addition of BC7 is WIP, not all information has been added ** ===== DAT Structure @@ -62,14 +61,15 @@ struct Sub 0x00 SubHeader 0x12 ImageHeader 0x3E Colors[ImageHeader.NumberOfColors] -#if (Type!=25C) - Row[Height] -#else +#if (Type==25C) 0x3E BYTE[5] CompressionParameters 0x43 BYTE[] LzmaData +#elseif (Type==BC7) + 0x3E BYTE[] EncodedBlockData +#else Row[Height] #endif #if (Type==7 || Type==23) - BYTE Reserved (0) + BYTE Reserved (0) #endif } @@ -324,4 +324,6 @@ Type "BC7"; BCn compressed, requires 32-bit hook. The data length is the size of the padded area, with padding up to multiples of 4 in both width and height. ((Width+3)/4 * 4) * ((Height+3)/4 * 4). Note that for dimensions that are already divisible by 4, this is simply Width * Height. Pixels are run through -the compression algorithm in 4x4 blocks. \ No newline at end of file +the compression algorithm in 4x4 blocks. The full details of how BCn works is +left to you if you're curious, I'm using an external source for the algorithm +instead of trying to recreate it. \ No newline at end of file diff --git a/DatFile.cs b/DatFile.cs index f7f5231..a34b3cf 100644 --- a/DatFile.cs +++ b/DatFile.cs @@ -1,6 +1,6 @@ /* * Idmr.ImageFormat.Dat, Allows editing capability of LA *.DAT Image files - * Copyright (C) 2009-2022 Michael Gaisser (mjgaisser@gmail.com) + * Copyright (C) 2009-2023 Michael Gaisser (mjgaisser@gmail.com) * * This library is free software; you can redistribute it and/or modify it * under the terms of the Mozilla Public License; either version 2.0 of the @@ -35,9 +35,9 @@ * [UPD] Group/Sub converted to class */ +using Idmr.Common; using System; using System.IO; -using Idmr.Common; namespace Idmr.ImageFormat.Dat { @@ -70,7 +70,7 @@ public DatFile(string file) } catch (Exception x) { - if (fs != null) fs.Close(); + fs?.Close(); throw new LoadFileException(x); } _filePath = file; @@ -133,7 +133,7 @@ public void Save() } catch (Exception x) { - if (fs != null) fs.Close(); + fs?.Close(); if (File.Exists(tempFile)) File.Copy(tempFile, _filePath); // restore backup if it exists File.Delete(tempFile); // delete backup if it exists throw new SaveFileException(x); @@ -188,21 +188,21 @@ public void DecodeFile(byte[] rawData) } } #endregion public methods - + #region public properties /// Gets the file name of the Dat object /// Value is without the directory - public string FileName { get { return StringFunctions.GetFileName(_filePath); } } - + public string FileName => StringFunctions.GetFileName(_filePath); + /// Gets the full path of the Dat object /// Defaults to "newfile.dat" - public string FilePath { get { return _filePath; } } - + public string FilePath => _filePath; + /// Gets the Collection of Groups in the archive public GroupCollection Groups { get; internal set; } - + /// Gets the number of Groups in the archive - public short NumberOfGroups { get { return (short)Groups.Count; } } + public short NumberOfGroups => (short)Groups.Count; /// Gets the maximum height used for all images public short UsedHeight @@ -254,7 +254,7 @@ int length return l; } } - - int dataOffset { get { return NumberOfGroups * Group._headerLength; } } + + int dataOffset => NumberOfGroups * Group._headerLength; } } diff --git a/ImageFormat.Dat.csproj b/ImageFormat.Dat.csproj index 6b6f61c..887a48d 100644 --- a/ImageFormat.Dat.csproj +++ b/ImageFormat.Dat.csproj @@ -84,9 +84,18 @@ + + PreserveNewest + + + PreserveNewest + PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/JeremyAnsel.BcnSharpLib32.dll b/JeremyAnsel.BcnSharpLib32.dll new file mode 100644 index 0000000..9af258c Binary files /dev/null and b/JeremyAnsel.BcnSharpLib32.dll differ diff --git a/JeremyAnsel.BcnSharpLib64.dll b/JeremyAnsel.BcnSharpLib64.dll new file mode 100644 index 0000000..5334a4b Binary files /dev/null and b/JeremyAnsel.BcnSharpLib64.dll differ diff --git a/MIT License.txt b/MIT License.txt new file mode 100644 index 0000000..c0e3330 --- /dev/null +++ b/MIT License.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020-2021 Richard Geldreich, Jr, 2023 Jérémy Ansel + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 6e2e0f8..1ad74de 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -13,9 +13,9 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Imperial Department of Military Research")] [assembly: AssemblyProduct("Idmr.ImageFormat.Dat")] -[assembly: AssemblyCopyright("Copyright © Michael Gaisser 2009-2022")] +[assembly: AssemblyCopyright("Copyright © Michael Gaisser 2009-2023")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Major.Minor.Build.Revision -[assembly: AssemblyVersion("2.4.*")] \ No newline at end of file +[assembly: AssemblyVersion("2.5.*")] \ No newline at end of file diff --git a/Readme.txt b/Readme.txt index 8f3a354..fef5526 100644 --- a/Readme.txt +++ b/Readme.txt @@ -2,15 +2,16 @@ Idmr.ImageFormat.Dat.dll ======================== Author: Michael Gaisser (mjgaisser@gmail.com) -Version: 2.4 -Date: 2022.02.27 +Version: 2.5 +Date: 2023.12.18 Library for reading LucasArts *.DAT backdrop files ========== Version History - - BC7 format detection, currently unsupported and returns a blank image +v2.5 - 18 Dec 2023 + - Added BC7 format capability v2.4 - 27 Feb 2022 - Added Format 25C capability @@ -58,6 +59,8 @@ Additional Information Instructions: - Get latest version of Idmr.Common.dll (v1.1 or later) - Add Idmr.Common.dll and Idmr.ImageFormat.Dat.dll to your references + - Add both JeremyAnsel.BcnSharpLib32.dll and ~64.dll to the build directory + for use as external references. File format structure can be found in DAT_Image_File.txt @@ -66,12 +69,16 @@ Programmer's reference can be found in help/Idmr.ImageFormat.Dat.chm ========== Copyright Information -Copyright (C) Michael Gaisser, 2009-2022 +Copyright (C) Michael Gaisser, 2009-2023 This library file and related files are licensed under the Mozilla Public License v2.0 or later. See License.txt for further details. The LZMA SDK is written and placed in the public domain by Igor Pavlov. +The BC7 library and implementation are Copyright (C) 2020-2021 +Richard Geldreich, Jr and 2023 Jérémy Ansel, covered by the MIT License. +See "MIT License.txt" for full details. + "Star Wars" and related items are trademarks of LucasFilm Ltd and LucasArts Entertainment Co. diff --git a/Sub.cs b/Sub.cs index d6ec26e..1489cd7 100644 --- a/Sub.cs +++ b/Sub.cs @@ -1,14 +1,18 @@ /* * Idmr.ImageFormat.Dat, Allows editing capability of LucasArts *.DAT Image files - * Copyright (C) 2009-2022 Michael Gaisser (mjgaisser@gmail.com) + * Copyright (C) 2009-2023 Michael Gaisser (mjgaisser@gmail.com) * Licensed under the GPL v2.0 or later * + * BC7 implementation based on JeremyAnsel.BcnSharp, Copyright 2023 Jérémy Ansel + * Licensed under the MIT License. + * * Full notice in DatFile.cs - * VERSION: 2.4+ + * VERSION: 2.5 */ /* CHANGE LOG - * [NEW] BC7 detection, format currently unsupported and returns a blank image + * v2.5, 231218 + * [NEW] Format BC7 support * v2.4, 220227 * [UPD] _rows set to null for Full32bpp images since there's no processing * [NEW] Format "25C", 32bpp LZMA compressed @@ -26,11 +30,12 @@ * [UPD] allowed Colors.set without defined _image */ +using Idmr.Common; using System; using System.Drawing; using System.Drawing.Imaging; using System.IO; -using Idmr.Common; +using System.Runtime.InteropServices; namespace Idmr.ImageFormat.Dat { @@ -63,12 +68,11 @@ public enum ImageType : short Blended = 23, /// 16bpp Indexed Alpha uncompressed UncompressedBlended, - /// 32bpp ARGB + /// 32bpp ARGB per 32bpp hook Full32bppArgb, - /// "25C", 32bpp ARGB with LZMA compression + /// "25C", 32bpp ARGB with LZMA compression per 32bpp hook Compressed32bppArgb, - /// 32bpp ARGB with BCn compression - /// CURRENTLY UNSUPPORTED + /// 32bpp ARGB with BCn compression per 32bpp hook BC7Compressed }; @@ -116,8 +120,8 @@ public Sub(byte[] raw) // Sub.Rows[] _rows = new byte[length - imageDataOffset]; ArrayFunctions.TrimArray(raw, offset, _rows); - if (_type != ImageType.Compressed32bppArgb) - _image = DecodeImage(_rows, _width, _height, _colors, _type); // don't unzip until it's called + if (_type != ImageType.Compressed32bppArgb && _type != ImageType.BC7Compressed) + _image = DecodeImage(_rows, _width, _height, _colors, _type); // don't decompress until it's called for if (_type == ImageType.Full32bppArgb) _rows = null; } /// Create a new sub from the provided image and IDs @@ -141,7 +145,7 @@ public Sub(short groupID, short subID, Bitmap image) _rows = EncodeImage(image, _type, (Color[])image.Palette.Entries.Clone(), out _image, out _colors); _height = (short)_image.Height; _width = (short)_image.Width; - _length = _rows.Length + imageDataOffset; + _length = _rows.Length + _imageDataOffset; UpdateHeader(); if (_type == ImageType.Full32bppArgb) _rows = null; } @@ -171,10 +175,10 @@ public Sub(short groupID, short subID) /// Image height /// Defined Color array to be used for the image /// Encoding protocol used for - /// If is , returns a image.
- /// Otherwise the returned image will be . - /// is ignored and allowed to be null if is or .
- /// if is , then must be the LZMA compression data.
+ /// If is , returns a image, otherwise the returned image will be .
+ /// is ignored and allowed to be null if is , or .
+ /// If is , then must be the LZMA compression data.
+ /// If is , then must be the encoded block data.
public static Bitmap DecodeImage(byte[] rawData, int width, int height, Color[] colors, ImageType type) { int offset = 0; @@ -259,10 +263,11 @@ public static Bitmap DecodeImage(byte[] rawData, int width, int height, Color[] break; case ImageType.Full32bppArgb: case ImageType.Compressed32bppArgb: + case ImageType.BC7Compressed: image = new Bitmap(width, height, PixelFormat.Format32bppArgb); BitmapData bdArgb = GraphicsFunctions.GetBitmapData(image); if (type == ImageType.Full32bppArgb) GraphicsFunctions.CopyBytesToImage(rawData, bdArgb); // already good data - else + else if (type == ImageType.Compressed32bppArgb) { byte[] lzmaParameters = new byte[5]; ArrayFunctions.TrimArray(rawData, 0, lzmaParameters); @@ -278,11 +283,22 @@ public static Bitmap DecodeImage(byte[] rawData, int width, int height, Color[] } GraphicsFunctions.CopyBytesToImage(pixelsArgb, bdArgb); } + else if (type == ImageType.BC7Compressed) + { // This else block covered by MIT License + var pixelsArgb = new byte[bdArgb.Stride * bdArgb.Height]; + GCHandle pixelsHandle = GCHandle.Alloc(pixelsArgb, GCHandleType.Pinned); + GCHandle blocksHandle = GCHandle.Alloc(rawData, GCHandleType.Pinned); + + try { BC7_Decode(blocksHandle.AddrOfPinnedObject(), pixelsHandle.AddrOfPinnedObject(), width, height); } + finally + { + pixelsHandle.Free(); + blocksHandle.Free(); + } + GraphicsFunctions.CopyBytesToImage(pixelsArgb, bdArgb); + } image.UnlockBits(bdArgb); break; - case ImageType.BC7Compressed: - // TODO: BC7. do nothing for now, unsupported - break; } return image; } @@ -291,17 +307,16 @@ public static Bitmap DecodeImage(byte[] rawData, int width, int height, Color[] /// The image to encode /// The encoding protocol to use /// The color array to use - /// with unused color indexes removed, or simply the original as if is or . - /// with unused color indexes removed, or null if is or . + /// with unused color indexes removed, or simply the original as if is , or . + /// with unused color indexes removed, or null if is , or . /// Unused color indexes are removed from both and , the returned array reflects the trimmed parameters. is ignored and can be null if is or .
/// If is , then instead of being row data the array is the compressed LZMA data.
- /// ** is not supported!**
+ /// If is , then instead of being row data the array is the compressed BC7 block data. /// Encoded byte data of - /// is null and is not or . - /// is + /// is null and is not , or . public static byte[] EncodeImage(Bitmap image, ImageType type, Color[] colors, out Bitmap trimmedImage, out Color[] trimmedColors) { - if (type == ImageType.Full32bppArgb || type == ImageType.Compressed32bppArgb) + if (type == ImageType.Full32bppArgb || type == ImageType.Compressed32bppArgb || type == ImageType.BC7Compressed) { trimmedImage = new Bitmap(image); // convert to 32bppArgb BitmapData bdArgb = GraphicsFunctions.GetBitmapData(trimmedImage); @@ -310,25 +325,43 @@ public static byte[] EncodeImage(Bitmap image, ImageType type, Color[] colors, o trimmedImage.UnlockBits(bdArgb); trimmedColors = null; if (type == ImageType.Full32bppArgb) return pixelsArgb; - byte[] rawData; - using (var compressedData = new MemoryStream(pixelsArgb.Length + 5)) + byte[] rawData = null; + if (type == ImageType.Compressed32bppArgb) { - using (var pixelData = new MemoryStream(pixelsArgb)) + using (var compressedData = new MemoryStream(pixelsArgb.Length + 5)) { - var encoder = new SevenZip.Compression.LZMA.Encoder(); - encoder.WriteCoderProperties(compressedData); - encoder.Code(pixelData, compressedData, pixelData.Length, -1, null); + using (var pixelData = new MemoryStream(pixelsArgb)) + { + var encoder = new SevenZip.Compression.LZMA.Encoder(); + encoder.WriteCoderProperties(compressedData); + encoder.Code(pixelData, compressedData, pixelData.Length, -1, null); + } + rawData = compressedData.ToArray(); } - rawData = compressedData.ToArray(); } - return rawData; - } + else // BC7 + { // This else block covered by MIT License + int blocksWidth = image.Width + (image.Width % 4 == 0 ? 0 : 4 - image.Width % 4); + int blocksHeight = image.Height + (image.Height % 4 == 0 ? 0 : 4 - image.Height % 4); - if (type == ImageType.BC7Compressed) - { - throw new NotImplementedException("BC7 encoding is not supported, choose another format."); + byte[] blockData = new byte[blocksWidth * blocksHeight]; + + GCHandle pixelsHandle = GCHandle.Alloc(pixelsArgb, GCHandleType.Pinned); + GCHandle blocksHandle = GCHandle.Alloc(blockData, GCHandleType.Pinned); + + try { BC7_Encode(blocksHandle.AddrOfPinnedObject(), pixelsHandle.AddrOfPinnedObject(), image.Width, image.Height); } + finally + { + pixelsHandle.Free(); + blocksHandle.Free(); + } + + rawData = blockData; + } + return rawData; } + #region indexed byte[] mask = null; if (colors == null) throw new ArgumentNullException("colors", "Colors is required for all types except Full32bppArgb"); @@ -468,12 +501,13 @@ public static byte[] EncodeImage(Bitmap image, ImageType type, Color[] colors, o byte[] temp = new byte[offset]; ArrayFunctions.TrimArray(rows, 0, temp); return temp; + #endregion } /// Sets the image of the Sub /// The image to be used /// Unused color indexes will be removed.
- /// If is undefined, is initialized to the default 256 color palette. Unused indexes will be removed
+ /// If is undefined, is initialized to the default 256 color palette. Unused indexes will be removed.
/// If is , Colors will initialize to the image's palette.
public void SetImage(Bitmap image) { @@ -482,7 +516,7 @@ public void SetImage(Bitmap image) _rows = EncodeImage(image, _type, (Color[])_colors.Clone(), out _image, out _colors); _height = (short)_image.Height; _width = (short)_image.Width; - _length = _rows.Length + imageDataOffset; + _length = _rows.Length + _imageDataOffset; UpdateHeader(); if (_type == ImageType.Full32bppArgb) _rows = null; } @@ -530,15 +564,15 @@ public void SetTransparencyMask(Bitmap mask) /// Attempted to set an indexed format and is null. public ImageType Type { - get { return _type; } + get => _type; set { - if (value != ImageType.Full32bppArgb && value != ImageType.Compressed32bppArgb && _colors == null) + if (value != ImageType.Full32bppArgb && value != ImageType.Compressed32bppArgb && value != ImageType.BC7Compressed && _colors == null) throw new InvalidOperationException("Cannot change to indexed format prior to assigning color palette."); if (_image != null) { _rows = EncodeImage(_image, value, (_colors != null ? (Color[])_colors.Clone() : null), out _image, out _colors); - _length = _rows.Length + imageDataOffset; + _length = _rows.Length + _imageDataOffset; } _type = value; UpdateHeader(); @@ -548,16 +582,16 @@ public ImageType Type /// Gets the width of the image /// If is undefined, value is 0 - public short Width { get { return _width; } } + public short Width => _width; /// Gets the height of the image /// If is undefined, value is 0 - public short Height { get { return _height; } } + public short Height => _height; /// Gets or sets the ID of the parent public short GroupID { - get { return _groupID; } + get => _groupID; set { _groupID = value; @@ -568,7 +602,7 @@ public short GroupID /// Gets or sets the image ID public short SubID { - get { return _subID; } + get => _subID; set { _subID = value; @@ -577,7 +611,7 @@ public short SubID } /// Gets the defined number of - public int NumberOfColors { get { return (_colors != null ? _colors.Length : 0); } } + public int NumberOfColors => (_colors != null ? _colors.Length : 0); /// Gets or sets the defined colors /// value is limited to 256 colors.
@@ -586,10 +620,10 @@ public short SubID /// value exceeds 256 colors public Color[] Colors { - get { return _colors; } + get => _colors; set { - if (value == null && _type != ImageType.Full32bppArgb && _type != ImageType.Compressed32bppArgb) throw new ArgumentNullException("Colors", "Colors cannot be null for indexed image types"); + if (value == null && _type != ImageType.Full32bppArgb && _type != ImageType.Compressed32bppArgb && _type != ImageType.BC7Compressed) throw new ArgumentNullException("Colors", "Colors cannot be null for indexed image types"); if (value != null) { if (value.Length > 256) throw new ArgumentOutOfRangeException("Colors", "256 colors max"); @@ -601,7 +635,7 @@ public Color[] Colors for (int i = 0; i < value.Length; i++) pal.Entries[i] = value[i]; _image.Palette = pal; } - else if (_type != ImageType.Full32bppArgb && _type != ImageType.Compressed32bppArgb) + else if (_type != ImageType.Full32bppArgb && _type != ImageType.Compressed32bppArgb && _type != ImageType.BC7Compressed) { byte[] maskData = getMaskData(_image); Bitmap temp8bpp = GraphicsFunctions.ConvertTo8bpp(_image, _colors); //force back to 8bpp @@ -641,7 +675,7 @@ internal void UpdateHeader() byte[] width = BitConverter.GetBytes(_width); byte[] height = BitConverter.GetBytes(_height); byte[] length = BitConverter.GetBytes(_length); - byte[] type = BitConverter.GetBytes((short)(_type == ImageType.Compressed32bppArgb ? ImageType.Full32bppArgb : _type)); + byte[] type = BitConverter.GetBytes((short)(_type == ImageType.Compressed32bppArgb || _type == ImageType.BC7Compressed ? ImageType.Full32bppArgb : _type)); ArrayFunctions.WriteToArray(type, _headers, 0); ArrayFunctions.WriteToArray(width, _headers, 2); ArrayFunctions.WriteToArray(height, _headers, 4); @@ -651,7 +685,7 @@ internal void UpdateHeader() ArrayFunctions.WriteToArray(length, _headers, 0xE); ArrayFunctions.WriteToArray(length, _headers, _subHeaderLength); // imageHeaderLength - ArrayFunctions.WriteToArray(imageDataOffset, _headers, _subHeaderLength + 8); + ArrayFunctions.WriteToArray(_imageDataOffset, _headers, _subHeaderLength + 8); ArrayFunctions.WriteToArray(length, _headers, _subHeaderLength + 0xC); ArrayFunctions.WriteToArray(width, _headers, _subHeaderLength + 0x10); // short 0 @@ -700,6 +734,44 @@ static byte[] getMaskData(Bitmap image) #endregion private methods /// ImageHeader.ImageDataOffset = ImageHeaderLength + NumberOfColors * 3 - internal int imageDataOffset { get { return _imageHeaderLength + (_colors != null ? _colors.Length * 3 : 0); } } + private int _imageDataOffset { get { return _imageHeaderLength + (_colors != null ? _colors.Length * 3 : 0); } } + + #region imports for BC7 + [DllImport("JeremyAnsel.BcnSharpLib32.dll", EntryPoint = "BC7_Decode")] + private static extern int BC7_Decode32(IntPtr pBlock, IntPtr pPixelsRGBA, int pPixelsRGBAWidth, int pPixelsRGBAHeight); + + [DllImport("JeremyAnsel.BcnSharpLib64.dll", EntryPoint = "BC7_Decode")] + private static extern int BC7_Decode64(IntPtr pBlock, IntPtr pPixelsRGBA, int pPixelsRGBAWidth, int pPixelsRGBAHeight); + + private static int BC7_Decode(IntPtr pBlock, IntPtr pPixelsRGBA, int pPixelsRGBAWidth, int pPixelsRGBAHeight) + { + if (Environment.Is64BitProcess) + { + return BC7_Decode64(pBlock, pPixelsRGBA, pPixelsRGBAWidth, pPixelsRGBAHeight); + } + else + { + return BC7_Decode32(pBlock, pPixelsRGBA, pPixelsRGBAWidth, pPixelsRGBAHeight); + } + } + + [DllImport("JeremyAnsel.BcnSharpLib32.dll", EntryPoint = "BC7_Encode")] + private static extern int BC7_Encode32(IntPtr pBlock, IntPtr pPixelsRGBA, int pPixelsRGBAWidth, int pPixelsRGBAHeight); + + [DllImport("JeremyAnsel.BcnSharpLib64.dll", EntryPoint = "BC7_Encode")] + private static extern int BC7_Encode64(IntPtr pBlock, IntPtr pPixelsRGBA, int pPixelsRGBAWidth, int pPixelsRGBAHeight); + + private static int BC7_Encode(IntPtr pBlock, IntPtr pPixelsRGBA, int pPixelsRGBAWidth, int pPixelsRGBAHeight) + { + if (Environment.Is64BitProcess) + { + return BC7_Encode64(pBlock, pPixelsRGBA, pPixelsRGBAWidth, pPixelsRGBAHeight); + } + else + { + return BC7_Encode32(pBlock, pPixelsRGBA, pPixelsRGBAWidth, pPixelsRGBAHeight); + } + } + #endregion } }