pixel.c revision 2369dc897927db3f9d3c044b8f35348680d4b831
/* Cop(c) 2001, Stanford University
* All rights reserved
*
* See the file LICENSE.txt for information on redistributing this software.
*/
#include "cr_pixeldata.h"
#include "cr_error.h"
#include "cr_mem.h"
#include "cr_version.h"
#include <math.h>
#if defined(WINDOWS)
# include <float.h>
#endif
/**
* Maybe export this someday.
*/
{
switch (type) {
#ifdef CR_OPENGL_VERSION_1_2
case GL_UNSIGNED_BYTE_3_3_2:
#endif
case GL_UNSIGNED_BYTE:
case GL_BYTE:
return 1;
case GL_BITMAP:
return 0; /* special case */
#ifdef CR_OPENGL_VERSION_1_2
case GL_UNSIGNED_SHORT_5_6_5:
#endif
case GL_UNSIGNED_SHORT:
case GL_SHORT:
return 2;
#ifdef CR_OPENGL_VERSION_1_2
case GL_UNSIGNED_INT_8_8_8_8:
#endif
case GL_UNSIGNED_INT:
case GL_INT:
case GL_FLOAT:
return 4;
case GL_DOUBLE:
return 8;
default:
return 0;
}
}
/**
* \return bytes per pixel or -1 for invalid format or type, 0 for bitmap data.
*/
{
switch (type) {
#ifdef CR_OPENGL_VERSION_1_2
case GL_UNSIGNED_BYTE_3_3_2:
return 1;
#endif
case GL_UNSIGNED_BYTE:
case GL_BYTE:
bytes = 1;
break;
case GL_BITMAP:
return 0; /* special case */
#ifdef CR_OPENGL_VERSION_1_2
case GL_UNSIGNED_SHORT_5_6_5:
return 2;
#endif
case GL_UNSIGNED_SHORT:
case GL_SHORT:
bytes = 2;
break;
#ifdef CR_OPENGL_VERSION_1_2
case GL_UNSIGNED_INT_8_8_8_8:
return 4;
#endif
case GL_UNSIGNED_INT:
case GL_INT:
case GL_FLOAT:
bytes = 4;
break;
default:
crWarning( "Unknown pixel type in crPixelSize: type:0x%x(fmt:0x%x)", (unsigned int) type, (unsigned int) format);
return 0;
}
switch (format) {
case GL_COLOR_INDEX:
case GL_STENCIL_INDEX:
case GL_DEPTH_COMPONENT:
case GL_RED:
case GL_GREEN:
case GL_BLUE:
case GL_ALPHA:
case GL_LUMINANCE:
case GL_INTENSITY:
#ifdef CR_EXT_texture_sRGB
case GL_SLUMINANCE_EXT:
case GL_SLUMINANCE8_EXT:
#endif
break;
case GL_LUMINANCE_ALPHA:
#ifdef CR_EXT_texture_sRGB
case GL_SLUMINANCE_ALPHA_EXT:
#endif
bytes *= 2;
break;
case GL_RGB:
#ifdef CR_OPENGL_VERSION_1_2
case GL_BGR:
#endif
#ifdef CR_EXT_texture_sRGB
case GL_SRGB_EXT:
case GL_SRGB8_EXT:
#endif
bytes *= 3;
break;
case GL_RGBA:
#ifdef GL_ABGR_EXT
case GL_ABGR_EXT:
#endif
#ifdef CR_OPENGL_VERSION_1_2
case GL_BGRA:
#endif
#ifdef CR_EXT_texture_sRGB
case GL_SRGB_ALPHA_EXT:
case GL_SRGB8_ALPHA8_EXT:
#endif
bytes *= 4;
break;
default:
crWarning( "Unknown pixel format in crPixelSize: type:0x%x(fmt:0x%x)", (unsigned int) type, (unsigned int) format);
return 0;
}
return bytes;
}
static float SRGBF_TO_RGBF(float f)
{
if (isnan(f)) return 0.f;
if (f<=0.04045f)
{
return f/12.92f;
}
else
{
}
}
static float RGBF_TO_SRGBF(float f)
{
if (isnan(f)) return 0.f;
if (f>1.f) return 1.f;
if (f<0.f) return 0.f;
if (f<0.0031308f)
{
return f*12.92f;
}
else
{
}
}
#ifdef _MSC_VER
* optimizations enabled. It varies a bit between 8.0/64 and 7.1/32 - the latter seems
* to be fine with just disabling opts for get_row, while the former needs both to be
* disabled to compile it a decent time. It seems this isn't important code after all,
* so we're not overly worried about the performance degration. Even so, we might want
* to look into it before long, perhaps checking with Visual C++ 9.0 (aka 2008). */
#endif
/*
* Pack src pixel data into tmpRow array as either GLfloat[][1] or
* GLfloat[][4] depending on whether the format is for colors.
*/
static void
{
int i;
switch (srcType) {
case GL_BYTE:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_BYTE:
for (i = 0; i < width; i++)
break;
case GL_SHORT:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_SHORT:
for (i = 0; i < width; i++)
break;
case GL_INT:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_INT:
for (i = 0; i < width; i++)
break;
case GL_FLOAT:
for (i = 0; i < width; i++)
break;
case GL_DOUBLE:
for (i = 0; i < width; i++)
break;
default:
}
}
else if (srcFormat == GL_DEPTH_COMPONENT) {
switch (srcType) {
case GL_BYTE:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_BYTE:
for (i = 0; i < width; i++)
break;
case GL_SHORT:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_SHORT:
for (i = 0; i < width; i++)
break;
case GL_INT:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_INT:
for (i = 0; i < width; i++)
break;
case GL_FLOAT:
for (i = 0; i < width; i++)
break;
case GL_DOUBLE:
for (i = 0; i < width; i++)
break;
default:
}
}
int dst;
dst = 0;
dst = 1;
dst = 2;
else
dst = 3;
for (i = 0; i < width; i++) {
}
switch (srcType) {
case GL_BYTE:
break;
case GL_UNSIGNED_BYTE:
break;
case GL_SHORT:
break;
case GL_UNSIGNED_SHORT:
break;
case GL_INT:
break;
case GL_UNSIGNED_INT:
break;
case GL_FLOAT:
break;
case GL_DOUBLE:
break;
default:
}
}
else if (srcFormat == GL_LUMINANCE
#ifdef CR_EXT_texture_sRGB
|| srcFormat == GL_SLUMINANCE_EXT
|| srcFormat == GL_SLUMINANCE8_EXT
#endif
) {
switch (srcType) {
case GL_BYTE:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_BYTE:
for (i = 0; i < width; i++) {
}
break;
case GL_SHORT:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_SHORT:
for (i = 0; i < width; i++) {
}
break;
case GL_INT:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_INT:
for (i = 0; i < width; i++) {
}
break;
case GL_FLOAT:
for (i = 0; i < width; i++) {
}
break;
case GL_DOUBLE:
for (i = 0; i < width; i++) {
}
break;
default:
}
}
else if (srcFormat == GL_INTENSITY) {
switch (srcType) {
case GL_BYTE:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_BYTE:
for (i = 0; i < width; i++)
break;
case GL_SHORT:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_SHORT:
for (i = 0; i < width; i++)
break;
case GL_INT:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_INT:
for (i = 0; i < width; i++)
= UINT_TO_FLOAT(uiSrc[i]);
break;
case GL_FLOAT:
for (i = 0; i < width; i++)
= fSrc[i];
break;
case GL_DOUBLE:
for (i = 0; i < width; i++)
break;
default:
}
}
else if (srcFormat == GL_LUMINANCE_ALPHA
#ifdef CR_EXT_texture_sRGB
#endif
) {
switch (srcType) {
case GL_BYTE:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_BYTE:
for (i = 0; i < width; i++) {
}
break;
case GL_SHORT:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_SHORT:
for (i = 0; i < width; i++) {
}
break;
case GL_INT:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_INT:
for (i = 0; i < width; i++) {
}
break;
case GL_FLOAT:
for (i = 0; i < width; i++) {
}
break;
case GL_DOUBLE:
for (i = 0; i < width; i++) {
}
break;
default:
}
}
#ifdef CR_OPENGL_VERSION_1_2
#endif
#ifdef CR_EXT_texture_sRGB
|| srcFormat == GL_SRGB_EXT
|| srcFormat == GL_SRGB8_EXT
#endif
) {
int r, b;
#ifdef CR_EXT_texture_sRGB
|| srcFormat == GL_SRGB_EXT
|| srcFormat == GL_SRGB8_EXT
#endif
) {
r = 0; b = 2;
}
else {
r = 2; b = 0;
}
switch (srcType) {
case GL_BYTE:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_BYTE:
for (i = 0; i < width; i++) {
}
break;
case GL_SHORT:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_SHORT:
for (i = 0; i < width; i++) {
}
break;
case GL_INT:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_INT:
for (i = 0; i < width; i++) {
}
break;
case GL_FLOAT:
for (i = 0; i < width; i++) {
}
break;
case GL_DOUBLE:
for (i = 0; i < width; i++) {
}
break;
#ifdef CR_OPENGL_VERSION_1_2
case GL_UNSIGNED_BYTE_3_3_2:
for (i = 0; i < width; i++) {
}
break;
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_SHORT_5_6_5:
for (i = 0; i < width; i++) {
}
break;
for (i = 0; i < width; i++) {
}
break;
#endif
default:
}
}
#ifdef CR_OPENGL_VERSION_1_2
#endif
#ifdef CR_EXT_texture_sRGB
|| srcFormat == GL_SRGB_ALPHA_EXT
|| srcFormat == GL_SRGB8_ALPHA8_EXT
#endif
) {
int r, b;
#ifdef CR_EXT_texture_sRGB
|| srcFormat == GL_SRGB_ALPHA_EXT
|| srcFormat == GL_SRGB8_ALPHA8_EXT
#endif
)
{
r = 0; b = 2;
}
else {
r = 2; b = 0;
}
switch (srcType) {
case GL_BYTE:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_BYTE:
for (i = 0; i < width; i++) {
}
break;
case GL_SHORT:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_SHORT:
for (i = 0; i < width; i++) {
}
break;
case GL_INT:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_INT:
for (i = 0; i < width; i++) {
}
break;
case GL_FLOAT:
for (i = 0; i < width; i++) {
}
break;
case GL_DOUBLE:
for (i = 0; i < width; i++) {
}
break;
#ifdef CR_OPENGL_VERSION_1_2
for (i = 0; i < width; i++) {
}
break;
for (i = 0; i < width; i++) {
}
break;
for (i = 0; i < width; i++) {
}
break;
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_INT_8_8_8_8:
for (i = 0; i < width; i++) {
}
break;
for (i = 0; i < width; i++) {
}
break;
for (i = 0; i < width; i++) {
}
break;
for (i = 0; i < width; i++) {
}
break;
#endif
default:
}
}
else{
}
#ifdef CR_EXT_texture_sRGB
if (srcFormat == GL_SRGB_EXT
|| srcFormat == GL_SRGB8_EXT
|| srcFormat == GL_SRGB_ALPHA_EXT
|| srcFormat == GL_SRGB8_ALPHA8_EXT
|| srcFormat == GL_SLUMINANCE_EXT
|| srcFormat == GL_SLUMINANCE8_EXT
)
{
for (i=0; i<width; ++i)
{
}
}
#endif
}
{
int i;
#ifdef CR_EXT_texture_sRGB
if (dstFormat == GL_SRGB_EXT
|| dstFormat == GL_SRGB8_EXT
|| dstFormat == GL_SRGB_ALPHA_EXT
|| dstFormat == GL_SRGB8_ALPHA8_EXT
|| dstFormat == GL_SLUMINANCE_EXT
|| dstFormat == GL_SLUMINANCE8_EXT
)
{
for (i=0; i<width; ++i)
{
}
}
#endif
switch (dstType) {
case GL_BYTE:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_BYTE:
for (i = 0; i < width; i++)
break;
case GL_SHORT:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_SHORT:
for (i = 0; i < width; i++)
break;
case GL_INT:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_INT:
for (i = 0; i < width; i++)
break;
case GL_FLOAT:
for (i = 0; i < width; i++)
break;
case GL_DOUBLE:
for (i = 0; i < width; i++)
break;
default:
}
}
else if (dstFormat == GL_DEPTH_COMPONENT) {
switch (dstType) {
case GL_BYTE:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_BYTE:
for (i = 0; i < width; i++)
break;
case GL_SHORT:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_SHORT:
for (i = 0; i < width; i++)
break;
case GL_INT:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_INT:
for (i = 0; i < width; i++)
break;
case GL_FLOAT:
for (i = 0; i < width; i++)
break;
case GL_DOUBLE:
for (i = 0; i < width; i++)
break;
default:
}
}
#ifdef CR_EXT_texture_sRGB
|| dstFormat == GL_SLUMINANCE_EXT
|| dstFormat == GL_SLUMINANCE8_EXT
#endif
) {
int index;
index = 0;
else if (dstFormat == GL_LUMINANCE
#ifdef CR_EXT_texture_sRGB
|| dstFormat == GL_SLUMINANCE_EXT
|| dstFormat == GL_SLUMINANCE8_EXT
#endif
)
index = 0;
else if (dstFormat == GL_INTENSITY)
index = 0;
index = 1;
index = 2;
else
index = 3;
switch (dstType) {
case GL_BYTE:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_BYTE:
for (i = 0; i < width; i++)
break;
case GL_SHORT:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_SHORT:
for (i = 0; i < width; i++)
break;
case GL_INT:
for (i = 0; i < width; i++)
break;
case GL_UNSIGNED_INT:
for (i = 0; i < width; i++)
break;
case GL_FLOAT:
for (i = 0; i < width; i++)
break;
case GL_DOUBLE:
for (i = 0; i < width; i++)
break;
default:
}
}
else if (dstFormat == GL_LUMINANCE_ALPHA
#ifdef CR_EXT_texture_sRGB
#endif
) {
switch (dstType) {
case GL_BYTE:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_BYTE:
for (i = 0; i < width; i++) {
}
break;
case GL_SHORT:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_SHORT:
for (i = 0; i < width; i++) {
}
break;
case GL_INT:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_INT:
for (i = 0; i < width; i++) {
}
break;
case GL_FLOAT:
for (i = 0; i < width; i++) {
}
break;
case GL_DOUBLE:
for (i = 0; i < width; i++) {
}
break;
default:
}
}
#ifdef CR_OPENGL_VERSION_1_2
#endif
#ifdef CR_EXT_texture_sRGB
|| dstFormat == GL_SRGB_EXT
|| dstFormat == GL_SRGB8_EXT
#endif
) {
int r, b;
#ifdef CR_EXT_texture_sRGB
|| dstFormat == GL_SRGB_EXT
|| dstFormat == GL_SRGB8_EXT
#endif
) {
r = 0; b = 2;
}
else {
r = 2; b = 0;
}
switch (dstType) {
case GL_BYTE:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_BYTE:
for (i = 0; i < width; i++) {
}
break;
case GL_SHORT:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_SHORT:
for (i = 0; i < width; i++) {
}
break;
case GL_INT:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_INT:
for (i = 0; i < width; i++) {
}
break;
case GL_FLOAT:
for (i = 0; i < width; i++) {
}
break;
case GL_DOUBLE:
for (i = 0; i < width; i++) {
}
break;
#ifdef CR_OPENGL_VERSION_1_2
case GL_UNSIGNED_BYTE_3_3_2:
for (i = 0; i < width; i++) {
}
break;
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_SHORT_5_6_5:
for (i = 0; i < width; i++) {
}
break;
for (i = 0; i < width; i++) {
}
break;
#endif
default:
}
}
#ifdef CR_OPENGL_VERSION_1_2
#endif
#ifdef CR_EXT_texture_sRGB
|| dstFormat == GL_SRGB_ALPHA_EXT
|| dstFormat == GL_SRGB8_ALPHA8_EXT
#endif
) {
int r, b;
#ifdef CR_EXT_texture_sRGB
|| dstFormat == GL_SRGB_ALPHA_EXT
|| dstFormat == GL_SRGB8_ALPHA8_EXT
#endif
) {
r = 0; b = 2;
}
else {
r = 2; b = 0;
}
switch (dstType) {
case GL_BYTE:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_BYTE:
for (i = 0; i < width; i++) {
}
break;
case GL_SHORT:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_SHORT:
for (i = 0; i < width; i++) {
}
break;
case GL_INT:
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_INT:
for (i = 0; i < width; i++) {
}
break;
case GL_FLOAT:
for (i = 0; i < width; i++) {
}
break;
case GL_DOUBLE:
for (i = 0; i < width; i++) {
}
break;
#ifdef CR_OPENGL_VERSION_1_2
for (i = 0; i < width; i++) {
}
break;
for (i = 0; i < width; i++) {
}
break;
for (i = 0; i < width; i++) {
}
break;
for (i = 0; i < width; i++) {
}
break;
case GL_UNSIGNED_INT_8_8_8_8:
for (i = 0; i < width; i++) {
}
break;
for (i = 0; i < width; i++) {
}
break;
for (i = 0; i < width; i++) {
}
break;
for (i = 0; i < width; i++) {
}
break;
#endif
default:
}
}
else{
}
}
#ifdef _MSC_VER
#endif
/**
* Byte-swap an array of GLushorts
*/
static void
{
GLuint i;
for (i = 0; i < n; i++) {
}
}
/**
* Byte-swap an array of GLuints
*/
static void
{
GLuint i;
for (i = 0; i < n; i++) {
ui[i] = (b >> 24)
| ((b >> 8) & 0xff00)
| ((b << 8) & 0xff0000)
| ((b << 24) & 0xff000000);
}
}
/**
* Return number of bytes of storage needed to accomodate an
* image with the given format, type, and size.
* \return size in bytes or -1 if bad format or type
*/
{
{
/* This was wrong in the old code! */
}
{
/*GL_DEPTH_COMPONENT with GL_UNSIGNED_BYTE seems to be more than 1 byte per pixel*/
}
else
{
}
return bytes;
}
/**
* Return number of bytes of storage needed to accomodate a
* 3D texture with the give format, type, and size.
* \return size in bytes or -1 if bad format or type
*/
unsigned int crTextureSize( GLenum format, GLenum type, GLsizei width, GLsizei height, GLsizei depth )
{
{
/*
* Not sure about this one, so just multiply
* by the depth?
*/
}
else
{
}
return bytes;
}
static const CRPixelPackState defaultPacking = {
0, /* rowLength */
0, /* skipRows */
0, /* skipPixels */
1, /* alignment */
0, /* imageHeight */
0, /* skipImages */
GL_FALSE, /* swapBytes */
GL_FALSE /* psLSBFirst */
};
{
}
const CRPixelPackState *dstPacking,
const CRPixelPackState *srcPacking )
{
int srcBytesPerPixel;
int dstBytesPerPixel;
int srcBytesPerRow;
int dstBytesPerRow;
int srcRowStrideBytes;
int dstRowStrideBytes;
int bytesPerRow;
int i;
if (!dstPacking)
if (!srcPacking)
{
if (srcPacking->rowLength > 0)
else
for (i=0; i<height; i++) {
dst += dstRowStrideBytes;
src += srcRowStrideBytes;
}
}
else
{
if (srcBytesPerPixel < 0 || dstBytesPerPixel < 0)
return;
/* Stride between rows (in bytes) */
if (srcPacking->rowLength > 0)
else
if (dstPacking->rowLength > 0)
else
/* bytes per row */
/* handle the alignment */
if (i)
if (i)
}
if (i)
if (i)
}
/* handle skip rows */
/* handle skip pixels */
/* we don't do LSBFirst yet */
if (srcPacking->psLSBFirst)
crError( "Sorry, no lsbfirst for you" );
if (dstPacking->psLSBFirst)
crError( "Sorry, no lsbfirst for you" );
{
{
}
else
//crDebug("Sending texture, BytesPerRow!=RowStrideBytes");
for (i = 0; i < height; i++)
{
#if 0
/* check if src XOR dst swapping */
if (size == 2) {
}
else if (size == 4) {
}
}
#endif
dst += dstRowStrideBytes;
src += srcRowStrideBytes;
}
}
else
{
crDebug("Converting texture format");
if (!tmpRow)
crError("Out of memory in crPixelCopy2D");
if (srcPacking->swapBytes) {
if (!swapRow) {
crError("Out of memory in crPixelCopy2D");
}
}
for (i = 0; i < height; i++)
{
/* get src row as floats */
if (srcPacking->swapBytes) {
if (size == 2)
else if (size == 4)
}
else {
}
/* store floats in dest row */
if (dstPacking->swapBytes) {
if (size == 2)
else if (size == 4)
}
else {
}
/* increment pointers for next row */
dst += dstRowStrideBytes;
src += srcRowStrideBytes;
}
if (swapRow)
}
}
}
const CRPixelPackState *dstPacking,
const CRPixelPackState *srcPacking )
{
int tex_size = 0;
(void)srcPacking;
(void)srcType;
(void)srcFormat;
(void)dstPacking;
/*@todo this should be implemented properly*/
crWarning( "crPixelCopy3D: simply crMemcpy'ing from srcPtr to dstPtr" );
crWarning( "crPixelCopy3D: formats don't match!" );
crWarning( "crPixelCopy3D: formats don't match!" );
}
/* Round N up to the next multiple of 8 */
{
srcPacking->skipRows == 0 &&
srcPacking->skipPixels == 0 &&
/* simple case */
}
else {
/* general case */
GLint i, j;
if (srcPacking->rowLength > 0)
else
switch (srcPacking->alignment) {
case 1:
break;
case 2:
break;
case 4:
break;
case 8:
break;
default:
crError( "Invalid unpack alignment in crBitmapCopy");
return;
}
/* src_row_length and dst_row_length are in bytes */
if (srcPacking->psLSBFirst) {
for (j = 0; j < height; j++) {
for (i = 0; i < width; i++) {
if (b & (1 << iBit))
}
srcRow += src_row_length;
dstRow += dst_row_length;
}
}
else {
/* unpack MSB first */
for (j = 0; j < height; j++) {
for (i = 0; i < width; i++) {
if (b & (128 >> iBit))
}
srcRow += src_row_length;
dstRow += dst_row_length;
}
}
}
}