MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / stbi__vertical_flip

Function stbi__vertical_flip

include/stb/stb_image.h:1222–1244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1220}
1221
1222static void stbi__vertical_flip(void *image, int w, int h, int bytes_per_pixel)
1223{
1224 int row;
1225 size_t bytes_per_row = (size_t)w * bytes_per_pixel;
1226 stbi_uc temp[2048];
1227 stbi_uc *bytes = (stbi_uc *)image;
1228
1229 for (row = 0; row < (h>>1); row++) {
1230 stbi_uc *row0 = bytes + row*bytes_per_row;
1231 stbi_uc *row1 = bytes + (h - row - 1)*bytes_per_row;
1232 // swap row0 with row1
1233 size_t bytes_left = bytes_per_row;
1234 while (bytes_left) {
1235 size_t bytes_copy = (bytes_left < sizeof(temp)) ? bytes_left : sizeof(temp);
1236 memcpy(temp, row0, bytes_copy);
1237 memcpy(row0, row1, bytes_copy);
1238 memcpy(row1, temp, bytes_copy);
1239 row0 += bytes_copy;
1240 row1 += bytes_copy;
1241 bytes_left -= bytes_copy;
1242 }
1243 }
1244}
1245
1246#ifndef STBI_NO_GIF
1247static void stbi__vertical_flip_slices(void *image, int w, int h, int z, int bytes_per_pixel)

Calls

no outgoing calls

Tested by

no test coverage detected