[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [digikam] libs/dimg/loaders: correct chroma subsampling in JPEGLoader and adds a chroma subsampling
From: Maik Qualmann <metzpinguin () gmail ! com>
Date: 2016-01-31 20:02:32
Message-ID: E1aPyCe-00015o-TR () scm ! kde ! org
[Download RAW message or body]
Git commit b5be6c56a43af98a639e2668ff99d8a47fd6504a by Maik Qualmann.
Committed on 31/01/2016 at 20:01.
Pushed by mqualmann into branch 'master'.
correct chroma subsampling in JPEGLoader and adds a chroma subsampling mode
M +16 -4 libs/dimg/loaders/jpegloader.cpp
M +12 -8 libs/dimg/loaders/jpegsettings.cpp
http://commits.kde.org/digikam/b5be6c56a43af98a639e2668ff99d8a47fd6504a
diff --git a/libs/dimg/loaders/jpegloader.cpp b/libs/dimg/loaders/jpegloader.cpp
index c33d785..f33c15c 100644
--- a/libs/dimg/loaders/jpegloader.cpp
+++ b/libs/dimg/loaders/jpegloader.cpp
@@ -736,9 +736,9 @@ bool JPEGLoader::save(const QString& filePath, \
DImgLoaderObserver* const observe
switch (subsampling)
{
- case 1: // 2x1, 1x1, 1x1 (4:2:2) : Medium
+ case 1: // 2x1, 1x1, 1x1 (4:2:2) : Low
{
- qCDebug(DIGIKAM_DIMG_LOG_JPEG) << "Using LibJPEG medium \
chroma-subsampling (4:2:2)"; + qCDebug(DIGIKAM_DIMG_LOG_JPEG) << "Using \
LibJPEG low chroma-subsampling (4:2:2)"; cinfo.comp_info[0].h_samp_factor = 2;
cinfo.comp_info[0].v_samp_factor = 1;
cinfo.comp_info[1].h_samp_factor = 1;
@@ -748,9 +748,9 @@ bool JPEGLoader::save(const QString& filePath, \
DImgLoaderObserver* const observe break;
}
- case 2: // 2x2, 1x1, 1x1 (4:1:1) : High
+ case 2: // 2x2, 1x1, 1x1 (4:2:0) : Medium
{
- qCDebug(DIGIKAM_DIMG_LOG_JPEG) << "Using LibJPEG high chroma-subsampling \
(4:1:1)"; + qCDebug(DIGIKAM_DIMG_LOG_JPEG) << "Using LibJPEG medium \
chroma-subsampling (4:2:0)"; cinfo.comp_info[0].h_samp_factor = 2;
cinfo.comp_info[0].v_samp_factor = 2;
cinfo.comp_info[1].h_samp_factor = 1;
@@ -760,6 +760,18 @@ bool JPEGLoader::save(const QString& filePath, \
DImgLoaderObserver* const observe break;
}
+ case 3: // 4x1, 1x1, 1x1 (4:1:1) : High
+ {
+ qCDebug(DIGIKAM_DIMG_LOG_JPEG) << "Using LibJPEG high chroma-subsampling \
(4:1:1)"; + cinfo.comp_info[0].h_samp_factor = 4;
+ cinfo.comp_info[0].v_samp_factor = 1;
+ cinfo.comp_info[1].h_samp_factor = 1;
+ cinfo.comp_info[1].v_samp_factor = 1;
+ cinfo.comp_info[2].h_samp_factor = 1;
+ cinfo.comp_info[2].v_samp_factor = 1;
+ break;
+ }
+
default: // 1x1 1x1 1x1 (4:4:4) : None
{
qCDebug(DIGIKAM_DIMG_LOG_JPEG) << "Using LibJPEG none chroma-subsampling \
(4:4:4)";
diff --git a/libs/dimg/loaders/jpegsettings.cpp b/libs/dimg/loaders/jpegsettings.cpp
index b93bfba..afa4beb 100644
--- a/libs/dimg/loaders/jpegsettings.cpp
+++ b/libs/dimg/loaders/jpegsettings.cpp
@@ -108,18 +108,22 @@ JPEGSettings::JPEGSettings(QWidget* const parent)
d->subSamplingCB = new QComboBox(this);
d->subSamplingCB->insertItem(0, i18n("None")); // 1x1, 1x1, 1x1 (4:4:4)
- d->subSamplingCB->insertItem(1, i18n("Medium")); // 2x1, 1x1, 1x1 (4:2:2)
- d->subSamplingCB->insertItem(2, i18n("High")); // 2x2, 1x1, 1x1 (4:1:1)
+ d->subSamplingCB->insertItem(1, i18n("Low")); // 2x1, 1x1, 1x1 (4:2:2)
+ d->subSamplingCB->insertItem(2, i18n("Medium")); // 2x2, 1x1, 1x1 (4:2:0)
+ d->subSamplingCB->insertItem(3, i18n("High")); // 4x1, 1x1, 1x1 (4:1:1)
d->subSamplingCB->setWhatsThis(i18n("<p>JPEG Chroma subsampling level \n(color \
is saved with less resolution " "than luminance):</p>"
"<p><b>None</b>=best: uses 4:4:4 ratio. Does \
not employ chroma "
"subsampling at all. This preserves edges \
and contrasting "
- "colors, whilst adding no additional \
compression</p>"
- "<p><b>Medium</b>: uses 4:2:2 ratio. Medium \
compression: reduces "
- "the color resolution by one-third with \
little to "
- "no visual difference</p>"
- "<p><b>High</b>: use 4:1:1 ratio. High \
compression: suits "
- "images with soft edges but tends to alter \
colors</p>" + "colors, whilst adding no \
additional compression.</p>" + "<p><b>Low</b>: \
uses 4:2:2 ratio. Low compression: reduces " + \
"the horizontal color resolution by half with little to " + \
"no visual difference.</p>" + \
"<p><b>Medium</b>: uses 4:2:0 ratio. Medium compression: reduces " + \
"the horizontal and vertical color resolution by half.</p>" + \
"<p><b>High</b>: use 4:1:1 ratio. High compression: reduces " + \
"the horizontal color resolution by one quarter. Created " + \
"images with soft edges but tends to alter colors.</p>"
"<p><b>Note: JPEG always uses lossy \
compression.</b></p>"));
d->JPEGGrid->addWidget(d->labelJPEGcompression, 0, 0, 1, 2);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic