Panda3D
Macros | Functions | Variables
convert_srgb.h File Reference

PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University. More...

#include "pandabase.h"
#include "luse.h"
#include "pnmimage_base.h"
#include "convert_srgb.I"

Go to the source code of this file.

Macros

#define encode_sRGB_uchar_sse2   encode_sRGB_uchar
 
#define has_sse2_sRGB_encode()   (false)
 

Functions

BEGIN_PUBLISH EXPCL_PANDA_PNMIMAGE float decode_sRGB_float (unsigned char val)
 Decodes the sRGB-encoded unsigned char value to a linearized float in the range 0-1. More...
 
EXPCL_PANDA_PNMIMAGE float decode_sRGB_float (float val)
 Decodes the sRGB-encoded floating-point value in the range 0-1 to a linearized float in the range 0-1. More...
 
EXPCL_PANDA_PNMIMAGE unsigned char decode_sRGB_uchar (unsigned char val)
 Decodes the sRGB-encoded unsigned char value to a linearized unsigned char value. More...
 
EXPCL_PANDA_PNMIMAGE unsigned char decode_sRGB_uchar (float val)
 Decodes the sRGB-encoded floating-point value in the range 0-1 to a linearized unsigned char value. More...
 
EXPCL_PANDA_PNMIMAGE float encode_sRGB_float (unsigned char val)
 Encodes the linearized unsigned char value to an sRGB-encoded floating- point value in ther range 0-1. More...
 
EXPCL_PANDA_PNMIMAGE float encode_sRGB_float (float val)
 Encodes the linearized floating-point value in the range 0-1 to an sRGB- encoded float in the range 0-1. More...
 
EXPCL_PANDA_PNMIMAGE unsigned char encode_sRGB_uchar (unsigned char val)
 Encodes the linearized unsigned char value to an sRGB-encoded unsigned char value. More...
 
EXPCL_PANDA_PNMIMAGE unsigned char encode_sRGB_uchar (float val)
 Encodes the linearized floating-point value in the range 0-1 to an sRGB- encoded unsigned char value. More...
 
END_PUBLISH EXPCL_PANDA_PNMIMAGE void encode_sRGB_uchar (const LColorf &from, xel &into)
 Encodes the linearized floating-point color value an sRGB-encoded xel in the range 0-255. More...
 
EXPCL_PANDA_PNMIMAGE void encode_sRGB_uchar (const LColorf &from, xel &into, xelval &into_alpha)
 Encodes the linearized floating-point color value an sRGB-encoded xel and alpha in the range 0-255. More...
 
EXPCL_PANDA_PNMIMAGE void encode_sRGB_uchar (const LColord &from, xel &into)
 Double-precision versions of the above. More...
 
EXPCL_PANDA_PNMIMAGE void encode_sRGB_uchar (const LColord &from, xel &into, xelval &into_alpha)
 

Variables

EXPCL_PANDA_PNMIMAGE const float to_linear_float_table [256]
 
EXPCL_PANDA_PNMIMAGE const unsigned char to_linear_uchar_table [256]
 
EXPCL_PANDA_PNMIMAGE const unsigned char to_srgb8_table [256]
 

Detailed Description

PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.

All rights reserved.

All use of this software is subject to the terms of the revised BSD license. You should have received a copy of this license along with this source code in a file named "LICENSE."

Author
rdb
Date
2014-11-13

Definition in file convert_srgb.h.

Function Documentation

◆ decode_sRGB_float() [1/2]

BEGIN_PUBLISH EXPCL_PANDA_PNMIMAGE float decode_sRGB_float ( unsigned char  val)
inline

Decodes the sRGB-encoded unsigned char value to a linearized float in the range 0-1.

Definition at line 18 of file convert_srgb.I.

Referenced by PNMImage::from_val().

◆ decode_sRGB_float() [2/2]

EXPCL_PANDA_PNMIMAGE float decode_sRGB_float ( float  val)
inline

Decodes the sRGB-encoded floating-point value in the range 0-1 to a linearized float in the range 0-1.

