Sparse Coding via Thresholding and Local Competition