Compact CMOS Analog Counter for SPAD Pixel Arrays