- if (!image_init_matrix(ctx, &dup->image, ptr, img->cols, img->rows, img->cols * 3, COLOR_SPACE_RGB))
- return 0;
- uns size = img->rows * img->cols * 3;
- ptr += ALIGN_TO(size, CPU_STRUCT_ALIGN);
- byte *s = img->pixels;
- byte *d = dup->image.pixels;
- for (uns row = img->rows; row--; )
+ if (same_size_compare)
+ {
+ if (!image_init_matrix(ctx->ic, &dup->image, ptr, img->cols, img->rows, img->cols * 3, COLOR_SPACE_RGB))
+ return 0;
+ uns size = img->rows * img->cols * 3;
+ ptr += ALIGN_TO(size, CPU_STRUCT_ALIGN);
+ byte *s = img->pixels;
+ byte *d = dup->image.pixels;
+ for (uns row = img->rows; row--; )
+ {
+ memcpy(d, s, img->row_pixels_size);
+ d += dup->image.row_size;
+ s += img->row_size;
+ }
+ }
+ else