public int sceDisplayGetFrameBuf(uint* topaddr, int* bufferwidth, GuPixelFormats* pixelformat, uint sync) { *topaddr = HleState.PspDisplay.CurrentInfo.Address; *bufferwidth = HleState.PspDisplay.CurrentInfo.BufferWidth; *pixelformat = HleState.PspDisplay.CurrentInfo.PixelFormat; return 0; }
public static int BytesPerPixel(this GuPixelFormats that, int numberOfPixels = 1) { switch (that) { case GuPixelFormats.None: return(0); case GuPixelFormats.Rgba5650: case GuPixelFormats.Rgba5551: case GuPixelFormats.Rgba4444: return(2 * numberOfPixels); case GuPixelFormats.Rgba8888: return(4 * numberOfPixels); case GuPixelFormats.PaletteT4: return((int)(0.5 * numberOfPixels)); case GuPixelFormats.PaletteT8: return(numberOfPixels); case GuPixelFormats.PaletteT16: return(2 * numberOfPixels); case GuPixelFormats.PaletteT32: return(4 * numberOfPixels); case GuPixelFormats.CompressedDxt1: return((int)((0.5 * numberOfPixels) / 16)); case GuPixelFormats.CompressedDxt3: return((1 * numberOfPixels) / 16); case GuPixelFormats.CompressedDxt5: return((1 * numberOfPixels) / 16); default: throw new InvalidOperationException($"ScreenBufferStateStruct.BytesPerPixel : Invalid Format : {that} : {numberOfPixels}"); } }
public int sceDisplayGetFrameBuf(ref uint topaddr, ref int bufferwidth, ref GuPixelFormats pixelformat, uint sync) { topaddr = PspDisplay.CurrentInfo.FrameAddress; bufferwidth = PspDisplay.CurrentInfo.BufferWidth; pixelformat = PspDisplay.CurrentInfo.PixelFormat; return 0; }
//public int sceDisplayGetFrameBuf(uint* topaddr, int* bufferwidth, PspDisplayPixelFormats* pixelformat, PspDisplaySetBufSync sync) public int sceDisplayGetFrameBuf(ref uint topaddr, ref int bufferwidth, ref GuPixelFormats pixelformat, uint sync) { topaddr = PspDisplay.CurrentInfo.FrameAddress; bufferwidth = PspDisplay.CurrentInfo.BufferWidth; pixelformat = PspDisplay.CurrentInfo.PixelFormat; return(0); }
public int sceDisplaySetFrameBuf(uint Address, int BufferWidth, GuPixelFormats PixelFormat, PspDisplay.SyncMode Sync) { //Console.WriteLine("sceDisplay.sceDisplaySetFrameBuf {0:X},{1},{2},{3}", Address, BufferWidth, PixelFormat, Sync); PspDisplay.CurrentInfo.Address = Address; PspDisplay.CurrentInfo.BufferWidth = BufferWidth; PspDisplay.CurrentInfo.PixelFormat = PixelFormat; PspDisplay.CurrentInfo.Sync = Sync; return(0); }
public PspBitmap(GuPixelFormats PixelFormat, int Width, int Height, byte* Address) { this.GuPixelFormat = PixelFormat; this.Width = Width; this.Height = Height; this.Address = Address; this.BitsPerPixel = PixelFormatDecoder.GetPixelsBits(PixelFormat); this.ColorFormat = PixelFormatDecoder.ColorFormatFromPixelFormat(PixelFormat); }
static public void Decode(GuPixelFormats PixelFormat, void *Input, OutputPixel *Output, int Width, int Height, void *Palette = null, GuPixelFormats PaletteType = GuPixelFormats.NONE, int PaletteCount = 0, int PaletteStart = 0, int PaletteShift = 0, int PaletteMask = 0xFF, int StrideWidth = -1) { if (StrideWidth == -1) { StrideWidth = GetPixelsSize(PixelFormat, Width); } var PixelFormatInt = (int)PixelFormat; var PixelFormatDecoder = new PixelFormatDecoder() { _Input = Input, InputByte = (byte *)Input, InputShort = (ushort *)Input, InputInt = (uint *)Input, Output = Output, StrideWidth = StrideWidth, Width = Width, Height = Height, Palette = Palette, PaletteType = PaletteType, PaletteCount = PaletteCount, PaletteStart = PaletteStart, PaletteShift = PaletteShift, PaletteMask = PaletteMask, }; //Console.WriteLine(PixelFormat); switch (PixelFormat) { case GuPixelFormats.RGBA_5650: PixelFormatDecoder.Decode_RGBA_5650(); break; case GuPixelFormats.RGBA_5551: PixelFormatDecoder.Decode_RGBA_5551(); break; case GuPixelFormats.RGBA_4444: PixelFormatDecoder.Decode_RGBA_4444(); break; case GuPixelFormats.RGBA_8888: PixelFormatDecoder.Decode_RGBA_8888(); break; case GuPixelFormats.PALETTE_T4: PixelFormatDecoder.Decode_PALETTE_T4(); break; case GuPixelFormats.PALETTE_T8: PixelFormatDecoder.Decode_PALETTE_T8(); break; case GuPixelFormats.PALETTE_T16: PixelFormatDecoder.Decode_PALETTE_T16(); break; case GuPixelFormats.PALETTE_T32: PixelFormatDecoder.Decode_PALETTE_T32(); break; case GuPixelFormats.COMPRESSED_DXT1: PixelFormatDecoder.Decode_COMPRESSED_DXT1(); break; case GuPixelFormats.COMPRESSED_DXT3: PixelFormatDecoder.Decode_COMPRESSED_DXT3(); break; case GuPixelFormats.COMPRESSED_DXT5: PixelFormatDecoder.Decode_COMPRESSED_DXT5(); break; default: throw(new InvalidOperationException()); } //DecoderCallbackTable[PixelFormatInt](Input, Output, PixelCount, Width, Palette, PaletteType, PaletteCount, PaletteStart, PaletteShift, PaletteMask); }
public static ColorFormat ColorFormatFromPixelFormat(GuPixelFormats PixelFormat) { switch (PixelFormat) { case GuPixelFormats.RGBA_8888: return ColorFormats.RGBA_8888; case GuPixelFormats.RGBA_5551: return ColorFormats.RGBA_5551; case GuPixelFormats.RGBA_5650: return ColorFormats.RGBA_5650; case GuPixelFormats.RGBA_4444: return ColorFormats.RGBA_4444; default: throw(new NotImplementedException("Not implemented " + PixelFormat)); } }
public static void Encode(GuPixelFormats guPixelFormat, OutputPixel *input, byte *output, int bufferWidth, int width, int height) { var incOut = GetPixelsSize(guPixelFormat, bufferWidth); for (var y = 0; y < height; y++) { Encode(guPixelFormat, input, output, width); input += width; output += incOut; } }
public static ColorFormat ColorFormatFromPixelFormat(GuPixelFormats pixelFormat) { switch (pixelFormat) { case GuPixelFormats.Rgba8888: return(ColorFormats.Rgba8888); case GuPixelFormats.Rgba5551: return(ColorFormats.Rgba5551); case GuPixelFormats.Rgba5650: return(ColorFormats.Rgba5650); case GuPixelFormats.Rgba4444: return(ColorFormats.Rgba4444); default: throw new NotImplementedException("Not implemented " + pixelFormat); } }
public static void Encode(GuPixelFormats guPixelFormat, OutputPixel *input, byte *output, int count) { switch (guPixelFormat) { case GuPixelFormats.Rgba8888: { var o = (uint *)output; for (var n = 0; n < count; n++) { *o++ = Encode_RGBA_8888_Pixel(*input++); } } break; case GuPixelFormats.Rgba5551: { var o = (ushort *)output; for (var n = 0; n < count; n++) { *o++ = Encode_RGBA_5551_Pixel(*input++); } } break; case GuPixelFormats.Rgba5650: { var o = (ushort *)output; for (var n = 0; n < count; n++) { *o++ = Encode_RGBA_5650_Pixel(*input++); } } break; case GuPixelFormats.Rgba4444: { var o = (ushort *)output; for (var n = 0; n < count; n++) { *o++ = Encode_RGBA_4444_Pixel(*input++); } } break; default: throw new NotImplementedException("Not implemented " + guPixelFormat); } }
public PspBitmap(GuPixelFormats pixelFormat, int width, int height, byte *address, int bytesPerLine = -1) { GuPixelFormat = pixelFormat; Width = width; Height = height; Address = address; BitsPerPixel = PixelFormatDecoder.GetPixelsBits(pixelFormat); ColorFormat = PixelFormatDecoder.ColorFormatFromPixelFormat(pixelFormat); if (bytesPerLine < 0) { BytesPerLine = PixelFormatDecoder.GetPixelsSize(GuPixelFormat, width); } else { BytesPerLine = bytesPerLine; } }
public PspBitmap(GuPixelFormats PixelFormat, int Width, int Height, byte* Address, int BytesPerLine = -1) { this.GuPixelFormat = PixelFormat; this.Width = Width; this.Height = Height; this.Address = Address; this.BitsPerPixel = PixelFormatDecoder.GetPixelsBits(PixelFormat); this.ColorFormat = PixelFormatDecoder.ColorFormatFromPixelFormat(PixelFormat); if (BytesPerLine < 0) { this.BytesPerLine = PixelFormatDecoder.GetPixelsSize(GuPixelFormat, Width); } else { this.BytesPerLine = BytesPerLine; } }
/* static public uint EncodePixel(GuPixelFormats PixelFormat, OutputPixel Color) { return ColorFormatFromPixelFormat(PixelFormat).Encode(Color.R, Color.G, Color.B, Color.A); } static public OutputPixel DecodePixel(GuPixelFormats PixelFormat, uint Value) { throw new NotImplementedException(); } */ public static void Decode(GuPixelFormats PixelFormat, void* Input, OutputPixel* Output, int Width, int Height, void* Palette = null, GuPixelFormats PaletteType = GuPixelFormats.NONE, int PaletteCount = 0, int PaletteStart = 0, int PaletteShift = 0, int PaletteMask = 0xFF, int StrideWidth = -1, bool IgnoreAlpha = false) { if (StrideWidth == -1) StrideWidth = GetPixelsSize(PixelFormat, Width); var PixelFormatInt = (int)PixelFormat; var PixelFormatDecoder = new PixelFormatDecoder() { _Input = Input, InputByte = (byte *)Input, InputShort = (ushort*)Input, InputInt = (uint*)Input, Output = Output, StrideWidth = StrideWidth, Width = Width, Height = Height, Palette = Palette, PaletteType = PaletteType, PaletteCount = PaletteCount, PaletteStart = PaletteStart, PaletteShift = PaletteShift, PaletteMask = PaletteMask, }; //Console.WriteLine(PixelFormat); switch (PixelFormat) { case GuPixelFormats.RGBA_5650: PixelFormatDecoder.Decode_RGBA_5650(); break; case GuPixelFormats.RGBA_5551: PixelFormatDecoder.Decode_RGBA_5551(); break; case GuPixelFormats.RGBA_4444: PixelFormatDecoder.Decode_RGBA_4444(); break; case GuPixelFormats.RGBA_8888: PixelFormatDecoder.Decode_RGBA_8888(); break; case GuPixelFormats.PALETTE_T4: PixelFormatDecoder.Decode_PALETTE_T4(); break; case GuPixelFormats.PALETTE_T8: PixelFormatDecoder.Decode_PALETTE_T8(); break; case GuPixelFormats.PALETTE_T16: PixelFormatDecoder.Decode_PALETTE_T16(); break; case GuPixelFormats.PALETTE_T32: PixelFormatDecoder.Decode_PALETTE_T32(); break; case GuPixelFormats.COMPRESSED_DXT1: PixelFormatDecoder.Decode_COMPRESSED_DXT1(); break; case GuPixelFormats.COMPRESSED_DXT3: PixelFormatDecoder.Decode_COMPRESSED_DXT3(); break; case GuPixelFormats.COMPRESSED_DXT5: PixelFormatDecoder.Decode_COMPRESSED_DXT5(); break; default: throw(new InvalidOperationException()); } if (IgnoreAlpha) { for (int y = 0, n = 0; y < Height; y++) for (int x = 0; x < Width; x++, n++) Output[n].A = 0xFF; } //DecoderCallbackTable[PixelFormatInt](Input, Output, PixelCount, Width, Palette, PaletteType, PaletteCount, PaletteStart, PaletteShift, PaletteMask); }
//[HlePspNotImplemented] public int sceDisplaySetFrameBuf(uint Address, int BufferWidth, GuPixelFormats PixelFormat, PspDisplay.SyncMode Sync) { Action UpdateInfo = () => { PspDisplay.CurrentInfo.Enabled = (Address != 0); if (PspDisplay.CurrentInfo.Enabled) { PspDisplay.CurrentInfo.FrameAddress = Address; PspDisplay.CurrentInfo.BufferWidth = BufferWidth; PspDisplay.CurrentInfo.PixelFormat = PixelFormat; } }; switch (Sync) { case PspDisplay.SyncMode.Immediate: UpdateInfo(); break; case PspDisplay.SyncMode.NextFrame: ThreadManager.Current.SetWaitAndPrepareWakeUp(HleThread.WaitType.Display, "sceDisplaySetFrameBuf", null, (WakeUp) => { PspDisplay.VBlankCallbackOnce(() => { UpdateInfo(); WakeUp(); }); }, HandleCallbacks: false); break; default: throw(new NotImplementedException("Not implemented " + Sync)); } return(0); }
public int sceDisplaySetFrameBuf(uint Address, int BufferWidth, GuPixelFormats PixelFormat, PspDisplay.SyncMode Sync) { //Console.WriteLine("sceDisplay.sceDisplaySetFrameBuf {0:X},{1},{2},{3}", Address, BufferWidth, PixelFormat, Sync); PspDisplay.CurrentInfo.Address = Address; PspDisplay.CurrentInfo.BufferWidth = BufferWidth; PspDisplay.CurrentInfo.PixelFormat = PixelFormat; PspDisplay.CurrentInfo.Sync = Sync; return 0; }
public int sceDisplaySetFrameBuf(uint Address, int BufferWidth, GuPixelFormats PixelFormat, PspDisplay.SyncMode Sync) { if (Sync != Core.Display.PspDisplay.SyncMode.Immediate) { //Console.Error.WriteLine("Not immediate!"); } //Console.WriteLine("sceDisplay.sceDisplaySetFrameBuf {0:X},{1},{2},{3}", Address, BufferWidth, PixelFormat, Sync); PspDisplay.CurrentInfo.Address = Address; PspDisplay.CurrentInfo.BufferWidth = BufferWidth; PspDisplay.CurrentInfo.PixelFormat = PixelFormat; PspDisplay.CurrentInfo.Sync = Sync; return 0; }
public void AvcDecode(SceMpegAu *MpegAccessUnit, int FrameWidth, GuPixelFormats GuPixelFormat, PspPointer OutputBuffer) { if (MpegAccessUnit != null) { *MpegAccessUnit = GetAvcAu(StreamId.Avc); } while (MpegPsDemuxer.HasMorePackets) { if (!DecodePsPacket()) { return; } } if (VideoStream.Length <= 0) { return; } // Buffer 1MB //if (VideoStream.Length <= 1 * 1024 * 1024) return; try { //if (H264FrameDecoder.HasMorePackets) { //Console.WriteLine("VideoStream.Length: {0}", VideoStream.Length); var Frame = H264FrameDecoder.DecodeFrame(); ConsoleUtils.SaveRestoreConsoleColor(ConsoleColor.DarkGreen, () => { Console.WriteLine("DecodedFrame: {0}", FrameIndex); }); var Bitmap = FrameUtils.imageFromFrameWithoutEdges(Frame, FrameWidth, 272); var TempBuffer = new byte[PixelFormatDecoder.GetPixelsSize(GuPixelFormat, Bitmap.Width * Bitmap.Height)]; fixed(byte *TempBufferPtr = TempBuffer) { var TempBufferPtr2 = TempBufferPtr; Bitmap.LockBitsUnlock(PixelFormat.Format32bppArgb, (BitmapData) => { var InputBuffer = (OutputPixel *)BitmapData.Scan0.ToPointer(); int Count = Bitmap.Width * Bitmap.Height; for (int n = 0; n < Count; n++) { var Color = InputBuffer[n]; InputBuffer[n].R = Color.B; InputBuffer[n].G = Color.G; InputBuffer[n].B = Color.R; InputBuffer[n].A = 0xFF; } PixelFormatDecoder.Encode(GuPixelFormat, InputBuffer, TempBufferPtr2, Bitmap.Width * Bitmap.Height); PixelFormatDecoder.Encode(PspDisplay.CurrentInfo.PixelFormat, InputBuffer, (byte *)Memory.PspAddressToPointerSafe(PspDisplay.CurrentInfo.FrameAddress), 512, Bitmap.Width, Bitmap.Height); PspDisplay.CurrentInfo.PlayingVideo = true; }); PspDisplay.CurrentInfo.PlayingVideo = true; Memory.WriteBytes(OutputBuffer.Address, TempBufferPtr, TempBuffer.Length); GpuImpl.InvalidateCache(OutputBuffer.Address, TempBuffer.Length); } if (SaveBitmapFrame) { Bitmap.Save(@"c:\temp\frame" + (FrameIndex) + ".png"); } FrameIndex++; } //PixelFormat return; } catch (EndOfStreamException) { ConsoleUtils.SaveRestoreConsoleColor(ConsoleColor.Red, () => { Console.WriteLine("H264FrameDecoder.DecodeFrame: EndOfStreamException"); }); } }
public static void UnswizzleInline(GuPixelFormats format, void *data, int width, int height) { UnswizzleInline(data, GetPixelsSize(format, width), height); }
public static ulong Hash(GuPixelFormats pixelFormat, void *input, int width, int height) { var totalBytes = GetPixelsSize(pixelFormat, width * height); return(Hashing.FastHash((byte *)input, totalBytes, (ulong)((int)pixelFormat * width * height))); }
public static void Encode(GuPixelFormats GuPixelFormat, OutputPixel* Input, byte* Output, int BufferWidth, int Width, int Height) { var IncOut = GetPixelsSize(GuPixelFormat, BufferWidth); for (int y = 0; y < Height; y++) { Encode(GuPixelFormat, Input, Output, Width); Input += Width; Output += IncOut; } }
public static int GetPixelsSize(GuPixelFormats pixelFormat, int pixelCount) { return((int)(Sizes[(int)pixelFormat] * pixelCount)); }
public static unsafe ulong Hash(GuPixelFormats PixelFormat, void* Input, int Width, int Height) { int TotalBytes = GetPixelsSize(PixelFormat, Width * Height); return Hashing.FastHash((byte*)Input, TotalBytes, (ulong)((int)PixelFormat * Width * Height)); }
public static int GetPixelsSize(GuPixelFormats PixelFormat, int PixelCount) { return (int)(Sizes[(int)PixelFormat] * PixelCount); }
public void AvcDecode(SceMpegAu* MpegAccessUnit, int FrameWidth, GuPixelFormats GuPixelFormat, PspPointer OutputBuffer) { if (MpegAccessUnit != null) *MpegAccessUnit = GetAvcAu(StreamId.Avc); while (MpegPsDemuxer.HasMorePackets) { if (!DecodePsPacket()) return; } if (VideoStream.Length <= 0) return; // Buffer 1MB //if (VideoStream.Length <= 1 * 1024 * 1024) return; try { //if (H264FrameDecoder.HasMorePackets) { //Console.WriteLine("VideoStream.Length: {0}", VideoStream.Length); var Frame = H264FrameDecoder.DecodeFrame(); ConsoleUtils.SaveRestoreConsoleColor(ConsoleColor.DarkGreen, () => { Console.WriteLine("DecodedFrame: {0}", FrameIndex); }); var Bitmap = FrameUtils.imageFromFrameWithoutEdges(Frame, FrameWidth, 272); var TempBuffer = new byte[PixelFormatDecoder.GetPixelsSize(GuPixelFormat, Bitmap.Width * Bitmap.Height)]; fixed (byte* TempBufferPtr = TempBuffer) { var TempBufferPtr2 = TempBufferPtr; Bitmap.LockBitsUnlock(PixelFormat.Format32bppArgb, (BitmapData) => { var InputBuffer = (OutputPixel*)BitmapData.Scan0.ToPointer(); int Count = Bitmap.Width * Bitmap.Height; for (int n = 0; n < Count; n++) { var Color = InputBuffer[n]; InputBuffer[n].R = Color.B; InputBuffer[n].G = Color.G; InputBuffer[n].B = Color.R; InputBuffer[n].A = 0xFF; } PixelFormatDecoder.Encode(GuPixelFormat, InputBuffer, TempBufferPtr2, Bitmap.Width * Bitmap.Height); PixelFormatDecoder.Encode(PspDisplay.CurrentInfo.PixelFormat, InputBuffer, (byte*)Memory.PspAddressToPointerSafe(PspDisplay.CurrentInfo.FrameAddress), 512, Bitmap.Width, Bitmap.Height); PspDisplay.CurrentInfo.PlayingVideo = true; }); PspDisplay.CurrentInfo.PlayingVideo = true; Memory.WriteBytes(OutputBuffer.Address, TempBufferPtr, TempBuffer.Length); GpuImpl.InvalidateCache(OutputBuffer.Address, TempBuffer.Length); } if (SaveBitmapFrame) Bitmap.Save(@"c:\temp\frame" + (FrameIndex) + ".png"); FrameIndex++; } //PixelFormat return; } catch (EndOfStreamException) { ConsoleUtils.SaveRestoreConsoleColor(ConsoleColor.Red, () => { Console.WriteLine("H264FrameDecoder.DecodeFrame: EndOfStreamException"); }); } }
static public int GetPixelsSize(GuPixelFormats PixelFormat, int PixelCount) { return((int)(Sizes[(int)PixelFormat] * PixelCount)); }
public int sceDisplaySetFrameBuf(uint Address, int BufferWidth, GuPixelFormats PixelFormat, PspDisplay.SyncMode Sync) { Action UpdateInfo = () => { PspDisplay.CurrentInfo.Enabled = (Address != 0); if (PspDisplay.CurrentInfo.Enabled) { PspDisplay.CurrentInfo.FrameAddress = Address; PspDisplay.CurrentInfo.BufferWidth = BufferWidth; PspDisplay.CurrentInfo.PixelFormat = PixelFormat; } }; switch (Sync) { case PspDisplay.SyncMode.Immediate: UpdateInfo(); break; case Core.Display.PspDisplay.SyncMode.NextFrame: ThreadManager.Current.SetWaitAndPrepareWakeUp(HleThread.WaitType.Display, "sceDisplaySetFrameBuf", null, (WakeUp) => { PspDisplay.VBlankCallbackOnce(() => { UpdateInfo(); WakeUp(); }); }, HandleCallbacks: false); break; default: throw(new NotImplementedException("Not implemented " + Sync)); } return 0; }
public static int GetPixelsBits(GuPixelFormats PixelFormat) { return (int)(Sizes[(int)PixelFormat] * 8); }
/* * public static uint EncodePixel(GuPixelFormats PixelFormat, OutputPixel Color) * { * return ColorFormatFromPixelFormat(PixelFormat).Encode(Color.R, Color.G, Color.B, Color.A); * } * * public static OutputPixel DecodePixel(GuPixelFormats PixelFormat, uint Value) * { * throw new NotImplementedException(); * } */ public static void Decode(GuPixelFormats pixelFormat, void *input, OutputPixel *output, int width, int height, void *palette = null, GuPixelFormats paletteType = GuPixelFormats.None, int paletteCount = 0, int paletteStart = 0, int paletteShift = 0, int paletteMask = 0xFF, int strideWidth = -1, bool ignoreAlpha = false) { if (strideWidth == -1) { strideWidth = GetPixelsSize(pixelFormat, width); } var pixelFormatInt = (int)pixelFormat; var pixelFormatDecoder = new PixelFormatDecoder() { _input = input, _inputByte = (byte *)input, _inputShort = (ushort *)input, _inputInt = (uint *)input, _output = output, _strideWidth = strideWidth, _width = width, _height = height, _palette = palette, _paletteType = paletteType, _paletteCount = paletteCount, _paletteStart = paletteStart, _paletteShift = paletteShift, _paletteMask = paletteMask, }; //Console.WriteLine(PixelFormat); switch (pixelFormat) { case GuPixelFormats.Rgba5650: pixelFormatDecoder.Decode_RGBA_5650(); break; case GuPixelFormats.Rgba5551: pixelFormatDecoder.Decode_RGBA_5551(); break; case GuPixelFormats.Rgba4444: pixelFormatDecoder.Decode_RGBA_4444(); break; case GuPixelFormats.Rgba8888: pixelFormatDecoder.Decode_RGBA_8888(); break; case GuPixelFormats.PaletteT4: pixelFormatDecoder.Decode_PALETTE_T4(); break; case GuPixelFormats.PaletteT8: pixelFormatDecoder.Decode_PALETTE_T8(); break; case GuPixelFormats.PaletteT16: pixelFormatDecoder.Decode_PALETTE_T16(); break; case GuPixelFormats.PaletteT32: pixelFormatDecoder.Decode_PALETTE_T32(); break; case GuPixelFormats.CompressedDxt1: pixelFormatDecoder.Decode_COMPRESSED_DXT1(); break; case GuPixelFormats.CompressedDxt3: pixelFormatDecoder.Decode_COMPRESSED_DXT3(); break; case GuPixelFormats.CompressedDxt5: pixelFormatDecoder.Decode_COMPRESSED_DXT5(); break; default: throw new InvalidOperationException(); } if (ignoreAlpha) { for (int y = 0, n = 0; y < height; y++) { for (int x = 0; x < width; x++, n++) { output[n].A = 0xFF; } } } //DecoderCallbackTable[PixelFormatInt](Input, Output, PixelCount, Width, Palette, PaletteType, PaletteCount, PaletteStart, PaletteShift, PaletteMask); }
public static unsafe void UnswizzleInline(GuPixelFormats Format, void* Data, int Width, int Height) { UnswizzleInline(Data, GetPixelsSize(Format, Width), Height); }
public static int GetPixelsBits(GuPixelFormats pixelFormat) { return((int)(Sizes[(int)pixelFormat] * 8)); }
public static unsafe void UnswizzleInline(GuPixelFormats Format, void *Data, int Width, int Height) { UnswizzleInline(Data, GetPixelsSize(Format, Width), Height); }
public static void Encode(GuPixelFormats GuPixelFormat, OutputPixel* Input, byte* _Output, int Count) { switch (GuPixelFormat) { case GuPixelFormats.RGBA_8888: { var Output = (uint*)_Output; for (int n = 0; n < Count; n++) *Output++ = Encode_RGBA_8888_Pixel(*Input++); } break; case GuPixelFormats.RGBA_5551: { var Output = (ushort*)_Output; for (int n = 0; n < Count; n++) *Output++ = Encode_RGBA_5551_Pixel(*Input++); } break; case GuPixelFormats.RGBA_5650: { var Output = (ushort*)_Output; for (int n = 0; n < Count; n++) *Output++ = Encode_RGBA_5650_Pixel(*Input++); } break; case GuPixelFormats.RGBA_4444: { var Output = (ushort*)_Output; for (int n = 0; n < Count; n++) *Output++ = Encode_RGBA_4444_Pixel(*Input++); } break; default: throw(new NotImplementedException("Not implemented " + GuPixelFormat)); } }