Remove quirc.row_average and associated code

quirc.row_average was used by the former threshold function and has
become obsolete with the introduction of the Otsu threshold function.
This commit is contained in:
Claudio Felber 2019-04-30 18:43:57 +02:00
parent 97ffaabfb5
commit 96a5a380fb
2 changed files with 0 additions and 11 deletions

View file

@ -41,7 +41,6 @@ void quirc_destroy(struct quirc *q)
same size, so we need to be careful here to avoid a double free */ same size, so we need to be careful here to avoid a double free */
if (sizeof(*q->image) != sizeof(*q->pixels)) if (sizeof(*q->image) != sizeof(*q->pixels))
free(q->pixels); free(q->pixels);
free(q->row_average);
free(q); free(q);
} }
@ -49,7 +48,6 @@ int quirc_resize(struct quirc *q, int w, int h)
{ {
uint8_t *image = NULL; uint8_t *image = NULL;
quirc_pixel_t *pixels = NULL; quirc_pixel_t *pixels = NULL;
int *row_average = NULL;
/* /*
* XXX: w and h should be size_t (or at least unsigned) as negatives * XXX: w and h should be size_t (or at least unsigned) as negatives
@ -88,11 +86,6 @@ int quirc_resize(struct quirc *q, int w, int h)
goto fail; goto fail;
} }
/* alloc a new buffer for q->row_average */
row_average = calloc(w, sizeof(int));
if (!row_average)
goto fail;
/* alloc succeeded, update `q` with the new size and buffers */ /* alloc succeeded, update `q` with the new size and buffers */
q->w = w; q->w = w;
q->h = h; q->h = h;
@ -102,15 +95,12 @@ int quirc_resize(struct quirc *q, int w, int h)
free(q->pixels); free(q->pixels);
q->pixels = pixels; q->pixels = pixels;
} }
free(q->row_average);
q->row_average = row_average;
return 0; return 0;
/* NOTREACHED */ /* NOTREACHED */
fail: fail:
free(image); free(image);
free(pixels); free(pixels);
free(row_average);
return -1; return -1;
} }

View file

@ -77,7 +77,6 @@ struct quirc_grid {
struct quirc { struct quirc {
uint8_t *image; uint8_t *image;
quirc_pixel_t *pixels; quirc_pixel_t *pixels;
int *row_average; /* used by threshold() */
int w; int w;
int h; int h;