Permalink
Browse files

Renamed hist to histogram

  • Loading branch information...
1 parent 0cc8d9b commit 39c061e8970b691d64d4b4ca15a27dd9e9ed1966 @pornel committed Jan 23, 2012
Showing with 19 additions and 19 deletions.
  1. +1 −1 mediancut.c
  2. +1 −1 mediancut.h
  3. +8 −8 pam.c
  4. +3 −3 pam.h
  5. +4 −4 pngquant.c
  6. +1 −1 viter.c
  7. +1 −1 viter.h
View
@@ -187,7 +187,7 @@ static void adjust_histogram(hist_item *achv, const colormap *map, const struct
** on Paul Heckbert's paper, "Color Image Quantization for Frame Buffer
** Display," SIGGRAPH 1982 Proceedings, page 297.
*/
-colormap *mediancut(hist *hist, float min_opaque_val, int newcolors)
+colormap *mediancut(histogram *hist, float min_opaque_val, int newcolors)
{
hist_item *achv = hist->achv;
struct box bv[newcolors];
View
@@ -1,2 +1,2 @@
-colormap *mediancut(hist *hist, float min_opaque_val, int reqcolors);
+colormap *mediancut(histogram *hist, float min_opaque_val, int reqcolors);
View
@@ -17,7 +17,7 @@
#include "pam.h"
#include "mempool.h"
-static hist *pam_acolorhashtoacolorhist(acolorhash_table acht, int maxacolors, float gamma);
+static histogram *pam_acolorhashtoacolorhist(acolorhash_table acht, int maxacolors, float gamma);
static acolorhash_table pam_computeacolorhash(const rgb_pixel*const* apixels, int cols, int rows, double gamma, int maxacolors, int ignorebits, const float *importance, int* acolorsP);
static void pam_freeacolorhash(acolorhash_table acht);
static acolorhash_table pam_allocacolorhash(void);
@@ -43,18 +43,18 @@ static acolorhash_table pam_allocacolorhash(void);
* Builds color histogram no larger than maxacolors. Ignores (posterizes) ignorebits lower bits in each color.
* perceptual_weight of each entry is increased by value from importance_map
*/
-hist *pam_computeacolorhist(const rgb_pixel*const apixels[], int cols, int rows, double gamma, int maxacolors, int ignorebits, const float *importance_map)
+histogram *pam_computeacolorhist(const rgb_pixel*const apixels[], int cols, int rows, double gamma, int maxacolors, int ignorebits, const float *importance_map)
{
acolorhash_table acht;
- hist *achv;
+ histogram *hist;
int hist_size=0;
acht = pam_computeacolorhash(apixels, cols, rows, gamma, maxacolors, ignorebits, importance_map, &hist_size);
if (!acht) return 0;
- achv = pam_acolorhashtoacolorhist(acht, hist_size, gamma);
+ hist = pam_acolorhashtoacolorhist(acht, hist_size, gamma);
pam_freeacolorhash(acht);
- return achv;
+ return hist;
}
static acolorhash_table pam_computeacolorhash(const rgb_pixel*const* apixels, int cols, int rows, double gamma, int maxacolors, int ignorebits, const float *importance_map, int* acolorsP)
@@ -118,9 +118,9 @@ static acolorhash_table pam_allocacolorhash()
return t;
}
-static hist *pam_acolorhashtoacolorhist(acolorhash_table acht, int hist_size, float gamma)
+static histogram *pam_acolorhashtoacolorhist(acolorhash_table acht, int hist_size, float gamma)
{
- hist *hist = malloc(sizeof(hist[0]));
+ histogram *hist = malloc(sizeof(hist[0]));
hist->achv = malloc(hist_size * sizeof(hist->achv[0]));
hist->size = hist_size;
@@ -147,7 +147,7 @@ static void pam_freeacolorhash(acolorhash_table acht)
mempool_free(acht->mempool);
}
-void pam_freeacolorhist(hist *hist)
+void pam_freeacolorhist(histogram *hist)
{
free(hist->achv);
free(hist);
View
@@ -165,7 +165,7 @@ typedef struct {
hist_item *achv;
double total_perceptual_weight;
int size;
-} hist;
+} histogram;
typedef struct {
f_pixel acolor;
@@ -189,8 +189,8 @@ typedef struct {
struct acolorhist_list_item **buckets;
} *acolorhash_table;
-hist *pam_computeacolorhist(const rgb_pixel*const apixels[], int cols, int rows, double gamma, int maxacolors, int ignorebits, const float *imp);
-void pam_freeacolorhist(hist *h);
+histogram *pam_computeacolorhist(const rgb_pixel*const apixels[], int cols, int rows, double gamma, int maxacolors, int ignorebits, const float *imp);
+void pam_freeacolorhist(histogram *h);
colormap *pam_colormap(int colors);
void pam_freecolormap(colormap *c);
View
@@ -647,9 +647,9 @@ pngquant_error write_image(write_info *output_image,const char *filename,const c
}
/* histogram contains information how many times each color is present in the image, weighted by importance_map */
-hist *histogram(const read_info *input_image, const int reqcolors, const int speed_tradeoff, const float *importance_map)
+histogram *get_histogram(const read_info *input_image, const int reqcolors, const int speed_tradeoff, const float *importance_map)
{
- hist *hist;
+ histogram *hist;
int ignorebits=0;
const rgb_pixel **input_pixels = (const rgb_pixel **)input_image->row_pointers;
const int cols = input_image->width, rows = input_image->height;
@@ -884,7 +884,7 @@ static void adjust_histogram(hist_item *item, float diff)
feedback_loop_trials controls how long the search will take. < 0 skips the iteration.
*/
-static colormap *find_best_palette(hist *hist, const int reqcolors, const float min_opaque_val, int feedback_loop_trials, double *palette_error_p)
+static colormap *find_best_palette(histogram *hist, const int reqcolors, const float min_opaque_val, int feedback_loop_trials, double *palette_error_p)
{
colormap *acolormap = NULL;
double least_error = 0;
@@ -951,7 +951,7 @@ pngquant_error pngquant(read_info *input_image, write_info *output_image, const
// histogram uses noise contrast map for importance. Color accuracy in noisy areas is not very important.
// noise map does not include edges to avoid ruining anti-aliasing
- hist *hist = histogram(input_image, reqcolors, speed_tradeoff, noise); if (noise) free(noise);
+ histogram *hist = get_histogram(input_image, reqcolors, speed_tradeoff, noise); if (noise) free(noise);
double palette_error = -1;
colormap *acolormap = find_best_palette(hist, reqcolors, min_opaque_val, 56-9*speed_tradeoff, &palette_error);
View
@@ -58,7 +58,7 @@ void viter_finalize(colormap *map, const int max_threads, const viter_state aver
}
}
-double viter_do_iteration(hist *hist, colormap *const map, const float min_opaque_val, viter_callback callback)
+double viter_do_iteration(histogram *hist, colormap *const map, const float min_opaque_val, viter_callback callback)
{
const int max_threads = omp_get_max_threads();
viter_state average_color[map->colors * max_threads];
View
@@ -8,4 +8,4 @@ typedef void (*viter_callback)(hist_item *item, float diff);
void viter_init(const colormap *map, const int max_threads, viter_state state[]);
void viter_update_color(const f_pixel acolor, const float value, const colormap *map, const int match, const int thread, viter_state state[]);
void viter_finalize(colormap *map, const int max_threads, const viter_state state[]);
-double viter_do_iteration(hist *hist, colormap *const map, const float min_opaque_val, viter_callback callback);
+double viter_do_iteration(histogram *hist, colormap *const map, const float min_opaque_val, viter_callback callback);

0 comments on commit 39c061e

Please sign in to comment.