summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/extras/enc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/jpeg-xl/lib/extras/enc')
-rw-r--r--third_party/jpeg-xl/lib/extras/enc/encode.cc8
-rw-r--r--third_party/jpeg-xl/lib/extras/enc/encode.h2
-rw-r--r--third_party/jpeg-xl/lib/extras/enc/jpegli.cc4
-rw-r--r--third_party/jpeg-xl/lib/extras/enc/jpg.cc7
4 files changed, 16 insertions, 5 deletions
diff --git a/third_party/jpeg-xl/lib/extras/enc/encode.cc b/third_party/jpeg-xl/lib/extras/enc/encode.cc
index c5e22d8c7e..71be78e36c 100644
--- a/third_party/jpeg-xl/lib/extras/enc/encode.cc
+++ b/third_party/jpeg-xl/lib/extras/enc/encode.cc
@@ -134,5 +134,13 @@ std::unique_ptr<Encoder> Encoder::FromExtension(std::string extension) {
return nullptr;
}
+std::string ListOfEncodeCodecs() {
+ std::string list_of_codecs("PPM, PNM, PFM, PAM, PGX");
+ if (GetAPNGEncoder()) list_of_codecs.append(", PNG, APNG");
+ if (GetJPEGEncoder()) list_of_codecs.append(", JPEG");
+ if (GetEXREncoder()) list_of_codecs.append(", EXR");
+ return list_of_codecs;
+}
+
} // namespace extras
} // namespace jxl
diff --git a/third_party/jpeg-xl/lib/extras/enc/encode.h b/third_party/jpeg-xl/lib/extras/enc/encode.h
index 2502d9976b..a71f3b220f 100644
--- a/third_party/jpeg-xl/lib/extras/enc/encode.h
+++ b/third_party/jpeg-xl/lib/extras/enc/encode.h
@@ -82,6 +82,8 @@ class Encoder {
std::unordered_map<std::string, std::string> options_;
};
+std::string ListOfEncodeCodecs();
+
} // namespace extras
} // namespace jxl
diff --git a/third_party/jpeg-xl/lib/extras/enc/jpegli.cc b/third_party/jpeg-xl/lib/extras/enc/jpegli.cc
index cb473a1290..9735cd8cb9 100644
--- a/third_party/jpeg-xl/lib/extras/enc/jpegli.cc
+++ b/third_party/jpeg-xl/lib/extras/enc/jpegli.cc
@@ -454,6 +454,10 @@ Status EncodeJpeg(const PackedPixelFile& ppf, const JpegSettings& jpeg_settings,
cinfo.comp_info[i].h_samp_factor = 1;
cinfo.comp_info[i].v_samp_factor = 1;
}
+ } else if (!jpeg_settings.xyb) {
+ // Default is no chroma subsampling.
+ cinfo.comp_info[0].h_samp_factor = 1;
+ cinfo.comp_info[0].v_samp_factor = 1;
}
jpegli_enable_adaptive_quantization(
&cinfo, TO_JXL_BOOL(jpeg_settings.use_adaptive_quantization));
diff --git a/third_party/jpeg-xl/lib/extras/enc/jpg.cc b/third_party/jpeg-xl/lib/extras/enc/jpg.cc
index 0095ac9294..a2ef4a9fc4 100644
--- a/third_party/jpeg-xl/lib/extras/enc/jpg.cc
+++ b/third_party/jpeg-xl/lib/extras/enc/jpg.cc
@@ -6,18 +6,15 @@
#include "lib/extras/enc/jpg.h"
#if JPEGXL_ENABLE_JPEG
-#include <jpeglib.h>
-#include <setjmp.h>
+#include "lib/jxl/base/include_jpeglib.h" // NOLINT
#endif
-#include <stdint.h>
#include <algorithm>
#include <array>
#include <cmath>
+#include <cstdint>
#include <fstream>
-#include <iterator>
#include <memory>
-#include <numeric>
#include <sstream>
#include <utility>
#include <vector>