Fix access to out-of-bound-element error when decoding monochrome stream after !1885 See merge request !1896