[Digikam-devel] [digikam] [Bug 358848] Chroma subsampling incorrectly described

via KDE Bugzilla bugzilla_noreply at kde.org
Mon Feb 1 07:37:25 GMT 2016


https://bugs.kde.org/show_bug.cgi?id=358848

caulier.gilles at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Latest Commit|                            |http://commits.kde.org/digi
                   |                            |kam/b5be6c56a43af98a639e266
                   |                            |8ff99d8a47fd6504a
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED
   Version Fixed In|                            |5.0.0
                 CC|                            |caulier.gilles at gmail.com

--- Comment #1 from caulier.gilles at gmail.com ---
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);

-- 
You are receiving this mail because:
You are the assignee for the bug.



More information about the Digikam-devel mailing list