research/brotlidump.py
def IMTF(v):
        """In place inverse move to front transform.
        """
        #mtf is initialized virtually with range(infinity)
        mtf = []
        for i, vi in enumerate(v):
            #get old value from mtf. If never seen, take virtual value
            try: value = mtf.pop(vi)
            except IndexError: value = vi
            #put value at front
            mtf.insert(0, value)
            #replace transformed value
            v[i] = value
def IMTF(v):
        #mtf is initialized virtually with range(infinity)
        mtf = []
        for i, vi in enumerate(v):
            #get old value from mtf. If never seen, take virtual value
            try: value = mtf.pop(vi)
            except IndexError: value = vi
            #put value at front
            mtf.insert(0, value)
            #replace transformed value
            v[i] = value
def IMTF ( v ) : #mtf is initialized virtually with range(infinity) mtf = [ ] for i , vi in enumerate ( v ) : #get old value from mtf. If never seen, take virtual value try : value = mtf . pop ( vi ) except IndexError : value = vi #put value at front mtf . insert ( 0 , value ) #replace transformed value v [ i ] = value
In place inverse move to front transform.
In place inverse move to front transform .