
VDecoderJPEG C++ library
v1.1.4
Table of contents
- Overview
- Versions
- Library files
- VDecoderJPEG class description
- Build and connect to your project
- Simple example
- SIMD acceleration and portability
Overview
The VDecoderJPEG C++ library provides a standalone software JPEG and Motion JPEG (MJPEG) video decoder for Linux, Windows, and embedded platforms. Key features:
- Self-contained decoder: Contains complete, self-contained implementations of JPEG marker parsing (SOI, SOF0, SOF1, DQT, DHT, SOS, DRI, RSTm, EOI and the APP0 / APP14 color space markers), entropy data reading with byte stuffing removal, Huffman entropy decoding with two-level direct prefix lookup tables, an integer 8x8 inverse discrete cosine transform (IDCT), chroma conversion to 4:2:0 and uncompressed frame assembly. The only dependencies are the VCodec interface library and the Frame library. No third-party media frameworks or OS-specific decoding services are required.
- Pure C++ source code: Built from C++17 source code with native SIMD intrinsics (AVX2 and SSE4.1 on x86 / x86-64, NEON on ARM64) and portable C++ code for everything else, including a complete portable fallback of every SIMD kernel. Uses no precompiled libraries, preloaded shared objects, or runtime dynamic loading (
.dll,.so,LoadLibrary,dlopen). - Runs on every CPU of the target architecture: the SIMD kernels are compiled per source file and selected at run time (AVX2 -> SSE4.1 -> portable C++ on x86, NEON on ARM64 and on 32-bit ARM if the compiler generates NEON code, portable C++ on every other architecture), so a binary never requires an instruction set the CPU does not have. A compiler that can not build a kernel set builds the portable code. See SIMD acceleration and portability.
- Cross-platform: Windows (MSVC, x86 and x86-64), Linux x86 / x86-64 (GCC, Clang) and Linux ARM64 / AArch64 (GCC, Clang, NEON). Any other platform with a C++17 compiler and
std::threadis built with the portable code. The decoded output is bit-identical on all platforms, SIMD levels and thread counts. - Supported streams: Baseline and extended sequential (SOF0, SOF1) 8-bit Huffman-coded JPEG / MJPEG streams with one interleaved scan that contains all components: 4:2:0 (YCbCr, luma sampling 2x2), 4:2:2 (YCbCr 2x1), 4:4:0 (YCbCr 1x2), 4:4:4 (YCbCr 1x1) - also with larger sampling factors in the same ratios, at most 10 blocks per MCU - and Grayscale (single component). Image size from 1 x 1 up to 65535 x 65535 with at most 268,435,456 pixels (for example 16384 x 16384). Supports restart markers (DRI and RST0–RST7), 8-bit and 16-bit quantization tables and fill bytes before markers. Frames without DHT segments (typical for MJPEG) are decoded with the typical Huffman tables of ITU-T T.81 Annex K; tables of previous frames stay valid until they are redefined (also by a frame that is rejected later) or
RESETis executed. Not supported,transcode(...)returnsfalse: progressive, lossless, arithmetic-coded, hierarchical, multi-scan and 12-bit streams, CMYK / YCCK (4 components), RGB-coded frames (Adobe color transform 0, or component identifiers ‘R’, ‘G’, ‘B’ without JFIF marker), other subsampling (for example 4:1:1), frames whose height is defined by a DNL marker and damaged frames (invalid marker segments or tables, invalid Huffman codes, missing restart markers, entropy data that ends before the last MCU). - NV12 Output: Decodes JPEG frames into standard NV12 uncompressed video frames (Y plane followed by interleaved UV plane), ready for display or further processing. Chroma of 4:2:2, 4:4:0 and 4:4:4 frames is converted to 4:2:0 by averaging 2 samples (4:2:2 vertically, 4:4:0 horizontally) or 2x2 samples (4:4:4) with rounding; grayscale frames get neutral chroma (128). NV12 requires even dimensions, so a frame with odd width and/or height is padded by one column and/or one row of decoded samples (the output size is the JPEG size rounded up to an even number).
- Single-threaded by default, optional multi-threading: By default (
CUSTOM_2 = 1.0f) the decoder works single-threaded, without background threads. Optionally (CUSTOM_2 = 0.0ffor automatic, orN >= 2) the calling thread decodes the entropy data row of MCUs by row of MCUs while worker threads reconstruct the decoded rows (inverse DCT and NV12 assembly) in parallel. The entropy decoding stays sequential, so only the reconstruction (about half of the decoding work for typical frames) is spread over the threads. The output is 100% bit-identical. - Standard VCodec Interface: Inherits from the
rapidpixel::VCodecinterface (VCodec library), so the decoder can be used wherever the SDK expects aVCodec. - C++17 Architecture: Uses the PIMPL pattern: the public header contains no internal decoder structures.
The VDecoderJPEG class depends on the VCodec interface class and on the Frame class of the Frame library, which determines video frame structures. The example application uses SimpleUI for window display and drawing, and a lightweight built-in Motion JPEG stream parser (JpegParser). The library uses the C++17 standard.
VDecoderJPEG is general-purpose software: it is not tied to any sector or application, and the developer of a program decides what the program does with it.
Versions
Table 1 - Library versions.
| Version | Release date | What’s new |
|---|---|---|
| 1.0.0 | 30.09.2026 | - First version. |
| 1.1.0 | 06.10.2026 | - Decoder rewritten, about 35 % faster. - Range checks of all marker segments and entropy data, limited memory use for damaged files. - No compiler warnings (MSVC /W4, GCC, Clang). |
| 1.1.1 | 16.10.2026 | - The repository has no sub-repositories: the libraries Frame, VCodec and SimpleUI (example only) are expected next to the repository or are added by the parent project. - Strict compiler warnings and exploit mitigation flags for the library and the example. - Non-integer values of LOG_LEVEL, TYPE and CUSTOM_2 are rejected. - The constructor does not throw if memory can not be allocated. - transcode(…) returns false if the destination frame gets no buffer, and keeps frameId and sourceId if src and dst are the same frame. - Code style, code comments and documentation corrected. |
| 1.1.2 | 25.10.2026 | - The library links the thread library (CMake target Threads::Threads): programs built on a C library older than glibc 2.34 no longer need -pthread. |
| 1.1.3 | 17.11.2026 | - Build without warnings with GCC 9 (Jetson Nano, Ubuntu 18.04): an index of the Huffman tables is computed as an unsigned value. |
| 1.1.4 | 21.11.2026 | - CMake: hardening flags are checked with -Werror, the build with Clang 15 for AArch64 has no warnings. |
Library files
The repository structure is organized as follows:
CMakeLists.txt ---------------- Main CMake build configuration.
README.md --------------------- Documentation and usage guide.
static ------------------------ Images of the documentation.
src --------------------------- Library source code.
CMakeLists.txt ------------ CMake script for VDecoderJPEG library.
VDecoderJPEG.h ------------ Public library interface (PIMPL).
VDecoderJPEG.cpp ---------- Public library implementation wrapper.
VDecoderJPEGVersion.h ----- Version definition header.
VDecoderJPEGVersion.h.in -- Template for CMake version generation.
impl ---------------------- Internal decoder implementation files.
VDecoderJPEGImpl.h ---- Internal PIMPL class declaration.
VDecoderJPEGImpl.cpp -- PIMPL class implementation & frame buffer management.
JpegEngine.h ---------- Decoder engine and internal JPEG data types.
JpegEngine.cpp -------- Marker parsing, Huffman decoding, portable IDCT and NV12 conversion, kernel selection, threads.
JpegKernels.h --------- IDCT arithmetic shared by all kernel sets, table of the reconstruction kernels.
x86 ------------------- x86 SIMD kernels (compiled with their own instruction set flags) and CPU detection.
JpegX86.h --------- Declarations of the x86 CPU checks and kernel sets.
JpegCpuFeatures.cpp CPUID / XGETBV checks (no instruction set flags).
JpegKernelsSse41.cpp SSE4.1 IDCT and chroma conversion kernels.
JpegKernelsAvx2.cpp AVX2 IDCT and chroma conversion kernels.
example ----------------------- Standalone sample application.
JpegParser.h -------------- Standalone Motion JPEG stream parser header.
JpegParser.cpp ------------ Standalone Motion JPEG stream parser implementation.
CMakeLists.txt ------------ Example build configuration.
main.cpp ------------------ Example demonstrating video decoding with VDecoderJPEG.
VDecoderJPEG class description
VDecoderJPEG class declaration
The VDecoderJPEG class is declared in VDecoderJPEG.h:
namespace rapidpixel
{
class VDecoderJPEG : public VCodec
{
public:
/// Class constructor.
VDecoderJPEG();
/// Class destructor.
~VDecoderJPEG() override;
/// Copy and move are not allowed.
VDecoderJPEG(const VDecoderJPEG&) = delete;
VDecoderJPEG(VDecoderJPEG&&) = delete;
VDecoderJPEG& operator=(const VDecoderJPEG&) = delete;
VDecoderJPEG& operator=(VDecoderJPEG&&) = delete;
/// Get library version.
static std::string getVersion();
/// Decode JPEG video frame to NV12.
bool transcode(Frame& src, Frame& dst) override;
/// Set parameter value.
bool setParam(VCodecParam id, float value) override;
/// Get parameter value.
float getParam(VCodecParam id) override;
/// Execute codec command.
bool executeCommand(VCodecCommand id) override;
};
}
getVersion method
The getVersion() method returns a string with the current version of the library:
static std::string getVersion();
Example usage:
std::cout << "VDecoderJPEG version: " << rapidpixel::VDecoderJPEG::getVersion() << std::endl;
Terminal output:
VDecoderJPEG version: 1.1.4
transcode method
The transcode(…) method decodes an incoming JPEG frame into an uncompressed NV12 video frame.
bool transcode(Frame& src, Frame& dst) override;
| Parameter | Type | Description |
|---|---|---|
src | Frame& | Source compressed video frame. Field src.fourcc must be Fourcc::JPEG (or bitstream starting with SOI marker 0xFF 0xD8). Data pointer src.data points to one complete JPEG image (SOI marker first) and src.size specifies its size in bytes: src.data must point to at least src.size readable bytes, the decoder reads nothing beyond them. src.width and src.height are not used, src is not changed. |
dst | Frame& | Destination uncompressed video frame. Upon successful decode, the decoder populates dst.data with raw NV12 pixel data (Y plane followed by interleaved UV plane), sets dst.width, dst.height, dst.size = width * height * 3 / 2 and dst.fourcc = Fourcc::NV12, and copies frameId and sourceId from src. The width and height are rounded up to even numbers (NV12 requirement). If dst.data is not null and dst.size is at least the NV12 size, the existing buffer is reused (dst.data must point to at least dst.size writable bytes), otherwise a new buffer is allocated. dst is left unchanged if decoding fails; only if memory for a new buffer of dst can not be allocated, dst can be left empty (data null, size 0). |
Returns: true if a frame was successfully decoded; false if src.data is null or src.size is smaller than 4, if the stream is unsupported, damaged or truncated (invalid markers or tables, missing restart marker, entropy data that ends before the last MCU) or if memory can not be allocated. The decoding time of a frame is proportional to its number of blocks; a frame whose entropy data is shorter than 2 bits per block is rejected before its buffers are allocated.
setParam method
The setParam(…) method configures decoder parameters.
bool setParam(VCodecParam id, float value) override;
| Parameter | Type | Description |
|---|---|---|
id | VCodecParam | Parameter identifier from the VCodecParam enum. |
value | float | Value to assign to the parameter. |
Supported parameters:
VCodecParam::LOG_LEVEL: Logging verbosity, integer values with magnitude below 1e9 are accepted and stored (default0), other values are rejected. The decoder does not print or log anything.VCodecParam::TYPE: Codec type, integer values with magnitude below 1e9 are accepted and stored (default0), other values are rejected. The decoder is always a software decoder.VCodecParam::CUSTOM_1: Reserved for custom user configurations, any value is stored without check (default0.0f).VCodecParam::CUSTOM_2: Number of decoding threads (default1.0f):1.0f- single-threaded decoding (default): everything is decoded in the thread which callstranscode(...), no worker threads are created.0.0f- automatic: the number of decoding threads depends on hardware concurrency (at most 16 threads, the calling thread included).N >= 2-Ndecoding threads: the calling thread andN - 1worker threads (at most 32 threads are used).- Negative, non-integer and non-finite values are rejected. If a worker thread can not be created,
falseis returned and the decoder stays single-threaded (CUSTOM_2reads1.0f). - The output is bit-identical for every value.
VCodecParam::CUSTOM_3: Color range control for output NV12 frame (default1.0f):1.0f: Automatic (default). The luma of every frame is analysed (every 4th sample of every 4th row, every 2nd for sizes up to 256). If the luma span is at least 8 levels and fewer than 0.2% of the analysed samples are outside [14..238], the frame is treated as limited range and luma [16..235] and chroma [16..240] are expanded to Full Range [0..255] after decoding (values outside the limited range are clipped). Frames with more samples outside [14..238], as typical for full-range content, are not changed. The decision is made for every frame independently, so a full-range frame without dark and bright samples can be expanded too: use0.0fif the source is known to be full range.0.0f: Disabled / pass-through: pass-through raw decoded samples without range expansion.2.0f: Forced expansion: always expand Limited Range to Full Range.- Other values are rejected.
Returns: true if the parameter was accepted, false otherwise.
getParam method
The getParam(…) method queries parameter values from the decoder.
float getParam(VCodecParam id) override;
Returns: Value of the specified parameter, or -1.0f if unsupported.
executeCommand method
The executeCommand(…) method sends control commands to the decoder.
bool executeCommand(VCodecCommand id) override;
Supported commands:
VCodecCommand::RESET: Clears internal decoder state: the quantization and Huffman tables of previous frames are forgotten and the frame buffers are released, ready for a new stream.
Returns: true if the command was executed successfully, false for other commands.
A VDecoderJPEG object is not thread-safe: call its methods from one thread at a time (the worker threads are internal). Several objects can be used in parallel. The constructor does not throw: if memory for the decoder can not be allocated, every method returns its failure value (false or -1.0f).
Build and connect to your project
Build stand alone
The repository does not contain sub-repositories. The libraries VDecoderJPEG depends on (Frame, VCodec) and the library the example uses (SimpleUI) must be placed in the same folder as VDecoderJPEG: copy their folders, for example from the folder modules of the RapidPixel SDK. The folder structure must be:
<work folder>
VDecoderJPEG
Frame
VCodec
SimpleUI
Typical commands to build the library and the example:
cd VDecoderJPEG
mkdir build
cd build
cmake ..
make
On Windows use cmake --build . --config Release instead of make. If VDecoderJPEG is the top-level CMake project, the main CMakeLists.txt file adds the folders ../Frame and ../VCodec (in this order) before the library itself and the folder ../SimpleUI before the example. If a folder does not exist CMake stops with an error. To build the library without the example (SimpleUI is not needed then) use cmake .. -D_SUBMODULE_CACHE_OVERWRITE=OFF -D_VDECODERJPEG_EXAMPLE=OFF instead of cmake ...
CMake options
Table 2 - CMake options of the repository. In the options below ${PARENT} is the prefix defined by the top-level project (empty if VDecoderJPEG is the top-level project).
| Option | Default | Description |
|---|---|---|
| ${PARENT}_VDECODERJPEG | ON | Build the library. |
| ${PARENT}_VDECODERJPEG_EXAMPLE | ON (stand alone), OFF (included in other project) | Build the example. |
| ${PARENT}_SUBMODULE_CACHE_OVERWRITE | ON | Forced rewriting of the options above in the CMake cache. The top-level project sets it to OFF when it includes VDecoderJPEG as a sub-repository. |
| CMAKE_BUILD_TYPE | Release (if not specified) | Build type. |
| VDECODERJPEG_ENABLE_SIMD | ON | Build the SIMD kernels. OFF builds the portable decoder only (see SIMD acceleration and portability). |
Connect to your project
If you want to connect the VDecoderJPEG library to your CMake project as source code, you can do the following. For example, if your repository has the structure:
CMakeLists.txt
src
CMakeLists.txt
yourLib.h
yourLib.cpp
Create folder 3rdparty in your repository and copy the folders of the libraries Frame, VCodec and VDecoderJPEG there (for example from the folder modules of the RapidPixel SDK). The new structure of your repository:
CMakeLists.txt
src
CMakeLists.txt
yourLib.h
yourLib.cpp
3rdparty
Frame
VCodec
VDecoderJPEG
Create a CMakeLists.txt file in the 3rdparty folder. VDecoderJPEG does not add its dependencies when it is included in another project: the file adds them in dependency order (Frame, VCodec) and then the library. The CMakeLists.txt file should contain:
cmake_minimum_required(VERSION 3.13)
################################################################################
## 3RD-PARTY
## dependencies for the project
################################################################################
project(3rdparty LANGUAGES CXX)
################################################################################
## SETTINGS
## basic 3rd-party settings before use
################################################################################
# To inherit the top-level architecture when the project is used as a submodule.
SET(PARENT ${PARENT}_YOUR_PROJECT_3RDPARTY)
# Disable self-overwriting of parameters inside included subdirectories.
SET(${PARENT}_SUBMODULE_CACHE_OVERWRITE OFF CACHE BOOL "" FORCE)
################################################################################
## CONFIGURATION
## 3rd-party submodules configuration
################################################################################
SET(${PARENT}_SUBMODULE_FRAME ON CACHE BOOL "" FORCE)
if (${PARENT}_SUBMODULE_FRAME)
SET(${PARENT}_FRAME ON CACHE BOOL "" FORCE)
SET(${PARENT}_FRAME_TEST OFF CACHE BOOL "" FORCE)
endif()
SET(${PARENT}_SUBMODULE_VCODEC ON CACHE BOOL "" FORCE)
if (${PARENT}_SUBMODULE_VCODEC)
SET(${PARENT}_VCODEC ON CACHE BOOL "" FORCE)
endif()
SET(${PARENT}_SUBMODULE_VDECODERJPEG ON CACHE BOOL "" FORCE)
if (${PARENT}_SUBMODULE_VDECODERJPEG)
SET(${PARENT}_VDECODERJPEG ON CACHE BOOL "" FORCE)
SET(${PARENT}_VDECODERJPEG_EXAMPLE OFF CACHE BOOL "" FORCE)
endif()
################################################################################
## INCLUDING SUBDIRECTORIES
## Adding subdirectories according to the 3rd-party configuration
################################################################################
if (${PARENT}_SUBMODULE_FRAME)
add_subdirectory(Frame)
endif()
if (${PARENT}_SUBMODULE_VCODEC)
add_subdirectory(VCodec)
endif()
if (${PARENT}_SUBMODULE_VDECODERJPEG)
add_subdirectory(VDecoderJPEG)
endif()
Next, you need to include the 3rdparty folder in the main CMakeLists.txt file of your repository. Add the following line at the end of your main CMakeLists.txt:
add_subdirectory(3rdparty)
Next, you need to include the VDecoderJPEG library in your src/CMakeLists.txt file (Frame and VCodec are linked with it):
target_link_libraries(${PROJECT_NAME} VDecoderJPEG)
Include the public header in your code:
#include "VDecoderJPEG.h"
If your project does not add the Frame and VCodec libraries, the build of VDecoderJPEG stops with compile errors such as VCodec.h: No such file or directory or Frame.h: No such file or directory.
Simple example
The example application (example/main.cpp) demonstrates opening a Motion JPEG video file (*.mjpeg), decoding frames to NV12, converting to YUV format, and rendering using SimpleUI:
#include <cstdint>
#include <cstring>
#include <iostream>
#include <string>
#include "Frame.h"
#include "VDecoderJPEG.h"
#include "JpegParser.h"
#include "SimpleUi.h"
namespace
{
/// Key code of ESC: the example stops.
constexpr int ESC_KEY{27};
/// Time to wait for a key after a frame is shown, milliseconds.
constexpr int KEY_WAIT_MS{30};
/// Chroma value of a picture without colour.
constexpr uint8_t NEUTRAL_CHROMA{128};
/// Remove quotes around a path (for example a path dragged into a console).
std::string removeQuotes(std::string path)
{
if (!path.empty() && (path.front() == '"' || path.front() == '\''))
{
path.erase(0, 1);
}
if (!path.empty() && (path.back() == '"' || path.back() == '\''))
{
path.pop_back();
}
return path;
}
/// Copy the Y plane of an NV12 frame into a YUV24 frame with neutral chroma.
bool lumaToYuv(const rapidpixel::Frame& nv12, rapidpixel::Frame& yuv)
{
if (nv12.data == nullptr || nv12.width <= 0 || nv12.height <= 0)
{
return false;
}
if (yuv.data == nullptr || yuv.width != nv12.width ||
yuv.height != nv12.height)
{
yuv = rapidpixel::Frame(nv12.width, nv12.height,
rapidpixel::Fourcc::YUV24);
if (yuv.data == nullptr)
{
return false;
}
}
std::memset(yuv.data, NEUTRAL_CHROMA, static_cast<size_t>(yuv.size));
for (int i = 0; i < yuv.size; i += 3)
{
yuv.data[i] = nv12.data[i / 3];
}
return true;
}
}
int main(int argc, char* argv[])
{
// Print library version.
std::cout << "VDecoderJPEG v" << rapidpixel::VDecoderJPEG::getVersion()
<< std::endl;
// Get input Motion JPEG file path.
std::string videoPath;
if (argc > 1)
{
videoPath = argv[1];
}
else
{
std::cout << "Enter path to video file (*.mjpeg): ";
std::getline(std::cin, videoPath);
}
videoPath = removeQuotes(videoPath);
if (videoPath.empty())
{
videoPath = "test.mjpeg";
}
// Open Motion JPEG stream file.
rapidpixel::JpegParser parser;
if (!parser.open(videoPath))
{
std::cerr << "Failed to open video file: " << videoPath << std::endl;
return -1;
}
// Initialize decoder and UI window.
rapidpixel::VDecoderJPEG decoder;
rapidpixel::SimpleUiWindow window("VDecoderJPEG - Video");
window.show();
// Input JPEG frame, decoded NV12 frame and the YUV frame to show.
rapidpixel::Frame jpegFrame;
rapidpixel::Frame nv12Frame;
rapidpixel::Frame yuvFrame;
// Decode and display video frames. Frames that can not be decoded are
// skipped and counted.
int failedFrames{0};
while (window.isOpen() && parser.getFrame(jpegFrame))
{
// Decode JPEG frame to NV12 format.
if (!decoder.transcode(jpegFrame, nv12Frame))
{
++failedFrames;
continue;
}
// Convert NV12 frame to YUV format with only Y channel.
if (!lumaToYuv(nv12Frame, yuvFrame))
{
std::cerr << "Failed to convert frame" << std::endl;
return -1;
}
// Render frame and process UI events (ESC to exit).
window.render(yuvFrame);
if (window.getKey(KEY_WAIT_MS) == ESC_KEY)
{
break;
}
}
if (failedFrames > 0)
{
std::cout << failedFrames << " frame(s) could not be decoded"
<< std::endl;
}
return 0;
}
SIMD acceleration and portability
The decoder is plain C++17 with a complete portable implementation of every sample reconstruction routine (inverse DCT, chroma conversion to NV12). SIMD kernels are optional accelerators of these routines; the kernel set is chosen once per process, when the first decoder is created:
| CPU | Kernels used | How the level is chosen |
|---|---|---|
| x86 / x86-64 | AVX2 -> SSE4.1 -> portable C++ | CPUID. AVX2 additionally requires OS support for the YMM registers (OSXSAVE + XGETBV). |
| ARM64 / AArch64 | NEON (chroma interleaving) + portable C++ | At compile time, NEON is always available on AArch64. |
| 32-bit ARM | NEON (chroma interleaving) + portable C++, or portable C++ | At compile time: NEON if the compiler generates NEON code (__ARM_NEON is defined, for example with -mfpu=neon). |
| Any other CPU | portable C++ | No intrinsics are compiled. |
A binary built on a machine with AVX2 therefore also starts and decodes on a CPU with only SSE4.1 or even only SSE2 (checked with emulated Haswell, Nehalem, Penryn and Core 2 (Conroe) CPUs), and the decoded output is bit-identical for every level. The entropy decoding and all other code are built without instruction set flags; in measurements on an x86-64 CPU with the AVX2 kernels switched off, the SSE4.1 kernels needed about 30 to 45 % less decoding time than the portable code.
Instruction set flags are applied per source file, never globally:
| Source files | Flags |
|---|---|
src/impl/x86/JpegKernelsSse41.cpp | -msse4.1 (GCC / Clang). MSVC needs no flag. |
src/impl/x86/JpegKernelsAvx2.cpp | -mavx2 (GCC / Clang), /arch:AVX2 (MSVC). |
| All other files, including the CPU detection, the kernel selection and the portable code | No instruction set flags (no -march=native, no global -mavx2 or /arch:AVX2). |
CMake checks with check_cxx_source_compiles that the target is x86, that the CPU detection compiles and that the compiler can build the SSE4.1 and AVX2 kernels. If it can not (very old compiler, unusual toolchain, universal macOS binary), these kernels are left out, a message is printed during configuration, and the next level is used. Options:
| Option / macro | Effect |
|---|---|
-DVDECODERJPEG_ENABLE_SIMD=OFF | Builds the portable decoder only (defines VDECODERJPEG_NO_SIMD, also switches off NEON). |
VDECODERJPEG_NO_SSE41, VDECODERJPEG_NO_AVX2 | Leave out an x86 kernel set. CMake defines them automatically when a compiler check fails. |
The macros are private compile definitions of the VDecoderJPEG target. Without CMake, compile all src/**/*.cpp files as C++17, add the flags from the table to the listed files (or define the macros above) and link the system thread library (-pthread).