TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ImageFormat_convert.cpp File Reference
#include "G3D/ImageFormat.h"
#include "G3D/Color1unorm8.h"
#include "G3D/Color3unorm8.h"
#include "G3D/Color4unorm8.h"
#include "G3D/Color1.h"
#include "G3D/Color3.h"
#include "G3D/Color4.h"
+ Include dependency graph for ImageFormat_convert.cpp:

Classes

struct  G3D::ConvertAttributes
 

Namespaces

 G3D
 

Macros

#define DECLARE_CONVERT_FUNC(name)   static void name(const Array<const void*>& srcBytes, int srcWidth, int srcHeight, const ImageFormat* srcFormat, int srcRowPadBits, const Array<void*>& dstBytes, const ImageFormat* dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg);
 
#define PIXEL_RGB8_TO_YUV_Y(r, g, b)   unorm8::fromBits(iClamp(((66 * r.bits() + 129 * g.bits() + 25 * b.bits() + 128) >> 8) + 16, 0, 255))
 
#define PIXEL_RGB8_TO_YUV_U(r, g, b)   unorm8::fromBits(iClamp(((-38 * r.bits() - 74 * g.bits() + 112 * b.bits() + 128) >> 8) + 128, 0, 255))
 
#define PIXEL_RGB8_TO_YUV_V(r, g, b)   unorm8::fromBits(iClamp(((112 * r.bits() - 94 * g.bits() - 18 * b.bits() + 128) >> 8) + 128, 0, 255))
 
#define PIXEL_YUV_TO_RGB8_R(y, u, v)   unorm8::fromBits(iClamp((298 * (y.bits() - 16) + 409 * (v.bits() - 128) + 128) >> 8, 0, 255))
 
#define PIXEL_YUV_TO_RGB8_G(y, u, v)   unorm8::fromBits(iClamp((298 * (y.bits() - 16) - 100 * (u.bits() - 128) - 208 * (v.bits() - 128) + 128) >> 8, 0, 255))
 
#define PIXEL_YUV_TO_RGB8_B(y, u, v)   unorm8::fromBits(iClamp((298 * (y.bits() - 16) + 516 * (u.bits() - 128) + 128) >> 8, 0, 255))
 
#define B_BGG   R_GRG
 
#define B_GRG   R_BGG
 
#define B_GRR   R_BGB
 

Typedefs

