jpegls: factorize return paths