My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Links

Important

BlitJit technology will be merged with Fog-Framework, it will not be individual project as it is currently. After merging the BlitJit will be abandoned or deleted from google-code. The reason is that nobody is using or is interested about BlitJit so the development will be simpler when using it only through Fog-Framework (data structures, pipeline, etc...).

Introduction

BlitJit is high performance low level image blitting library for C++ language designed to take power of jit compilation. It's designed for embedding in graphics libraries with higher level API, but it's possible to use it directly without any other wrappers. BlitJit supports several pixel formats and compositing operations and can compile (just in time) functions for them. Currently BlitJit is crossplatform, but host processor must be x86 or x64 compatible (64 bit mode is supported of course).

BlitJit library should be used to maximize speed of graphics operations. Each higher level library needs low level pixel manipulation functions that can affect overall library performance. Because BlitJit compiles everything in runtime (just in time) it can compile functions that are best for current processor.

For just in time compilation is used AsmJit library.

Features

BlitJit library contains generators that can create these kind of functions:

  • Premultiply / demultiply
  • Fill span or rect by single color (fill type operation)
  • Composite span or rectangle by color data (composite type operation)

Optimizations

BlitJit library is optimized for generating code that outperforms others. Because pixel format conversions can be directly inlined into compositing process only 1 pass is needed to do whole operation that can take up to 4 or more passes in other libraries. Another optimization is using MMX or SSE2 instructions to do more pixels in one instruction.

BlitJit contains code to use these features if processor contains them:

  • No features / plain X86/X64 code if processor is very old or to compare MMX/SSE2 performance (worst performance)
  • MMX features with or without 3dNow/SSE support (better performance)
  • SSE2 features (best performance)
  • 64 bit mode support (using additional registers and tricks to maximize performance)

Together with using these features code generator can generate specialized efficient code for AMD or Intel processors, but this is very minor kind of optimization.

Status

Because BlitJit library is written using JIT compilation and it's time consuming to write really good MMX/SSE2 code it's important to introduce library status. Next list shows what operations and for what pixel format are implemented:

  • PRGB32 (operator) PRGB32 - All types of operations (this is primary format)
  • PRGB32 (operator) ARGB32 - All types of operations (source is premultiplied by generated blitter)
  • PRGB32 (operator) PRGB32 (in) A8 - All types of operations (this is primary format)
  • PRGB32 (operator) ARGB32 (in) A8 - All types of operations (source is premultiplied by generated blitter)

Pixel format descriptions:

  • PRGB32 - 32 bit RGB pixel with alpha value, color channels are premultiplied by alpha (this is primary format for compositing)
  • ARGB32 - 32 bit RGB pixel with alpha value
  • A8 - 8 bit pixel with only alpha information, in computer graphics this format is output format from rasterizers and glyphs (generated from fonts)

Note that byte channel positions in pixel can be customized.

Operators supported:

  • Source
  • Destination
  • Source Over
  • Destination Over
  • Source In
  • Destination In
  • Source Out
  • Destination Out
  • Source Atop
  • Destination Atop
  • Xor
  • Clear
  • Add
  • Subtract
  • Multiply
  • Screen
  • Darken
  • Lighten
  • Difference
  • Exclusion
  • Invert
  • InvertRgb

Operations are compatible with SVG specification.

Optimizations:

  • SSE2 - This is only optimization implemented at this time and main focused one.

Download

Currently BlitJit is only available through SVN repository. There is no stable release yet because library is improved day by day.

Related Projects

  • AsmJit - Complete JIT Assembler for C++ Language.
  • Fog-Framework - High performance 2d graphics library that uses BlitJit (BlitJit was created for Fog).

Google Groups and Mailing Lists

BlitJit google group:

BlitJit mailing list:

  • blitjit-dev@googlegroups.com

Powered by Google Project Hosting