Improve the performance of PngWriter._build_image_data_bd1_nt()