Created
February 19, 2014 14:12
-
-
Save txomon/9092895 to your computer and use it in GitHub Desktop.
Ejercicio 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __constantes_h__ | |
#define __constantes_h__ | |
unsigned int captura[128][4]={ | |
{32547, 43087, 39473, 40464}, | |
{32958, 44850, 57522, 38053}, | |
{12381, 38274, 43769, 17835}, | |
{7621, 25373, 6670, 6855}, | |
{53383, 31948, 25651, 43828}, | |
{56839, 64784, 58918, 46176}, | |
{44403, 54979, 1209, 61635}, | |
{18610, 6857, 64307, 46055}, | |
{39373, 21777, 12947, 35552}, | |
{58999, 8769, 35262, 34627}, | |
{795, 35106, 54583, 16310}, | |
{14983, 45278, 35666, 22842}, | |
{20151, 49343, 61139, 11971}, | |
{63824, 32075, 35148, 62927}, | |
{20607, 61674, 60015, 8368}, | |
{59971, 39201, 42316, 41465}, | |
{51862, 26274, 53144, 35629}, | |
{31253, 9877, 21103, 57673}, | |
{25306, 49710, 29492, 14983}, | |
{15973, 8104, 25250, 10726}, | |
{45060, 2853, 22704, 56626}, | |
{29815, 47955, 63828, 50761}, | |
{28895, 38496, 29276, 32373}, | |
{63241, 18384, 46699, 45357}, | |
{37001, 9611, 64713, 25332}, | |
{32768, 40970, 56354, 9619}, | |
{47670, 11950, 28030, 14797}, | |
{9335, 47817, 59413, 58956}, | |
{5482, 61163, 46140, 47060}, | |
{52943, 27190, 62631, 3622}, | |
{55622, 26009, 6136, 52226}, | |
{56046, 20133, 34062, 61606}, | |
{50018, 62517, 65278, 3708}, | |
{31962, 6810, 39214, 29283}, | |
{1280, 35027, 18184, 61571}, | |
{325, 38300, 37879, 58288}, | |
{21723, 46297, 37082, 30076}, | |
{64666, 65370, 19307, 43596}, | |
{6626, 42587, 17888, 9146}, | |
{63548, 756, 6392, 57818}, | |
{51963, 11333, 53797, 235}, | |
{28568, 44062, 20056, 3328}, | |
{49428, 4730, 35651, 10564}, | |
{22470, 48487, 45263, 3754}, | |
{41649, 23093, 2206, 51653}, | |
{22720, 32296, 45228, 39353}, | |
{30758, 3402, 52353, 33630}, | |
{60183, 18979, 61414, 32179}, | |
{23547, 37551, 17716, 6537}, | |
{38035, 46758, 48013, 44487}, | |
{65506, 20760, 1648, 19428}, | |
{19114, 33890, 36943, 22553}, | |
{31148, 18226, 43150, 24689}, | |
{12884, 783, 57521, 38337}, | |
{59050, 31677, 33620, 1844}, | |
{51517, 29806, 36620, 43861}, | |
{27492, 7155, 44732, 3187}, | |
{27447, 34028, 38138, 61694}, | |
{44464, 58544, 7202, 29813}, | |
{64701, 14850, 33314, 49437}, | |
{52358, 16307, 21033, 47161}, | |
{32263, 5116, 26622, 3046}, | |
{37305, 17104, 65508, 10825}, | |
{46006, 26023, 17430, 2278}, | |
{9137, 37761, 38900, 29614}, | |
{61847, 28430, 8817, 1135}, | |
{7019, 58731, 4506, 16061}, | |
{48002, 4653, 22645, 17574}, | |
{23816, 46118, 63292, 46971}, | |
{13695, 34977, 35135, 4272}, | |
{47884, 17781, 17669, 39079}, | |
{1553, 14995, 25838, 19297}, | |
{50115, 51105, 26541, 31708}, | |
{48423, 54072, 22197, 14947}, | |
{55639, 46681, 27725, 31718}, | |
{12585, 25470, 57905, 54521}, | |
{34419, 42798, 7823, 15245}, | |
{25028, 41667, 63891, 52457}, | |
{20716, 36495, 64722, 57388}, | |
{8244, 1981, 60209, 12023}, | |
{24603, 44242, 14176, 65029}, | |
{40256, 21917, 20402, 19217}, | |
{60359, 58954, 43088, 42313}, | |
{17955, 19446, 23528, 43577}, | |
{39681, 104, 34755, 63390}, | |
{15399, 28339, 18207, 13370}, | |
{49744, 53258, 22552, 40368}, | |
{21210, 39177, 34318, 24278}, | |
{31856, 30899, 17099, 34853}, | |
{64407, 24810, 60376, 32380}, | |
{60035, 82, 1132, 32329}, | |
{50325, 3912, 49051, 38354}, | |
{1417, 10140, 1601, 17250}, | |
{12891, 34748, 19986, 44156}, | |
{21868, 7211, 7077, 8968}, | |
{47407, 3756, 6127, 43379}, | |
{7383, 64196, 17225, 56301}, | |
{38213, 10849, 12990, 44413}, | |
{31859, 26285, 59452, 16028}, | |
{27755, 54008, 35008, 57431}, | |
{34032, 379, 10195, 30740}, | |
{24865, 58523, 49356, 2737}, | |
{648, 2471, 26850, 55000}, | |
{22627, 30542, 11687, 5500}, | |
{61659, 29174, 39174, 62245}, | |
{62239, 5749, 23982, 39415}, | |
{41807, 64873, 16327, 56977}, | |
{17098, 52566, 58355, 41499}, | |
{50937, 26005, 30175, 21693}, | |
{21874, 32463, 2797, 4782}, | |
{23891, 65342, 58435, 55643}, | |
{24224, 1881, 47729, 5140}, | |
{1424, 43317, 29375, 65489}, | |
{22846, 54278, 53625, 19742}, | |
{11290, 45024, 17293, 56525}, | |
{47205, 7476, 17728, 35013}, | |
{44642, 31424, 51207, 12345}, | |
{42799, 25319, 35605, 53169}, | |
{18834, 42179, 18965, 31459}, | |
{4049, 25780, 52071, 52027}, | |
{11323, 12546, 41361, 11426}, | |
{65290, 10246, 11211, 27744}, | |
{36108, 24867, 18416, 8668}, | |
{31399, 24880, 20884, 37184}, | |
{54750, 24966, 14415, 57624}, | |
{6009, 8740, 48514, 21412}, | |
{7908, 52114, 12835, 7474}, | |
{3823, 52348, 41789, 45904}, | |
}; | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "constantes.h" | |
int temp[4] = {0, 0, 0, 0}; | |
static inline void calcula_max(int *save, int value) | |
{ | |
if(value > *save) | |
*save = value; | |
} | |
static inline void calcula_min(int *save, int value) | |
{ | |
if(value < *save) | |
*save = value; | |
} | |
static inline void calcula_med(int *save, int value) | |
{ | |
*save += value; | |
} | |
static inline void calcula_qua(int *save, int value) | |
{ | |
*save += value; | |
} | |
int main(int argc, char **argv) | |
{ | |
int row, column; | |
int res[4][4] = {{0, 0, 0, 0}, {65535, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, | |
0}}; | |
for(row = 0; row < 128; row++) { | |
for(column = 0; column < 4; column++) { | |
calcula_max(&(res[column][0]), captura[row][column]); | |
calcula_min(&(res[column][1]), captura[row][column]); | |
calcula_med(&(res[column][2]), captura[row][column]); | |
calcula_qua(&(res[column][3]), captura[row][column]); | |
} | |
} | |
for(column = 0; column < 4; column++) { | |
res[column][2] = res[column][2] / 128; | |
res[column][3] = res[column][2] / 128; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment