X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=flatland.git;a=blobdiff_plain;f=flatland.c;fp=flatland.c;h=032336a0b4e6dd120d9caaa8b9b92e11c3d3c206;hp=71dee6352b600b1de6edc10e4716b1c3b4dbc2b9;hb=e0f96aaef35ffaf34b912c7fa1473cb67b7a3dae;hpb=4aed0ce274b7c0e379651c28e439375c821c047a diff --git a/flatland.c b/flatland.c index 71dee63..032336a 100644 --- a/flatland.c +++ b/flatland.c @@ -29,9 +29,7 @@ THByteTensor *generate_sequence(long nb_sequences, long nb_images_per_sequence, size->data[2] = nb_channels; size->data[3] = image_height; size->data[4] = image_width; - THByteTensor *result = THByteTensor_newWithSize(size, NULL); - THLongStorage_free(size); st0 = THByteTensor_stride(result, 0); @@ -43,17 +41,13 @@ THByteTensor *generate_sequence(long nb_sequences, long nb_images_per_sequence, unsigned char tmp_buffer[nb_images_per_sequence * nb_channels * image_width * image_height]; for(s = 0; s < nb_sequences; s++) { - a = - THByteTensor_storage(result)->data + THByteTensor_storageOffset(result) + s * st0; - + a = THByteTensor_storage(result)->data + THByteTensor_storageOffset(result) + s * st0; fl_generate_sequences(1, nb_images_per_sequence, image_width, image_height, tmp_buffer); - unsigned char *r = tmp_buffer; for(k = 0; k < nb_images_per_sequence; k++) { for(c = 0; c < nb_channels; c++) { for(i = 0; i < image_height; i++) { - b = a - + k * st1 + c * st2 + i * st3; + b = a + k * st1 + c * st2 + i * st3; for(j = 0; j < image_width; j++) { *b = (unsigned char) (*r); r++;