libtiff: OJPEG: reset subsampling_convert_state =0 in OJPEGPreDecode (fixes tiff2pdf issue #183)

From 4d80f0a0c7db86d544345326ce206095167539af Mon Sep 17 00:00:00 2001
From: Even Rouault <[EMAIL REDACTED]>
Date: Fri, 17 May 2024 18:06:02 +0200
Subject: [PATCH] OJPEG: reset subsampling_convert_state =0 in OJPEGPreDecode
 (fixes tiff2pdf issue #183)

---
 libtiff/tif_ojpeg.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libtiff/tif_ojpeg.c b/libtiff/tif_ojpeg.c
index e4547cf0..8c89ad71 100644
--- a/libtiff/tif_ojpeg.c
+++ b/libtiff/tif_ojpeg.c
@@ -755,6 +755,9 @@ static int OJPEGPreDecode(TIFF *tif, uint16_t s)
         if (OJPEGWriteHeaderInfo(tif) == 0)
             return (0);
     }
+
+    sp->subsampling_convert_state = 0;
+
     while (sp->write_curstrile < m)
     {
         if (sp->libjpeg_jpeg_query_style == 0)