more cleanup and typo fixing
This commit is contained in:
parent
ef50bdb98d
commit
073ff2c25d
|
@ -1,4 +1,3 @@
|
|||
|
||||
#include <fonts.h>
|
||||
#include <render.h>
|
||||
|
||||
|
@ -32,7 +31,7 @@ uint8_t * pk_decode(const uint8_t * data,int * len){
|
|||
};
|
||||
|
||||
// Local function: Unpack "long run".
|
||||
int upl(int off){ // unpack "long" run.
|
||||
int upl(int off){
|
||||
int retval;
|
||||
|
||||
while((retval=gnn())==0){
|
||||
|
@ -45,7 +44,7 @@ uint8_t * pk_decode(const uint8_t * data,int * len){
|
|||
return retval;
|
||||
};
|
||||
|
||||
#define DNY (12) // Decoder parameter: Fixed value for now.
|
||||
#define DYN (12) // Decoder parameter: Fixed value for now.
|
||||
int repeat=0; // Decoder internal: repeat colum?
|
||||
int curbit=0; // Decoder internal: current bit (1 or 0)
|
||||
int pos=0; // Decoder internal: current bit position (0..7)
|
||||
|
@ -56,7 +55,6 @@ uint8_t * pk_decode(const uint8_t * data,int * len){
|
|||
/* Get next encoded nibble and decode */
|
||||
nyb=gnn();
|
||||
|
||||
|
||||
if(nyb==15){
|
||||
repeat++;
|
||||
continue;
|
||||
|
@ -65,19 +63,18 @@ uint8_t * pk_decode(const uint8_t * data,int * len){
|
|||
nyb+=1;
|
||||
repeat+=nyb;
|
||||
continue;
|
||||
}else if(nyb>DNY){
|
||||
nyb=(16*(nyb-DNY-1))+gnn()+DNY+1;
|
||||
}else if(nyb>DYN){
|
||||
nyb=(16*(nyb-DYN-1))+gnn()+DYN+1;
|
||||
}else if(nyb==0){
|
||||
nyb=upl(1);
|
||||
nyb+=(16*(13-DNY)+DNY)-16;
|
||||
nyb+=(16*(13-DYN)+DYN)-16;
|
||||
};
|
||||
|
||||
/* Generate & output bits */
|
||||
|
||||
while(nyb-->0){
|
||||
if(pos==0){
|
||||
if(pos==0) // Clear each byte before we start.
|
||||
*bufptr=0;
|
||||
};
|
||||
if(curbit==1){
|
||||
*bufptr|=1<<(7-pos);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue