A CMOS image sensor with programmable pixel-level analog processing