MCPcopy Create free account
hub / github.com/ActiveState/code / UENCD

Method UENCD

recipes/Python/577379_BIRLE_Decoder/recipe-577379.py:99–120  ·  view source on GitHub ↗

00 NN: Unencoded Data

(self,*arg)

Source from the content-addressed store, hash-verified

97 self.rPix %= mov
98
99 def UENCD(self,*arg):
100 """ 00 NN: Unencoded Data """
101 p = arg[1] #unencoded pixels data
102 if self.bpp == 4:
103 #read bytes with padding byte for 4 bit
104 b = int(round(p/2)) + (int(round(p/2))%2 | p%2)
105 else:
106 #read bytes with padding byte for 8 bit
107 b = p + p%2
108 ue = self.enc[self.c:self.c+b]
109 self.c += b
110 delta = self.rPix + p
111 for i in range(b):
112 if self.rPix == delta: break
113 if self.bpp == 4:
114 for j in range(2):
115 if self.rPix == delta: break
116 self.HPIX((ord(ue[i])&(0x0F<<(4*((j+1)%2))))>>(4*((j+1)%2)))
117 self.rPix += 1
118 else:
119 self.HPIX(ord(ue[i]))
120 self.rPix += 1
121
122 def DENCD(self,*arg):
123 """ NN PP: Decode Encoded Data """

Callers

nothing calls this directly

Calls 2

HPIXMethod · 0.95
rangeFunction · 0.85

Tested by

no test coverage detected