From 7ed4c5c52554f0f5667ce6da9bf216ba4e80b152 Mon Sep 17 00:00:00 2001 From: alggm <31921935+alggm@users.noreply.github.com> Date: Wed, 13 Sep 2017 12:37:39 +0200 Subject: [PATCH] Fix display of jpeg with luminance subsampling (for instance, if MCU is Y=1x1, Cb=2x2, Cr=2x2). Missing offset inside the MCU for the chroma components. For isntance, for the case where MCU is Y=1x1, Cb=2x2, Cr=2x2, the four 8x8 chrominance blocks ended up being written at the same location, thus most of the picture appeared in grayscale. --- ImgDecode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ImgDecode.cpp b/ImgDecode.cpp index 88e00b4..d7e61f8 100644 --- a/ImgDecode.cpp +++ b/ImgDecode.cpp @@ -3364,7 +3364,7 @@ void CimgDecode::DecodeScanImg(unsigned nStart,bool bDisplay,bool bQuiet) // Store fullres value if (bDisplay) - SetFullRes(nMcuX,nMcuY,nComp,0,0,m_nDcChrCb); + SetFullRes(nMcuX,nMcuY,nComp,nCssIndH,nCssIndV,m_nDcChrCb); } } @@ -3396,7 +3396,7 @@ void CimgDecode::DecodeScanImg(unsigned nStart,bool bDisplay,bool bQuiet) // Store fullres value if (bDisplay) - SetFullRes(nMcuX,nMcuY,nComp,0,0,m_nDcChrCr); + SetFullRes(nMcuX,nMcuY,nComp,nCssIndH,nCssIndV,m_nDcChrCr); } }