<commit_before>#include "Convolution.h"

BMP generateConvolutionBitmap(BMP originalImage, vector<vector<double>> &convolution) {
	BMP imageConvolution;
	imageConvolution.SetSize(originalImage.TellWidth(),originalImage.TellHeight());

	int imageWidth = originalImage.TellWidth();
	int imageHeight = originalImage.TellHeight();
	
	int convolutionHeight = convolution.size();
	int convolutionWidth = convolution.begin()->size();

	for(int i_y = 0; i_y < imageConvolution.TellHeight(); i_y++) {
		for(int i_x = 0; i_x < imageConvolution.TellWidth(); i_x++) {
			Color newColor = Color::ColorBlack();
			double newAlpha = 0;

			for(int c_y = 0; c_y < convolutionHeight; c_y++) {
				for(int c_x = 0; c_x < convolutionWidth; c_x++) {
					int x = min(max(0,i_x+c_x-(convolutionWidth-1)/2),imageWidth-1);
					int y = min(max(0,i_y+c_y-(convolutionHeight-1)/2),imageHeight-1);

					RGBApixel tempPixel = originalImage.GetPixel(x,y);
					newColor.r += tempPixel.Red * convolution[c_y][c_x];
					newColor.g += tempPixel.Green * convolution[c_y][c_x];
					newColor.b += tempPixel.Blue * convolution[c_y][c_x];
					newAlpha += tempPixel.Alpha * convolution[c_y][c_x];
				}
			}

			imageConvolution(i_x,i_y)->Red = (ebmpBYTE)newColor.r;
			imageConvolution(i_x,i_y)->Green = (ebmpBYTE)newColor.g;
			imageConvolution(i_x,i_y)->Blue = (ebmpBYTE)newColor.b;
			imageConvolution(i_x,i_y)->Alpha = (ebmpBYTE)newAlpha;
		}
	}
	return imageConvolution;
}<commit_msg>Fixed convolutions so they wouldn't wrap around<commit_after>#include "Convolution.h"

BMP generateConvolutionBitmap(BMP originalImage, vector<vector<double>> &convolution) {
	BMP imageConvolution;
	imageConvolution.SetSize(originalImage.TellWidth(),originalImage.TellHeight());

	int imageWidth = originalImage.TellWidth();
	int imageHeight = originalImage.TellHeight();
	
	int convolutionWidth = convolution.size();
	int convolutionHeight = convolution.begin()->size();

	for(int i_y = 0; i_y < imageConvolution.TellHeight(); i_y++) {
		for(int i_x = 0; i_x < imageConvolution.TellWidth(); i_x++) {
			Color newColor = Color::ColorBlack();
			double newAlpha = 0;

			for(int c_y = 0; c_y < convolutionHeight; c_y++) {
				for(int c_x = 0; c_x < convolutionWidth; c_x++) {
					int x = min(max(0,i_x+c_x-(convolutionWidth-1)/2),imageWidth-1);
					int y = min(max(0,i_y+c_y-(convolutionHeight-1)/2),imageHeight-1);

					RGBApixel tempPixel = originalImage.GetPixel(x,y);
					newColor.r += tempPixel.Red * convolution[c_x][c_y];
					newColor.g += tempPixel.Green * convolution[c_x][c_y];
					newColor.b += tempPixel.Blue * convolution[c_x][c_y];
					newAlpha += tempPixel.Alpha * convolution[c_x][c_y];
				}
			}

			if(newColor.r > 255) newColor.r = 255;
			if(newColor.g > 255) newColor.g = 255;
			if(newColor.b > 255) newColor.b = 255;
			if(newAlpha > 255) newAlpha = 255;

			imageConvolution(i_x,i_y)->Red = (ebmpBYTE)newColor.r;
			imageConvolution(i_x,i_y)->Green = (ebmpBYTE)newColor.g;
			imageConvolution(i_x,i_y)->Blue = (ebmpBYTE)newColor.b;
			imageConvolution(i_x,i_y)->Alpha = (ebmpBYTE)newAlpha;
		}
	}
	return imageConvolution;
}
{'fraction_non_alphanumeric': 0.15139826422372227, 'fraction_numerical': 0.016072002571520413, 'mean_word_length': 4.8059701492537314, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, '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': '1734935', 'n_tokens_mistral': 1311, 'n_tokens_neox': 1127, 'n_words': 188}