Skip to content

API changes

Martin Pulec edited this page Apr 9, 2024 · 7 revisions

The changes should be always summarized in NEWS.md, although there can be less details.

0.25.2 (2024-04-09)

  • 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.

0.25.1 (2024-04-05)

  • added gpujpeg_default_parameters() and gpujpeg_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(&params);
    struct gpujpeg_image_parameters params_image = gpujpeg_default_image_parameters();
    // not needed gpujpeg_image_set_default_paramete(&params_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
    

0.23.0 - 0.25.0 (2024-04-05)

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 from gpujpeg_image_parameters and moved to gpujpeg_parameters. The value should not be set manually, anyways as it is currently bound to subsampling and should be set by gpujpeg_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 contains param_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
Clone this wiki locally