Hello,
I've tried using your code with your original picture and it worked, but with other picture such as the one below, I get the following error :
Traceback (most recent call last):
File "...", line 363, in
img.decode()
File "...", line 350, in decode
len_chunk = self.StartOfScan(data, len_chunk)
File "...", line 290, in StartOfScan
st, 0, self.quant[self.quantMapping[0]], oldlumdccoeff
File "...", line 253, in BuildMatrix
code = self.huffman_tables[0 + idx].GetCode(st)
File "...", line 201, in GetCode
res = self.Find(st)
File "...", line 196, in Find
r = r[st.GetBit()]
IndexError: list index out of range
I've looked into it and it seems that when the error occurs, r is a list of size 1, st.GetBit() is 0, but the code still fails. So I've tried to force Find to return r[0] when r is of size 1, but then another error occurs
Traceback (most recent call last):
File "...", line 363, in
img.decode()
File "...", line 350, in decode
len_chunk = self.StartOfScan(data, len_chunk)
File "...", line 290, in StartOfScan
st, 0, self.quant[self.quantMapping[0]], oldlumdccoeff
File "...", line 260, in BuildMatrix
code = self.huffman_tables[16 + idx].GetCode(st)
File "...", line 201, in GetCode
res = self.Find(st)
File "...", line 196, in Find
r = r[st.GetBit()]
File "...", line 218, in GetBit
b = self.data[self.pos >> 3]
IndexError: list index out of range
Any idea why this occurs ? Thanks in advance !
![cat](https://user-images.githubusercontent.com/5106319/98979124-406a8700-251b-11eb-8761-2539487542d8.jpg)