Source/astc_image_load_store.cpp
void update_imageblock_flags(
	imageblock* pb,
	int xdim,
	int ydim,
	int zdim
) {
	int i;
	float red_min = 1e38f, red_max = -1e38f;
	float green_min = 1e38f, green_max = -1e38f;
	float blue_min = 1e38f, blue_max = -1e38f;
	float alpha_min = 1e38f, alpha_max = -1e38f;

	int texels_per_block = xdim * ydim * zdim;

	int grayscale = 1;

	for (i = 0; i < texels_per_block; i++)
	{
		float red = pb->data_r[i];
		float green = pb->data_g[i];
		float blue = pb->data_b[i];
		float alpha = pb->data_a[i];
		if (red < red_min)
			red_min = red;
		if (red > red_max)
			red_max = red;
		if (green < green_min)
			green_min = green;
		if (green > green_max)
			green_max = green;
		if (blue < blue_min)
			blue_min = blue;
		if (blue > blue_max)
			blue_max = blue;
		if (alpha < alpha_min)
			alpha_min = alpha;
		if (alpha > alpha_max)
			alpha_max = alpha;

		if (grayscale == 1 && (red != green || red != blue))
			grayscale = 0;
	}

	pb->red_min = red_min;
	pb->red_max = red_max;
	pb->green_min = green_min;
	pb->green_max = green_max;
	pb->blue_min = blue_min;
	pb->blue_max = blue_max;
	pb->alpha_min = alpha_min;
	pb->alpha_max = alpha_max;
	pb->grayscale = grayscale;
}
/*
   For an imageblock, update its flags.
   The updating is done based on data, not orig_data.
*/
For an imageblock, update its flags.
The updating is done based on data, not orig_data.
For an imageblock update its flags . The updating is done based on data not orig_data .
void update_imageblock_flags(
	imageblock* pb,
	int xdim,
	int ydim,
	int zdim
) {
	int i;
	float red_min = 1e38f, red_max = -1e38f;
	float green_min = 1e38f, green_max = -1e38f;
	float blue_min = 1e38f, blue_max = -1e38f;
	float alpha_min = 1e38f, alpha_max = -1e38f;
	int texels_per_block = xdim * ydim * zdim;
	int grayscale = 1;
	for (i = 0; i < texels_per_block; i++)
	{
		float red = pb->data_r[i];
		float green = pb->data_g[i];
		float blue = pb->data_b[i];
		float alpha = pb->data_a[i];
		if (red < red_min)
			red_min = red;
		if (red > red_max)
			red_max = red;
		if (green < green_min)
			green_min = green;
		if (green > green_max)
			green_max = green;
		if (blue < blue_min)
			blue_min = blue;
		if (blue > blue_max)
			blue_max = blue;
		if (alpha < alpha_min)
			alpha_min = alpha;
		if (alpha > alpha_max)
			alpha_max = alpha;
		if (grayscale == 1 && (red != green || red != blue))
			grayscale = 0;
	}
	pb->red_min = red_min;
	pb->red_max = red_max;
	pb->green_min = green_min;
	pb->green_max = green_max;
	pb->blue_min = blue_min;
	pb->blue_max = blue_max;
	pb->alpha_min = alpha_min;
	pb->alpha_max = alpha_max;
	pb->grayscale = grayscale;
}
void update_imageblock_flags ( imageblock * pb , int xdim , int ydim , int zdim ) { int i ; float red_min = 1e38f , red_max = -1e38f ; float green_min = 1e38f , green_max = -1e38f ; float blue_min = 1e38f , blue_max = -1e38f ; float alpha_min = 1e38f , alpha_max = -1e38f ; int texels_per_block = xdim * ydim * zdim ; int grayscale = 1 ; for ( i = 0 ; i < texels_per_block ; i ++ ) { float red = pb -> data_r [ i ] ; float green = pb -> data_g [ i ] ; float blue = pb -> data_b [ i ] ; float alpha = pb -> data_a [ i ] ; if ( red < red_min ) red_min = red ; if ( red > red_max ) red_max = red ; if ( green < green_min ) green_min = green ; if ( green > green_max ) green_max = green ; if ( blue < blue_min ) blue_min = blue ; if ( blue > blue_max ) blue_max = blue ; if ( alpha < alpha_min ) alpha_min = alpha ; if ( alpha > alpha_max ) alpha_max = alpha ; if ( grayscale == 1 && ( red != green || red != blue ) ) grayscale = 0 ; } pb -> red_min = red_min ; pb -> red_max = red_max ; pb -> green_min = green_min ; pb -> green_max = green_max ; pb -> blue_min = blue_min ; pb -> blue_max = blue_max ; pb -> alpha_min = alpha_min ; pb -> alpha_max = alpha_max ; pb -> grayscale = grayscale ; }
For an imageblock, update its flags.
For an imageblock update its flags .