def golomb_rice_decode(bit_reader, p)
      q = 0
      while bit_reader.read(1) == 1
        q +=1
      end
      r = bit_reader.read(p)
      (q << p) + r
    end
def golomb_rice_decode(bit_reader, p)
      q = 0
      while bit_reader.read(1) == 1
        q +=1
      end
      r = bit_reader.read(p)
      (q << p) + r
    end
decode golomb rice