Skip to content

Commit b31504f

Browse files
committed
FAQ: decoder preinit extended
1 parent 9097c79 commit b31504f

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

FAQ.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,20 @@ are known, the preinitialization may be performed immediately:
209209

210210
// Pre initialize decoder before decoding
211211
gpujpeg_decoder_init(decoder, &param, &param_image);
212+
213+
The `color_space` and `pixel_format` doesn't need to match the JPEG
214+
properties, you can set eg.:
215+
216+
param_image.color_space = GPUJPEG_YCBCR_JPEG;
217+
param_image.pixel_format = GPUJPEG_422_U8_P1020;
218+
219+
to enforce decoding to UYVY. Alternatively, you can set either color
220+
space or pixel format to an _automatic_ value:
221+
222+
param_image.color_space = GPUJPEG_NONE;
223+
param_image.pixel_format = GPUJPEG_PIXFMT_AUTODETECT;
224+
225+
In this case, the _color_space_ and/or _pixel_format_ will be set to
226+
a format that is closest to internal JPEG representation. For the color
227+
space this usually means _GPUJPEG_YCBCR_JPEG_ - 256 levels YCbCr BT.601.
228+
Pixel format will be used to match the JPEG subsampling.

libgpujpeg/gpujpeg_decoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ gpujpeg_decoder_destroy(struct gpujpeg_decoder* decoder);
253253
* use @ref GPUJPEG_NONE to keep JPEG internal color space;
254254
* special value @ref GPUJPEG_CS_DEFAULT to decode RGB
255255
* (or luma for grayscale)
256-
* @param sampling_factor Requestd color sampling factor; special values
256+
* @param sampling_factor Requestd pixel format; special values
257257
* @ref decoder_pixfmt_placeholders can be used
258258
*/
259259
GPUJPEG_API void

0 commit comments

Comments
 (0)