Possible memory leak?
Travis E. Oliphant
oliphant.travis at ieee.org
Tue Jan 24 19:53:20 EST 2006
Tuvas wrote:
> I have a function in a program that works something like this.
>
> def load_pic_data(width,heigth,inpdat, filt=TRUE):
> data=''
> total=0
> tnum=0
> size=100
> for y in range(0,heigth):
> row=''
> for x in range(0,width):
> index=2*(x+y*width)
> num=ord(inpdat[index+1])*256+ord(inpdat[index])
> if(vfilter.get() and d_filter and filt):
> num=round((num-(d_filter[index/2])))
> if(num<0):
> num=0
> if(num>255*64):
> num=255*64
> row=row+chr(num/64)
> data=data+row
>
>
> The purpose of this part of a program is to take a 14 bit numerical
> representation and convert it to an 8 bit representation.
This is exactly the kind of thing NumPy (http://numeric.scipy.org) is
ideal for. If that's of interest to you, then I can offer particular
suggestions...
-Travis
More information about the Python-list
mailing list