parameters: (self, iBlock)
return_statement: return coeff
docstring: source is self.Data
          out DCT coefficients
          iBlock  0,1,2,3:Y; 4:Cb; 5:Cr; or 0:Y;1:Cb;2:Cr
docstring_summary: source is self.Data
          out DCT coefficients
          iBlock  0,1,2,3:Y; 4:Cb; 5:Cr; or 0:Y;1:Cb;2:Cr
docstring_tokens: source is self . Data out DCT coefficients iBlock 0 1 2 3 : Y ; 4 : Cb ; 5 : Cr ; or 0 : Y ; 1 : Cb ; 2 : Cr
function: def HuffmanDecode(self, iBlock):
      """source is self.Data
          out DCT coefficients
          iBlock  0,1,2,3:Y; 4:Cb; 5:Cr; or 0:Y;1:Cb;2:Cr"""
      if iBlock < self.BlocksInMcu - 2:
          dctbl = self.htblYDC
          actbl = self.htblYAC
          LastDC = "dcY"
      else:
          dctbl = self.htblCbCrDC
          actbl = self.htblCbCrAC
          if iBlock == self.BlocksInMcu - 2:
              LastDC = "dcCb"
          else:
              LastDC = "dcCr"
  
      coeff = [0]*64
      
      # Section F.2.2.1: decode the DC coefficient difference
      s = self.GetCategory(dctbl)             # get dc category number, s
  
      if s:
          r = self.DoGetBits(s)                 # get offset in this dc category
          s = self.ValueFromCategory(s, r)    # get dc difference value
      
      # Convert DC difference to actual value, update last_dc_val
      if LastDC == 'dcY':
          s += self.dcY
          self.dcY = s
          #s += getattr(self, LastDC)
          #setattr(self, LastDC, s)
      elif LastDC == 'dcCb':
          s += self.dcCb
          self.dcCb = s
          #s += getattr(self, LastDC)
          #setattr(self, LastDC, s)
      elif LastDC == 'dcCr':
          s += self.dcCr
          self.dcCr = s
          #s += getattr(self, LastDC)
          #setattr(self, LastDC, s)
  
      # Output the DC coefficient (assumes jpeg_natural_order[0] = 0)
      coeff[0] = s
      
      # Section F.2.2.2: decode the AC coefficients
      # Since zeroes are skipped, output area must be cleared beforehand
      k = 1
      while k < 64:
          s = self.GetCategory( actbl )    # s: (run, category)
          r = s >> 4                       #    r: run length for ac zero, 0 <= r < 16
          s &= 15                          #    s: category for this non-zero ac
          
          if s:
              k += r                       #    k: position for next non-zero ac
              r = self.DoGetBits(s)               #    r: offset in this ac category
              s = self.ValueFromCategory(s, r)  #    s: ac value
  
              coeff[ jpeg_natural_order[ k ] ] = s
          else: # s = 0, means ac value is 0 ? Only if r = 15.  
              if r != 15:    # means all the left ac are zero
                  break
              k += 15
          k += 1
  
      return coeff
function_tokens: def HuffmanDecode ( self , iBlock ) : if iBlock < self . BlocksInMcu - 2 : dctbl = self . htblYDC actbl = self . htblYAC LastDC = "dcY" else : dctbl = self . htblCbCrDC actbl = self . htblCbCrAC if iBlock == self . BlocksInMcu - 2 : LastDC = "dcCb" else : LastDC = "dcCr" coeff = [ 0 ] * 64 # Section F.2.2.1: decode the DC coefficient difference s = self . GetCategory ( dctbl ) # get dc category number, s if s : r = self . DoGetBits ( s ) # get offset in this dc category s = self . ValueFromCategory ( s , r ) # get dc difference value # Convert DC difference to actual value, update last_dc_val if LastDC == 'dcY' : s += self . dcY self . dcY = s #s += getattr(self, LastDC) #setattr(self, LastDC, s) elif LastDC == 'dcCb' : s += self . dcCb self . dcCb = s #s += getattr(self, LastDC) #setattr(self, LastDC, s) elif LastDC == 'dcCr' : s += self . dcCr self . dcCr = s #s += getattr(self, LastDC) #setattr(self, LastDC, s) # Output the DC coefficient (assumes jpeg_natural_order[0] = 0) coeff [ 0 ] = s # Section F.2.2.2: decode the AC coefficients # Since zeroes are skipped, output area must be cleared beforehand k = 1 while k < 64 : s = self . GetCategory ( actbl ) # s: (run, category) r = s >> 4 #    r: run length for ac zero, 0 <= r < 16 s &= 15 #    s: category for this non-zero ac if s : k += r #    k: position for next non-zero ac r = self . DoGetBits ( s ) #    r: offset in this ac category s = self . ValueFromCategory ( s , r ) #    s: ac value coeff [ jpeg_natural_order [ k ] ] = s else : # s = 0, means ac value is 0 ? Only if r = 15.   if r != 15 : # means all the left ac are zero break k += 15 k += 1 return coeff