Programación General > ASM (Ensamblador)

 RLE en ensamblador MIPS

(1/17) > >>

manurodri189:
Pues eso necesito saber si alguno de vosotros sabe de ensamblador y me puede echar una mano.

Tengo que hacer un codificador y un decodificador, según el algoritmo RLE

http://es.wikipedia.org/wiki/RLE

Tiene que ser con MIPS, con el simulador PCSpim.

Tengo la certeza de que es realmente sencillo pero no se por donde puedo cogerlo.

A ver si alguno de vosotros me puede echar una mano.

Salu2

m0skit0:
Yo sé MIPS, te puedo ayudar (que no hacer), pero tienes que especificar más el algoritmo. Por ejemplo, ¿qué pasa si el valor es un número?

A codificar:


--- Código: Text ---22222AA Codificado:


--- Código: Text ---522A ¿5 "2" & 2 "A" / 522 "A"?

manurodri189:
Si es como has puesto.

Si le pasas el valor22222AA tendría que devolver 522A.

No quiero que me lo hagas, pero realmente no tengo ni idea, así que necesitaría ayuda.

Salu2

m0skit0:

--- Cita de: "manurodri189" ---Si le pasas el valor22222AA tendría que devolver 522A.
--- Fin de la cita ---
Muy bien, pero la pregunta es, si tengo que descodificar, ¿cómo sé que 522A es "22222AA" y no "A" 522 veces?

manurodri189:
Acabo de preguntarlo, y me acaba de responder lo siguiente:

Well, i can think of a few solutions:
> a) it can be a matter of what characters are valid: that is,
> we can assume that only letters can be encoded. So '2' as char is not valid.
> However, this is a dummy solution...
>
> b) it depends on the data structures you use. For instance,
> if you use 1 integer (3 bytes) to represent the number and
> 1 byte for the char, then you may have the following organization in memory:
>
> for each 4 consecutive bytes :
>
> [1 byte] [3 bytes] :
> [char] [integer]
>
>
> So , in your example, each byte would be :
>
> 32, 00 00 00 05
> 41, 00 00 00 02
>
>
> where, 32 is the ascii of '2'
> and 41 is the ascii of 'A'
>
>
> c) another solution is to keep all the chars together,
> in consecutive bytes and all the numbers together
> in a second array, where each integer is 4 bytes.
>
> So, for your example, you can define one array symbols:
> '2','A',...
> or with their ascii: 32,41,...
> and another array with their frequency:
> 5, 2, ...
> where each integer occupies 4 bytes.
>
> When your decode, you know that the first number corresponds to
>
>
> the first char, and so on,....
> (a) is too limited...
> I would prefer you do either b) or c), and I think c) is the easiest.

Osea la a, que tiene pinta de ser la más fácil descartada, la b la entiendo pero el dice que es la más difícil, y la c, no la entiendo.

Tu como lo ves? si no sabes ingles, me lo dices y te lo traduzco.

Salu2

Navegación

[0] Índice de Mensajes

[#] Página Siguiente

Ir a la versión completa