Inputs outside this range produce invalid results.

Definition at line 27 of file convert_srgb.I.

◆ decode_sRGB_uchar() [1/2]

EXPCL_PANDA_PNMIMAGE unsigned char decode_sRGB_uchar ( unsigned char  val)
inline

Decodes the sRGB-encoded unsigned char value to a linearized unsigned char value.

Definition at line 37 of file convert_srgb.I.

◆ decode_sRGB_uchar() [2/2]

EXPCL_PANDA_PNMIMAGE unsigned char decode_sRGB_uchar ( float  val)
inline

Decodes the sRGB-encoded floating-point value in the range 0-1 to a linearized unsigned char value.

Inputs outside this range are clamped.

Definition at line 45 of file convert_srgb.I.

◆ encode_sRGB_float() [1/2]

EXPCL_PANDA_PNMIMAGE float encode_sRGB_float ( unsigned char  val)
inline

Encodes the linearized unsigned char value to an sRGB-encoded floating- point value in ther range 0-1.

Definition at line 56 of file convert_srgb.I.

Referenced by PNMImage::to_val().

◆ encode_sRGB_float() [2/2]

EXPCL_PANDA_PNMIMAGE float encode_sRGB_float ( float  val)
inline

Encodes the linearized floating-point value in the range 0-1 to an sRGB- encoded float in the range 0-1.

Inputs outside this range produce invalid results.

Definition at line 69 of file convert_srgb.I.

◆ encode_sRGB_uchar() [1/5]

EXPCL_PANDA_PNMIMAGE unsigned char encode_sRGB_uchar ( unsigned char  val)
inline

Encodes the linearized unsigned char value to an sRGB-encoded unsigned char value.

Definition at line 80 of file convert_srgb.I.

Referenced by encode_sRGB_uchar(), and PNMImage::to_val().

◆ encode_sRGB_uchar() [2/5]

EXPCL_PANDA_PNMIMAGE unsigned char encode_sRGB_uchar ( float  val)
inline

Encodes the linearized floating-point value in the range 0-1 to an sRGB- encoded unsigned char value.

Inputs outside this range are clamped.

When SSE2 support is known at compile time, this automatically uses an optimized version. Otherwise, it does not attempt runtime CPU detection. If you know that SSE2 is supported (ie. if the function has_sse2_sRGB_encode() returns true) you should call encode_sRGB_uchar_sse2 instead.

Definition at line 95 of file convert_srgb.I.

◆ encode_sRGB_uchar() [3/5]

END_PUBLISH EXPCL_PANDA_PNMIMAGE void encode_sRGB_uchar ( const LColorf &  color,
xel into 
)
inline

Encodes the linearized floating-point color value an sRGB-encoded xel in the range 0-255.

When SSE2 support is known at compile time, this automatically uses an optimized version. Otherwise, it does not attempt runtime CPU detection. If you know that SSE2 is supported (ie. if the function has_sse2_sRGB_encode() returns true) you should call encode_sRGB_uchar_sse2 instead.

Definition at line 118 of file convert_srgb.I.

◆ encode_sRGB_uchar() [4/5]

EXPCL_PANDA_PNMIMAGE void encode_sRGB_uchar ( const LColorf &  color,
xel into,
xelval &  into_alpha 
)
inline

Encodes the linearized floating-point color value an sRGB-encoded xel and alpha in the range 0-255.

The alpha value is not sRGB-encoded.

When SSE2 support is known at compile time, this automatically uses an optimized version. Otherwise, it does not attempt runtime CPU detection. If you know that SSE2 is supported (ie. if the function has_sse2_sRGB_encode() returns true) you should call encode_sRGB_uchar_sse2 instead.

Definition at line 142 of file convert_srgb.I.

◆ encode_sRGB_uchar() [5/5]

EXPCL_PANDA_PNMIMAGE void encode_sRGB_uchar ( const LColord &  from,
xel into 
)
inline

Double-precision versions of the above.

Definition at line 162 of file convert_srgb.I.

References encode_sRGB_uchar().