-
Notifications
You must be signed in to change notification settings - Fork 70
API changes
The changes should be always summarized in NEWS.md, although there can be less details.
- the encoder can now encode grayscale image if subsampling 4:0:0 is specified even for color input image
- gpujpeg_parameters_chroma_subsampling() can now take GPUJPEG_SUBSAMPLING_UNKNOWN as a parameter, in which case implicit selection of JPEG subsampling based on input image pixel format subsampling is set. This is because the caller may want to set the subsampling expliclity for one picture but return to implicit setting for later images.
-
added
gpujpeg_default_parameters()
andgpujpeg_default_image_parameters()
functions to initialize structs gpujpeg_parameters and gpujpeg_image_parameters as follows:struct gpujpeg_parameters params = gpujpeg_default_parameters(); // not needed gpujpeg_set_default_parameters(¶ms); struct gpujpeg_image_parameters params_image = gpujpeg_default_image_parameters(); // not needed gpujpeg_image_set_default_paramete(¶ms_image);
This is more compact and allows eg. brace-or-equal initialization in C++ as well as following the always initialize rule. It also redudces the temptation to empty/zero/aggregate initialize the structs, like:
struct gpujpeg_parameters params = { }; // bad - empty/zero initialization struct gpujpeg_parameters params = { .verbose = 1 }; // bad - empty/zero-initialized remaining members
Rationale: the idea behind removing the comp_count
from gpujpeg_image_parameters
is to keep it simply for RAW (input for encoder, output for decoder) image properties, where the image component count is already defined by pixel_format. The comp_count now represents the JPEG internal parameter and it is strongly bound to gpujpeg_parameters::sampling_factor
, both should be set by gpujpeg_parameters_chroma_subsampling()
. The internal component count can be also different, eg. encoding/decoding grayscale from the color image.
Also, the encoder and decoder should require less tweaking (eg. no explicit configuration of pixel format for the decoder, which was requested for grayscale).
- removed deprecated
gpujpeg_parameters_chroma_subsampling_42{0,2}
- removed
comp_count
fromgpujpeg_image_parameters
and moved togpujpeg_parameters
. The value should not be set manually, anyways as it is currently bound to subsampling and should be set bygpujpeg_parameters_chroma_subsampling
(if needed) - if the input pixel format is subsampled (eg.
UYVY
), and subsampling not set explicitly, encoded JPEG is using the same sampling rate - struct
decoder_output
now containsparam_image
representing metadata of the image - decoding doesn't require the explicit output format setting, in which case RGB is output (or grayscale for monochromatic JPEG); there are couple of format placeholders meant for automatic format selection depending on the input JPEG properties.
-
gpujpeg_image_save_to_file
can use.XXX
placeholder for extension causing correct extension to be used depending if the color space is RGB or YCbCr. It can be used with command-line application as well (of course, useful mostly with "-N" parameter) - GPUJPEG_444_U8_P012A and GPUJPEG_444_U8_P012Z formats are replaced with single GPUJPEG_4444_U8_P0123