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 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 void DrawVideo(uint frameBufferAddress, OutputPixel *outputPixel, int width, int height) { var drawBuffer = GetOrCreateDrawBufferTexture(new DrawBufferKey() { Address = frameBufferAddress, }); drawBuffer.Bind(); //GL.DrawPixels(Width, Height, PixelFormat.Bgra, PixelType.UnsignedInt8888Reversed, new IntPtr(OutputPixel)); drawBuffer.Unbind(); Console.WriteLine("DrawVideo: {0:X8}, {1}x{2}", frameBufferAddress, width, height); }
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 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 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 override void DrawVideo(uint frameBufferAddress, OutputPixel *outputPixel, int width, int height) { RenderbufferManager.DrawVideo(frameBufferAddress, outputPixel, width, height); }