Exemplo n.º 1
0
void rutina_ejecucion(){
	char* linea=malloc(sizeof(char)*1024);
	
	char* nom_usuario;
	char* nom_host=malloc(sizeof(char)*257);
	nom_usuario = getenv("USER");
	FILE* archivo=fopen("/proc/sys/kernel/hostname","r");
	nom_host = fgets(nom_host,257,archivo);
	char* aux;
	aux=nom_host;
	while(*aux!='\n')
	aux++;
	*aux='\0';
	while(1) 
	{
        /*
         * Pide y lee un comando.
         */
        
		printf("%c[%d;%dm%s@%s:%s > %c[%dm", 0x1B, BRIGHT,GREEN,nom_usuario,nom_host,getcwd(NULL,0),0x1B,0);
		printf("%c[%dm", 0x1B,0);
		linea=leer_linea_terminal();
		
        char** args=obtener_arreglo_de_argumentos(linea);
        if (*linea == '\n');
		else{
			if(strcmp("cd",*args)==0)
			cambiar_directorio(args);
			else{
				char** copia_args=args;
				if((strcmp("exit",*copia_args++)==0)&&(*copia_args==NULL))
				exit(0);
				else{
					copia_args--;
					if((strcmp("-h",*copia_args)==0)||(strcmp("--help",*copia_args)==0)||(strcmp("help",*copia_args)==0)||(strcmp("-a",*copia_args)==0)||(strcmp("--ayuda",*copia_args)==0)||(strcmp("ayuda",*copia_args)==0))
						imprimir_ayuda();
					else{
						if(contar_caracter_enArreglo_deCadenas('|',copia_args)==1)
							ejecutar_tuberias(obtener_comandos_ejecucionxtuberias(linea));
						else
							ejecutar_estandar(args);
					}
				}
			}
		}
	}
}
Exemplo n.º 2
0
Arquivo: cli.c Projeto: lbarrios/orga2
void procesar_opciones(int argc, char **argv, configuracion_t *config)
{
	// Si se ejecuta sin parametros ni opciones
	if (argc == 1) {
		imprimir_ayuda (argv[0]);
		exit ( EXIT_SUCCESS );
	}

	char *tipo_filtro;
	int cant_iteraciones = 1;
	int tiempo = 0;
	int siguiente_opcion;

	// opciones por defecto
	config->es_video = false;
	config->verbose = false;
	config->frames = false;
	config->nombre = false;
	config->archivo_entrada = NULL;
	config->carpeta_salida = ".";
	config->extra_archivo_salida = "";
        // esto lo agregue yo
        config->tiempo = false;
        config->cant_iteraciones = 1;

	// extraemos opciones de la linea de comandos
	const char* const op_cortas = "hi:vt:fo:wn";

	const struct option op_largas[] = {
		{ "help", 0, NULL, 'h' },
		{ "implementacion", 1, NULL, 'i' },
		{ "verbose", 0, NULL, 'v' },
		{ "video", 0, NULL, 'w' },
		{ "tiempo", 1, NULL, 't' },
		{ "frames", 0, NULL, 'f' },
		{ "nombre", 0, NULL, 'n' },
		{ "output", 1, NULL, 'o' },
		{ NULL, 0, NULL, 0 }
	};


        // no se para que el while
	while (1) {
		siguiente_opcion = getopt_long ( argc, argv, op_cortas, op_largas, NULL);

		// No hay mas opciones
		if ( siguiente_opcion == -1 )
			break;

		// Procesar opcion
		switch ( siguiente_opcion ) {
			case 'h' : /* -h o --help */
				imprimir_ayuda (argv[0]);
				exit ( EXIT_SUCCESS );
				break;
			case 'i' : /* -i o --implementacion */
				tipo_filtro = optarg;
				break;
			case 't' : /* -t o --tiempo */
				tiempo = 1;
				cant_iteraciones = atoi ( optarg );
				break;
			case 'v' : /* -v o --verbose */
				config->verbose = true;
				break;
			case 'f' : /* -f o --frames */
			    config->frames = true;
			    break;
			case 'n' : /* -n o --nombre */
			    config->nombre = true;
			    break;
			case 'o' : /* -o o --output */
			    config->carpeta_salida = optarg;
			    break;
			case 'w' : /* -w o --video */
			    config->es_video = true;
			    break;
			case '?' : /* opcion no valida */
				imprimir_ayuda (argv[0]);
				exit ( EXIT_SUCCESS );
			default : /* opcion no valida */
				abort ( );
		}
	}

	// Verifico nombre del proceso
	config->nombre_filtro = argv[optind++];

	if (config->nombre_filtro == NULL) {
		imprimir_ayuda (argv[0]);

		exit ( EXIT_SUCCESS );
	}

	// Verifico nombre de la implementacion
	if (tipo_filtro == NULL ||
		(strcmp(tipo_filtro, "c") != 0 &&
		strcmp(tipo_filtro, "asm") != 0)) {
		imprimir_ayuda (argv[0]);

		exit ( EXIT_SUCCESS );
	}

	if (strcmp(tipo_filtro, "c") == 0) {
		config->tipo_filtro = FILTRO_C;
	} else {
		config->tipo_filtro = FILTRO_ASM;
	}


	// Verifico nombre de archivo
	config->archivo_entrada = argv[optind++];

	if (config->archivo_entrada == NULL) {
		imprimir_ayuda (argv[0]);
		exit ( EXIT_SUCCESS );
	}

	if (access( config->archivo_entrada, F_OK ) == -1) {
		printf("Error al intentar abrir el archivo: %s.\n", config->archivo_entrada);

		exit ( EXIT_SUCCESS );
	}

	// Verifico carpeta de frames
	if ( config->frames ) {
        struct stat s;
        int err = stat(config->carpeta_salida, &s);

        if (err == -1 || !S_ISDIR(s.st_mode)) {
            fprintf(stderr, "Carpeta de Frames invalida: %s.\n", config->carpeta_salida);
            exit (EXIT_FAILURE) ;
        }
	}
        // esto lo agregue yo
        if (tiempo) {
            config->tiempo = true;
            config->cant_iteraciones = cant_iteraciones;
        }
}
Exemplo n.º 3
0
int main( int argc, char** argv ) {
	int siguiente_opcion;

	// Opciones
	const char* const op_cortas = "hi:vt:f:";

	const struct option op_largas[] = {
		{ "help", 0, NULL, 'h' },
		{ "implementacion", 1, NULL, 'i' },
		{ "verbose", 0, NULL, 'v' },
		{ "tiempo", 1, NULL, 't' },
		{ "frames", 1, NULL, 'f' },
		{ NULL, 0, NULL, 0 }
	};

	// Parametros
	const char *nombre_implementacion = NULL;
	int cant_iteraciones = 1;

	// Flags de opciones
	bool verbose = false;
	int tiempo = 0;
	bool frames = false;
	const char *carpeta_frames = NULL;

	// Guardar nombre del programa para usarlo en la ayuda
	nombre_programa = argv[0];

	// Si se ejecuta sin parametros ni opciones
	if (argc == 1) {
		imprimir_ayuda ( );

		exit ( EXIT_SUCCESS );
	}

	// Procesar opciones
	while (1) {
		siguiente_opcion = getopt_long ( argc, argv, op_cortas, op_largas, NULL);

		// No hay mas opciones
		if ( siguiente_opcion == -1 )
			break;

		// Procesar opcion
		switch ( siguiente_opcion ) {
			case 'h' : /* -h o --help */
				imprimir_ayuda ( );
				exit ( EXIT_SUCCESS );
				break;
			case 'i' : /* -i o --implementacion */
				nombre_implementacion = optarg;
				break;
			case 't' : /* -t o --tiempo */
				tiempo = 1;
				cant_iteraciones = atoi ( optarg );
				break;
			case 'v' : /* -v o --verbose */
				verbose = true;
				break;
			case 'f' : /* -f o --frames */
			    frames = 1;
			    carpeta_frames = optarg;
			    break;
			case '?' : /* opcion no valida */
				imprimir_ayuda ( );
				exit ( EXIT_SUCCESS );
			default : /* opcion no valida */
				abort ( );
		}
	}

	// Verifico nombre del proceso
	char *nomb_proceso = argv[optind++];

	if (nomb_proceso == NULL ||
		(strcmp(nomb_proceso, "miniature") != 0			&&
		strcmp(nomb_proceso, "decode") != 0			&&
		strcmp(nomb_proceso, "fcolor") != 0			&&
		strcmp(nomb_proceso, "original") != 0)) {
		imprimir_ayuda ( );

		exit ( EXIT_SUCCESS );
	}

	// Verifico nombre de la implementacion
	if (nombre_implementacion == NULL ||
		(strcmp(nombre_implementacion, "c") != 0 &&
		strcmp(nombre_implementacion, "asm") != 0)) {
		imprimir_ayuda ( );

		exit ( EXIT_SUCCESS );
	}

	// Verifico nombre de archivo
	const char *nomb_arch_entrada = argv[optind++];

	if (nomb_arch_entrada == NULL) {
		imprimir_ayuda ( );

		exit ( EXIT_SUCCESS );
	}
	

	if (access( nomb_arch_entrada, F_OK ) == -1) {
		printf("Error al intentar abrir el archivo: %s.\n", nomb_arch_entrada);

		exit ( EXIT_SUCCESS );
	}

	// Verifico carpeta de frames
	if ( frames ) {
        struct stat s;
        int err = stat(carpeta_frames, &s);

        if (err == -1 || !S_ISDIR(s.st_mode)) {
            fprintf(stderr, "Carpeta de Frames invalida: %s.\n", carpeta_frames);
            exit (EXIT_FAILURE) ;
        }
	}

	// Imprimo info
	printf ( "Procesando...\n");
	printf ( "  Filtro             : %s\n", nomb_proceso);
	printf ( "  Implementación     : %s\n", nombre_implementacion);
	printf ( "  Archivo de entrada : %s\n", nomb_arch_entrada);

	// Procesar imagen
//	FILE* f = fopen("Tiempos totales.txt","a");
	int t = 0;
	global = cant_iteraciones;
	while(t<cant_iteraciones){
		if (strcmp(nomb_proceso, "fcolor") == 0) {
			int threshold, gc, rc, bc;
			threshold = atoi(argv[argc - 1]);
			bc = atoi(argv[argc - 2]);
			gc = atoi(argv[argc - 3]);
			rc = atoi(argv[argc - 4]);
			aplicar_filtro_color(nombre_implementacion, nomb_arch_entrada,
								verbose, frames, carpeta_frames,
								rc, gc, bc, threshold);
		} else if (strcmp(nomb_proceso, "decode") == 0) {

			aplicar_decode(nombre_implementacion, nomb_arch_entrada,
							verbose);


		} else if (strcmp(nomb_proceso, "miniature") == 0) {
			int iters;
			float bottomPlane, topPlane;
			iters = atoi(argv[argc - 1]);
			bottomPlane = strtof(argv[argc - 2], NULL);
			topPlane = strtof(argv[argc - 3], NULL);

			int start = 0;
			
			int stop = 0;
			
			long long int tiempo = 0;

			MEDIR_TIEMPO_START(start);
			aplicar_miniature(nombre_implementacion, nomb_arch_entrada,
						verbose, frames, carpeta_frames,
						topPlane, bottomPlane, iters);
			MEDIR_TIEMPO_STOP(stop);
			
			tiempo = start - stop;
			
			//fprintf(f,"%d %lld \n", t, tiempo);
		} else if (strcmp(nomb_proceso, "original") == 0) {
			aplicar_original(nomb_arch_entrada, verbose, frames,
							 carpeta_frames);
		}
		t++;
	}
    FILE* h = fopen(PROMEDIO, "a");
	fprintf(h,"%ld \n", promedio);
	
	fclose(h);
	return 0;
}
Exemplo n.º 4
0
int main(int argc, char** argv){


float* h=NULL;
float* x=NULL;
int hsize;
int xsize;

t_entrada entradah;
t_entrada entradax;

init(&entradah);
init(&entradax);

int ileido,fleido;
int error=0;
int i;

ileido=0;
fleido=0;

int pulso=0;
int archivo=0;
int errors=0;

int opcion;
const char* const short_options = "hVr:p:";

	const struct option long_options[] =
	{
		{ "help", 0, NULL, 'h' },
		{ "version", 0, NULL, 'V' },
		{ "response", 1, NULL, 'r' },
		{ "pulse", 1, NULL, 'p' },
		{ NULL, 0, NULL, 0 }
	};

	int lista_archivos=0;
	int res;
	int opt=0;


	if(argc==1)
		fprintf(stderr,"Error: Falta especificar una opción.");
	else
	{
		do {
			opcion = getopt_long (argc, argv, short_options, long_options, NULL);
			switch (opcion)
			{
			    case 'h':   /* -h o --help */
			    	imprimir_ayuda (stdout, 0);
			    	opt=1;
			    	break;
			    case 'r':   /* -r o --response */
				if((!pulso)&&(!archivo)){
			    	lista_archivos=1;
			    	res=leer_archivo(optarg,&entradah);
			    	if(res==3) fprintf(stderr,"ERROR: No se pudo abrir el archivo %s.\n",optarg);
			    	if(res==1) fprintf(stderr,"ERROR: No hay memoria suficiente para continuar.\n");
			    	opt=1;
				archivo=1;
				} else{


					errors=1;


				};
			    	break;
			    case 'p':   /* -p o --pulse */

				if((!pulso)&&(!archivo)){
				res=generar_pulso(optarg,&h,&hsize);
			    	if(res==1) fprintf(stderr,"ERROR: No hay memoria suficiente para continuar.\n");
			    	if(res==2) fprintf(stderr,"ERROR: la sintaxis del pulso ingresado es incorrecta.\n");



			    	opt=1;
				ileido=1;
				fleido=1;

				pulso=1;

				} else{



					errors=1;
	

				}
			    	break;
			    case 'V':   /* -V o --version */
			    	imprimir_version (stdout, 0);
			    	opt=1;
			    	break;
			    case '?':  /*error*/
			    	fprintf(stderr,"ERROR: La opción no existe.\n");
			    	imprimir_ayuda (stderr, 1);
			    	opt=1;
			    case -1:
					break;
			    case ':':
			    	fprintf(stderr,"ERROR: Faltan argumentos.\n");
			    	imprimir_ayuda (stderr, 1);
			    	break;
			    default:
			    	break;
			}
		} while((opcion != -1));

		if((!opt)&&(argc>1))
			fprintf(stderr,"ERROR: Falta especificar una opción.");

		if(lista_archivos)
		{
		    for (i = optind; i < argc; ++i)

		    {


			    	res=leer_archivo(argv[i],&entradah); 
			    	if(res==3) fprintf(stderr,"ERROR: No se pudo abrir el archivo %s.\n",optarg);
			    	if(res==1) fprintf(stderr,"ERROR: No hay memoria suficiente para continuar.\n");
			



			}

		}


	}

if(errors){
	fprintf(stderr,"ERROR: las opciones ingresadas son incorrectas.\n");

	destroy(&entradah);
	destroy(&entradax);
	return 1;

	};

entradah.data[entradah.index]='\0';


res=check_sintax(&entradah);

if(res==0) error=armar_vector(entradah.data,&h,&hsize);
else if(!pulso)fprintf(stderr,"ERROR: la sintaxis de h es incorrecta.\n");

if(!pulso){
if(error==1) fprintf(stderr,"ERROR: no hay memoria suficiente para continuar.\n ");
if(error==2) fprintf(stderr,"ERROR: hay caracteres inválidos en el vector h.\n ");

}

destroy(&entradah);



if(h==NULL){

	/* no hay h , no se puede hacer nada*/
	return 1;


}

if(!pulso)
if((error)||(res!=0)) return 1;

/* leo x desde stdin */;

ileido=0;
fleido=0;
error=leerEntrada(stdin,&entradax);
entradax.data[entradax.index]='\0';



res=check_sintax(&entradax);
if(res==0) error=armar_vector(entradax.data,&x,&xsize);
else fprintf(stderr,"ERROR: la sintaxis de x es incorrecta.\n");

destroy(&entradax);
if(error==1) fprintf(stderr,"ERROR: no hay memoria suficiente para continuar.\n ");
if(error==2) fprintf(stderr,"ERROR: hay caracteres inválidos en el vector x.\n ");




if(x==NULL){
	/*no tengo x, no puedo ahcer nada*/
	if(h!=NULL){
		/*libero h*/

		free(h);
		return 1;

	}


}

if((error)||(res!=0)) return 1;



/* tengo h y x*/

if((!errors)&&(!error)){
/*no hay error de sintaxis: -r y -p*/

i=0;

/* si x tiene menos elementos que h, repito x*/
if(xsize<hsize){

	while(xsize<hsize){

		push_back(&x,&xsize,x[i]);
		i++;
	
	};
	



}


/* reservo espacio para y, xsize + hsize -1 */

y=(float*)malloc((xsize+hsize-1)*sizeof(float));


if(y!=NULL){

/* LLAMAR A CONVOLUCIÓN*/

conv(x,xsize,h,hsize);

};

/*imprimo y*/

printf("%s","[ ");

for(i=0;i<xsize+hsize-1;i++){


	printf("%.2f ",y[i]);


}

printf("%s","]\n");



/* LIBERO Y*/

if(y!=NULL)
free(y);


}


/*
printf("\n\n X es:");
i=0;
while(i<xsize){


printf(" %f \n",x[i]);

i++;
}

i=0;

printf("\n\n h es:");
while(i<hsize){


printf(" %f \n",h[i]);

i++;
}
*/



/*LIBERO H y X*/
if(h!=NULL)
free(h);

if(x!=NULL)
free(x);











return 0;

}
Exemplo n.º 5
0
void aplicar_waves (int tiempo, int cant_iteraciones, const char *nomb_impl, const char *nomb_arch_entrada, float x_scale, float y_scale, float g_scale) {
	IplImage *src = 0;
	IplImage *dst = 0;
	CvSize dst_size;

	// Cargo la imagen
	if( (src = cvLoadImage (nomb_arch_entrada, CV_LOAD_IMAGE_GRAYSCALE)) == 0 )
		exit(EXIT_FAILURE);

	dst_size.width = src->width;
	dst_size.height = src->height;

	// Creo una IplImage para cada salida esperada
	if( (dst = cvCreateImage (dst_size, IPL_DEPTH_8U, 1) ) == 0 )
		exit(EXIT_FAILURE);

	// Chequeo de parametros
	if (!(x_scale <=  32.0 && x_scale >= 0.0 &&
		  y_scale <=  32.0 && y_scale >= 0.0 &&
		  g_scale <= 255.0 && g_scale >= 0.0)) {
		imprimir_ayuda();

		cvReleaseImage(&src);
		cvReleaseImage(&dst);

		exit ( EXIT_SUCCESS );
	}

	typedef void (waves_fn_t) (unsigned char*, unsigned char*, int, int, int, float, float, float);

	waves_fn_t *proceso;

	if (strcmp(nomb_impl, "c") == 0) {
		proceso = waves_c;
	} else {
		proceso = waves_asm;
	}

	if (tiempo) {
		unsigned long long int start, end;

		MEDIR_TIEMPO_START(start);

		for(int i=0; i<cant_iteraciones; i++) {
			proceso((unsigned char*)src->imageData, (unsigned char*)dst->imageData, src->height, src->width, src->widthStep, x_scale, y_scale, g_scale);
		}

		MEDIR_TIEMPO_STOP(end);

		imprimir_tiempos_ejecucion(start, end, cant_iteraciones);
	} else {
		proceso((unsigned char*)src->imageData, (unsigned char*)dst->imageData, src->height, src->width, src->widthStep, x_scale, y_scale, g_scale);
	}

	// Guardo imagen y libero las imagenes
	char nomb_arch_salida[256];

	memset(nomb_arch_salida, 0, 256);

	sprintf(nomb_arch_salida, "%s.waves.x_scale-%3.2f.y_scale-%3.2f.g_scale-%3.2f.%s.bmp", nomb_arch_entrada, x_scale, y_scale, g_scale, nomb_impl);

	cvSaveImage(nomb_arch_salida, dst, NULL);

	cvReleaseImage(&src);
	cvReleaseImage(&dst);
}
Exemplo n.º 6
0
void aplicar_umbralizar (int tiempo, int cant_iteraciones, const char *nomb_impl, const char *nomb_arch_entrada, unsigned char min, unsigned char max, unsigned char q) {
	IplImage *src = 0;
	IplImage *dst = 0;
	CvSize dst_size;

	// Cargo la imagen
	if( (src = cvLoadImage (nomb_arch_entrada, CV_LOAD_IMAGE_GRAYSCALE)) == 0 )
		exit(EXIT_FAILURE);

	dst_size.width = src->width;
	dst_size.height = src->height;

	// Creo una IplImage para cada salida esperada
	if( (dst = cvCreateImage (dst_size, IPL_DEPTH_8U, 1) ) == 0 )
		exit(EXIT_FAILURE);

	// Chequeo de parametros
	if (!(min <= max && min >= 0 && max <= 255 && q >= 0 && q <= 255)) {
		imprimir_ayuda();

		cvReleaseImage(&src);
		cvReleaseImage(&dst);

		exit ( EXIT_SUCCESS );
	}

	typedef void (umbralizar_fn_t) (unsigned char*, unsigned char*, int, int, int, unsigned char, unsigned char, unsigned char);

	umbralizar_fn_t *proceso;

	if (strcmp(nomb_impl, "c") == 0) {
		proceso = umbralizar_c;
	} else {
		proceso = umbralizar_asm;
	}

	if (tiempo) {
		unsigned long long int start, end;

		MEDIR_TIEMPO_START(start);

		for(int i=0; i<cant_iteraciones; i++) {
			proceso((unsigned char*)src->imageData, (unsigned char*)dst->imageData, src->height, src->width, src->widthStep, min, max, q);
		}

		MEDIR_TIEMPO_STOP(end);

		imprimir_tiempos_ejecucion(start, end, cant_iteraciones);
	} else {
		proceso((unsigned char*)src->imageData, (unsigned char*)dst->imageData, src->height, src->width, src->widthStep, min, max, q);
	}

	// Guardo imagen y libero las imagenes
	char nomb_arch_salida[256];

	memset(nomb_arch_salida, 0, 256);

	sprintf(nomb_arch_salida, "%s.umbralizar.min-%d.max-%d.q-%d.%s.bmp", nomb_arch_entrada, min, max, q, nomb_impl);

	cvSaveImage(nomb_arch_salida, dst, NULL);

	cvReleaseImage(&src);
	cvReleaseImage(&dst);
}
Exemplo n.º 7
0
int main( int argc, char** argv ) {
	int siguiente_opcion;

	// Opciones
	const char* const op_cortas = "hi:vt:";

	const struct option op_largas[] = {
		{ "help", 0, NULL, 'h' },
		{ "implementacion", 1, NULL, 'i' },
		{ "verbose", 0, NULL, 'v' },
		{ "tiempo", 1, NULL, 't' },
		{ NULL, 0, NULL, 0 }
	};

	// Parametros
	const char* nombre_implementacion = NULL;
	int cant_iteraciones = 0;

	// Flags de opciones
	int verbose = 0;
	int tiempo = 0;

	// Guardar nombre del programa para usarlo en la ayuda
	nombre_programa = argv[0];

	// Si se ejecuta sin parametros ni opciones
	if (argc == 1) {
		imprimir_ayuda ( );

		exit ( EXIT_SUCCESS );
	}

	// Procesar opciones
	while (1) {
		siguiente_opcion = getopt_long ( argc, argv, op_cortas, op_largas, NULL);

		// No hay mas opciones
		if ( siguiente_opcion == -1 )
			break;

		// Procesar opcion
		switch ( siguiente_opcion ) {
			case 'h' : /* -h o --help */
				imprimir_ayuda ( );
				exit ( EXIT_SUCCESS );
				break;
			case 'i' : /* -i o --implementacion */
				nombre_implementacion = optarg;
				break;
			case 't' : /* -t o --tiempo */
				tiempo = 1;
				cant_iteraciones = atoi ( optarg );
				break;
			case 'v' : /* -v o --verbose */
				verbose = 1;
				break;
			case '?' : /* opcion no valida */
				imprimir_ayuda ( );
				exit ( EXIT_SUCCESS );
			default : /* opcion no valida */
				abort ( );
		}
	}

	// Verifico nombre del proceso
	char *nomb_proceso = argv[optind++];

	if (nomb_proceso == NULL ||
		(strcmp(nomb_proceso, "recortar") != 0			&&
		strcmp(nomb_proceso, "colorizar") != 0			&&
		strcmp(nomb_proceso, "halftone") != 0			&&
		strcmp(nomb_proceso, "rotar") != 0				&&
		strcmp(nomb_proceso, "umbralizar") != 0			&&
		strcmp(nomb_proceso, "waves") != 0)) {
		imprimir_ayuda ( );

		exit ( EXIT_SUCCESS );
	}

	// Verifico nombre de la implementacion
	if (nombre_implementacion == NULL ||
		(strcmp(nombre_implementacion, "c") != 0 &&
		strcmp(nombre_implementacion, "asm") != 0)) {
		imprimir_ayuda ( );

		exit ( EXIT_SUCCESS );
	}

	// Verifico nombre de archivo
	const char *nomb_arch_entrada = argv[optind++];

	if (nomb_arch_entrada == NULL) {
		imprimir_ayuda ( );

		exit ( EXIT_SUCCESS );
	}

	if (access( nomb_arch_entrada, F_OK ) == -1) {
		printf("Error al intentar abrir el archivo: %s.\n", nomb_arch_entrada);

		exit ( EXIT_SUCCESS );
	}

	// Imprimo info
	if ( verbose ) {
		printf ( "Procesando imagen...\n");
		printf ( "  Filtro             : %s\n", nomb_proceso);
		printf ( "  Implementación     : %s\n", nombre_implementacion);
		printf ( "  Archivo de entrada : %s\n", nomb_arch_entrada);
	}

	// Procesar imagen
	if (strcmp(nomb_proceso, "recortar") == 0)
	{
		int tam = atoi(argv[optind++]);

		aplicar_recortar(tiempo, cant_iteraciones, nombre_implementacion,
			nomb_arch_entrada, tam);
	}
	else if (strcmp(nomb_proceso, "colorizar") == 0)
	{
		float alpha = (float) atof(argv[optind++]);

		aplicar_colorizar(tiempo, cant_iteraciones, nombre_implementacion, nomb_arch_entrada, alpha);
	}
	else if (strcmp(nomb_proceso, "halftone") == 0)
	{
		aplicar_halftone(tiempo, cant_iteraciones, nombre_implementacion, nomb_arch_entrada);
	}
	else if (strcmp(nomb_proceso, "rotar") == 0)
	{
		aplicar_rotar(tiempo, cant_iteraciones, nombre_implementacion, nomb_arch_entrada);
	}
	else if (strcmp(nomb_proceso, "umbralizar") == 0)
	{
		int min = atoi(argv[optind++]);
		int max = atoi(argv[optind++]);
		int q = atoi(argv[optind++]);

		aplicar_umbralizar(tiempo, cant_iteraciones, nombre_implementacion,
			nomb_arch_entrada, min, max, q);
	}
	else if (strcmp(nomb_proceso, "waves") == 0)
	{
		float x_scale = (float) atof(argv[optind++]);
		float y_scale = (float) atof(argv[optind++]);
		float g_scale = (float) atof(argv[optind++]);

		aplicar_waves(tiempo, cant_iteraciones, nombre_implementacion,
			nomb_arch_entrada, x_scale, y_scale, g_scale);
	}

	return 0;
}