<commit_before>#include <KrisLibrary/Logger.h>
#include <KrisLibrary/File.h>
#include <KrisLibrary/utils.h>
#include <KrisLibrary/errors.h>
#include <stdlib.h>
#include <stdio.h>
#include <utils.h>
#include <memory.h>
#include <math.h>
#include <iostream>
using namespace std;

#include "image.h"
#include <math.h>


static int IMAGEHEADER = 0xd0d0beef;

#include "formats.h"

PIXELGETPROC pixel_get_proc(Image::PixelFormat format)
{
	switch(format)
	{
	case Image::R8G8B8A8:
		return rgba_get;
	case Image::R8G8B8:
		return rgb8_get;
	case Image::B8G8R8A8:
		return bgra_get;
	case Image::B8G8R8:
		return bgr8_get;
	case Image::R5G6B5:
		return r5g6b5_get;
	case Image::R5G5B5X1:
		return r5g5b5x1_get;
	case Image::A8:
		return a8_get;
	case Image::FloatRGB:
		return frgb_get;
	case Image::FloatRGBA:
		return frgba_get;
	case Image::FloatA:
		return fa_get;
	default:
		FatalError("Unknown Image pixel format");
	}
	return NULL;
}

PIXELSETPROC pixel_set_proc(Image::PixelFormat format)
{
	switch(format)
	{
	case Image::R8G8B8A8:
		return rgba_set;
	case Image::R8G8B8:
		return rgb8_set;
	case Image::R5G6B5:
		return r5g6b5_set;
	case Image::B8G8R8A8:
		return bgra_set;
	case Image::B8G8R8:
		return bgr8_set;
	case Image::R5G5B5X1:
		return r5g5b5x1_set;
	case Image::A8:
		return a8_set;
	case Image::FloatRGB:
		return frgb_set;
	case Image::FloatRGBA:
		return frgba_set;
	case Image::FloatA:
		return fa_set;
	default:
		FatalError("Unknown Image pixel format");
	}
	return NULL;
}


static unsigned int pfsizes [] = 
{
	0,
	3,
	4,
	2,
	2,
	1,
	12,
	16,
	4
};

bool Image::isValidFormat(PixelFormat f)
{
	return (f < ArraySize(pfsizes) && f >= 0);
}

unsigned int Image::pixelFormatSize(PixelFormat f)
{
	if(f >= ArraySize(pfsizes)) return false;
	return pfsizes[f];
}

<commit_msg>Fixed problem with texture bits per pixel<commit_after>#include <KrisLibrary/Logger.h>
#include <KrisLibrary/File.h>
#include <KrisLibrary/utils.h>
#include <KrisLibrary/errors.h>
#include <stdlib.h>
#include <stdio.h>
#include <utils.h>
#include <memory.h>
#include <math.h>
#include <iostream>
using namespace std;

#include "image.h"
#include <math.h>


static int IMAGEHEADER = 0xd0d0beef;

#include "formats.h"

PIXELGETPROC pixel_get_proc(Image::PixelFormat format)
{
	switch(format)
	{
	case Image::R8G8B8A8:
		return rgba_get;
	case Image::R8G8B8:
		return rgb8_get;
	case Image::B8G8R8A8:
		return bgra_get;
	case Image::B8G8R8:
		return bgr8_get;
	case Image::R5G6B5:
		return r5g6b5_get;
	case Image::R5G5B5X1:
		return r5g5b5x1_get;
	case Image::A8:
		return a8_get;
	case Image::FloatRGB:
		return frgb_get;
	case Image::FloatRGBA:
		return frgba_get;
	case Image::FloatA:
		return fa_get;
	default:
		FatalError("Unknown Image pixel format");
	}
	return NULL;
}

PIXELSETPROC pixel_set_proc(Image::PixelFormat format)
{
	switch(format)
	{
	case Image::R8G8B8A8:
		return rgba_set;
	case Image::R8G8B8:
		return rgb8_set;
	case Image::R5G6B5:
		return r5g6b5_set;
	case Image::B8G8R8A8:
		return bgra_set;
	case Image::B8G8R8:
		return bgr8_set;
	case Image::R5G5B5X1:
		return r5g5b5x1_set;
	case Image::A8:
		return a8_set;
	case Image::FloatRGB:
		return frgb_set;
	case Image::FloatRGBA:
		return frgba_set;
	case Image::FloatA:
		return fa_set;
	default:
		FatalError("Unknown Image pixel format");
	}
	return NULL;
}


static unsigned int pfsizes [] = 
{
	0,
	3,
	3,
	4,
	4,
	2,
	2,
	1,
	12,
	16,
	4
};

bool Image::isValidFormat(PixelFormat f)
{
	return (f < ArraySize(pfsizes) && f >= 0);
}

unsigned int Image::pixelFormatSize(PixelFormat f)
{
	if(f >= ArraySize(pfsizes)) return false;
	return pfsizes[f];
}


{'fraction_non_alphanumeric': 0.12238147739801543, 'fraction_numerical': 0.044101433296582136, 'mean_word_length': 4.920065252854813, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7508395', 'n_tokens_mistral': 1669, 'n_tokens_neox': 1593, 'n_words': 340}