// #ifdef __cplusplus // extern "C" { // #endif //=============================================================================================================================================================================================================== // DEFINE / INCLUDE //=============================================================================================================================================================================================================== #include "avimod.h" //=============================================================================================================================================================================================================== // FUNCTIONS //=============================================================================================================================================================================================================== // Flips the specified image and crops it to the specified dimensions // If scaled == true, all values are scaled to the range [0.0, 1.0 fp* chop_flip_image( char *image, int height, int width, int cropped, int scaled, int converted) { // fixed dimensions for cropping or not cropping, square vertices starting from initial point in top left corner going down and right int top; int bottom; int left; int right; if(cropped==1){ top = 0; bottom = 0; left = 0; right = 0; } else{ top = 0; bottom = height - 1; left = 0; right = width - 1; } // dimensions of new cropped image int height_new = bottom - top + 1; int width_new = right - left + 1; // counters int i, j; // allocate memory for cropped/flipped frame fp* result = (fp *) malloc(height_new * width_new * sizeof(fp)); // crop/flip and scale frame fp temp; if (scaled) { fp scale = 1.0 / 255.0; for(i = 0; i