- uns cols = image->cols;
- uns rows = image->rows;
- uns row_size = image->row_size;
-
- uns w = (cols + 3) >> 2;
- uns h = (rows + 3) >> 2;
-
- DBG("Computing signature for image of %ux%u pixels (%ux%u blocks)", cols, rows, w, h);
+ data->image = image;
+ data->flags = 0;
+ data->cols = (image->cols + 3) >> 2;
+ data->rows = (image->rows + 3) >> 2;
+ data->full_cols = image->cols >> 2;
+ data->full_rows = image->rows >> 2;
+ data->blocks_count = data->cols * data->rows;
+ if (data->blocks_count >= 0x10000)
+ {
+ IMAGE_ERROR(ctx, IMAGE_ERROR_INVALID_DIMENSIONS, "Image too large for implemented signature algorithm.");
+ return 0;
+ }
+ data->blocks = xmalloc(data->blocks_count * sizeof(struct image_sig_block));
+ data->area = image->cols * image->rows;
+ DBG("Computing signature for image of %ux%u pixels (%ux%u blocks)",
+ image->cols, image->rows, data->cols, data->rows);
+ return 1;
+}