typedef void(* G3D::ConvertFunc )(const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 

Functions

 G3D::DECLARE_CONVERT_FUNC (l8_to_rgb8)
 
 G3D::DECLARE_CONVERT_FUNC (l32f_to_rgb8)
 
 G3D::DECLARE_CONVERT_FUNC (rgb8_to_rgba8)
 
 G3D::DECLARE_CONVERT_FUNC (rgb8_to_bgr8)
 
 G3D::DECLARE_CONVERT_FUNC (rgb8_to_rgba32f)
 
 G3D::DECLARE_CONVERT_FUNC (bgr8_to_rgb8)
 
 G3D::DECLARE_CONVERT_FUNC (bgr8_to_rgba8)
 
 G3D::DECLARE_CONVERT_FUNC (bgr8_to_rgba32f)
 
 G3D::DECLARE_CONVERT_FUNC (rgba8_to_rgb8)
 
 G3D::DECLARE_CONVERT_FUNC (rgba8_to_bgr8)
 
 G3D::DECLARE_CONVERT_FUNC (rgba8_to_rgba32f)
 
 G3D::DECLARE_CONVERT_FUNC (rgb32f_to_rgba32f)
 
 G3D::DECLARE_CONVERT_FUNC (rgba32f_to_rgb8)
 
 G3D::DECLARE_CONVERT_FUNC (rgba32f_to_rgba8)
 
 G3D::DECLARE_CONVERT_FUNC (rgba32f_to_bgr8)
 
 G3D::DECLARE_CONVERT_FUNC (rgba32f_to_rgb32f)
 
 G3D::DECLARE_CONVERT_FUNC (rgba32f_to_bayer_rggb8)
 
 G3D::DECLARE_CONVERT_FUNC (rgba32f_to_bayer_gbrg8)
 
 G3D::DECLARE_CONVERT_FUNC (rgba32f_to_bayer_grbg8)
 
 G3D::DECLARE_CONVERT_FUNC (rgba32f_to_bayer_bggr8)
 
 G3D::DECLARE_CONVERT_FUNC (bayer_rggb8_to_rgba32f)
 
 G3D::DECLARE_CONVERT_FUNC (bayer_gbrg8_to_rgba32f)
 
 G3D::DECLARE_CONVERT_FUNC (bayer_grbg8_to_rgba32f)
 
 G3D::DECLARE_CONVERT_FUNC (bayer_bggr8_to_rgba32f)
 
 G3D::DECLARE_CONVERT_FUNC (rgb8_to_yuv420p)
 
 G3D::DECLARE_CONVERT_FUNC (rgb8_to_yuv422)
 
 G3D::DECLARE_CONVERT_FUNC (rgb8_to_yuv444)
 
 G3D::DECLARE_CONVERT_FUNC (yuv420p_to_rgb8)
 
 G3D::DECLARE_CONVERT_FUNC (yuv422_to_rgb8)
 
 G3D::DECLARE_CONVERT_FUNC (yuv444_to_rgb8)
 
static ConvertFunc G3D::findConverter (TextureFormat::Code sourceCode, TextureFormat::Code destCode, bool needsSourcePadding, bool needsDestPadding, bool needsInvertY)
 
bool G3D::conversionAvailable (const ImageFormat *srcFormat, int srcRowPadBits, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY=false)
 
static void G3D::l8_to_rgb8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::l32f_to_rgb8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::rgb8_to_rgba8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::rgb8_to_bgr8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::rgb8_to_rgba32f (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::bgr8_to_rgb8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::bgr8_to_rgba8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::bgr8_to_rgba32f (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::rgba8_to_rgb8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::rgba8_to_bgr8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::rgba8_to_rgba32f (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::rgb32f_to_rgba32f (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::rgba32f_to_rgb8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::rgba32f_to_rgba8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::rgba32f_to_bgr8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::rgba32f_to_rgb32f (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static uint32 G3D::blendPixels (uint32 pixel1, uint32 pixel2)
 
static void G3D::rgb8_to_yuv420p (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::rgb8_to_yuv422 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::rgb8_to_yuv444 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::yuv420p_to_rgb8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::yuv422_to_rgb8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::yuv444_to_rgb8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static unorm8 G3D::applyFilter (const unorm8 *I, int x, int y, int w, int h, const float filter[5][5])
 
static void G3D::swapRedAndBlue (int N, Color3unorm8 *out)
 
static void G3D::rgb8_to_bayer_rggb8 (const int w, const int h, const unorm8 *src, unorm8 *dst)
 
static void G3D::rgb8_to_bayer_grbg8 (const int w, const int h, const unorm8 *src, unorm8 *dst)
 
static void G3D::rgb8_to_bayer_bggr8 (const int w, const int h, const unorm8 *src, unorm8 *dst)
 
static void G3D::rgb8_to_bayer_gbrg8 (const int w, const int h, const unorm8 *src, unorm8 *dst)
 
static void G3D::rgba32f_to_bayer_rggb8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::rgba32f_to_bayer_gbrg8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::rgba32f_to_bayer_grbg8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::rgba32f_to_bayer_bggr8 (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::bayer_rggb8_to_rgb8_mhc (int w, int h, const unorm8 *in, unorm8 *_out)
 
static void G3D::bayer_gbrg8_to_rgb8_mhc (int w, int h, const unorm8 *in, unorm8 *_out)
 
static void G3D::bayer_grbg8_to_rgb8_mhc (int w, int h, const unorm8 *in, unorm8 *_out)
 
static void G3D::bayer_bggr8_to_rgb8_mhc (int w, int h, const unorm8 *in, unorm8 *_out)
 
static void G3D::bayer_rggb8_to_rgba32f (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::bayer_gbrg8_to_rgba32f (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::bayer_grbg8_to_rgba32f (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 
static void G3D::bayer_bggr8_to_rgba32f (const Array< const void * > &srcBytes, int srcWidth, int srcHeight, const ImageFormat *srcFormat, int srcRowPadBits, const Array< void * > &dstBytes, const ImageFormat *dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg)
 

Variables

static const int G3D::NUM_CONVERT_IMAGE_FORMATS = 5
 
static const ConvertAttributes G3D::sConvertMappings []
 
static const float G3D::G_GRR [5][5]
 
static const float G3D::G_BGB [5][5]
 
static const float G3D::R_GRG [5][5]
 
static const float G3D::R_BGG [5][5]
 
static const float G3D::R_BGB [5][5]
 

Macro Definition Documentation

#define B_BGG   R_GRG
#define B_GRG   R_BGG
#define B_GRR   R_BGB
#define DECLARE_CONVERT_FUNC (   name)    static void name(const Array<const void*>& srcBytes, int srcWidth, int srcHeight, const ImageFormat* srcFormat, int srcRowPadBits, const Array<void*>& dstBytes, const ImageFormat* dstFormat, int dstRowPadBits, bool invertY, ImageFormat::BayerAlgorithm bayerAlg);
#define PIXEL_RGB8_TO_YUV_U (   r,
  g,
 
)    unorm8::fromBits(iClamp(((-38 * r.bits() - 74 * g.bits() + 112 * b.bits() + 128) >> 8) + 128, 0, 255))
#define PIXEL_RGB8_TO_YUV_V (   r,
  g,
 
)    unorm8::fromBits(iClamp(((112 * r.bits() - 94 * g.bits() - 18 * b.bits() + 128) >> 8) + 128, 0, 255))
#define PIXEL_RGB8_TO_YUV_Y (   r,
  g,
 
)    unorm8::fromBits(iClamp(((66 * r.bits() + 129 * g.bits() + 25 * b.bits() + 128) >> 8) + 16, 0, 255))
#define PIXEL_YUV_TO_RGB8_B (   y,
  u,
 
)    unorm8::fromBits(iClamp((298 * (y.bits() - 16) + 516 * (u.bits() - 128) + 128) >> 8, 0, 255))
#define PIXEL_YUV_TO_RGB8_G (   y,
  u,
 
)    unorm8::fromBits(iClamp((298 * (y.bits() - 16) - 100 * (u.bits() - 128) - 208 * (v.bits() - 128) + 128) >> 8, 0, 255))
#define PIXEL_YUV_TO_RGB8_R (   y,
  u,
 
)    unorm8::fromBits(iClamp((298 * (y.bits() - 16) + 409 * (v.bits() - 128) + 128) >> 8, 0, 255))