Skip to content

Commit 49c9cd1

Browse files
committed
updated FAQ.md
1 parent a8b806b commit 49c9cd1

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

FAQ.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ You can also benchmark and find the potential bottleneck by running:
7272
Decode Image: 609.70 ms
7373
Save Image: 139.37 ms
7474

75-
which shows duration of individual decoding steps.
75+
which shows duration of individual decoding steps (use `-n <iter>` to see
76+
duration of more iterations with the same image).
7677

7778
## Encoding different color spaces than full-range YCbCr BT.601
7879
For compatibility reasons, GPUJPEG produces a full-range **YCbCr BT.601** with **JFIF**
@@ -92,6 +93,10 @@ color space, it cannot be changed by the app now). The relevant option is "**-N*
9293

9394
gpujpeg -s 1920x1080 -N -e image.rgb image.jpg
9495

96+
**Note:** **SPIFF** is not a widely adopted format of _JPEG_ files so is
97+
hightly probable that the decoder other than GPUJPEG won't support the picture
98+
and will ignore the color-space information.
99+
95100
## Optimizing encoding/decoding performance
96101
To optimze encoding/decoding performance, following features can be tweaked (in order of importance):
97102

@@ -141,18 +146,29 @@ and 0x01, 0x02, 0x03, 0x04).
141146

142147
### API for alpha
143148
#### Encode
144-
Encoding alpha is quite simple, as indicated above, just set the pixel format `GPUJPEG_444_U8_P012A`
145-
as `gpujpeg_image_parameters::pixel_format` and `gpujpeg_image_parameters` to **4**.
149+
Encoding alpha is quite simple, as indicated above, just set the pixel format `GPUJPEG_444_U8_P0123`
150+
as `gpujpeg_image_parameters::pixel_format` and set subsampling to _4:4:4:4_ :
151+
`gpujpeg_parameters_chroma_subsampling(param, GPUJPEG_SUBSAMPLING_4444);`.`
146152

147153
#### Decode
148-
Select output pixel format either `GPUJPEG_444_U8_P012A` or `GPUJPEG_NONE` (autodetect).
154+
Select output pixel format either `GPUJPEG_444_U8_P0123` or
155+
`GPUJPEG_PIXFMT_AUTODETECT` (RGB will be used if set to GPUJPEG_PIXFMT_NONE).
149156

150157
## What are memory requirements for encoding/decoding
151158

152-
Currently you can compute something like 20 bytes for every pixel and component for both
153-
encode and decode, eg. for 33 Mpix 4:4:4 frame it is 7680x4320x3x20=1901 MiB. If the JPEG
154-
was 4:2:0 subsampled, the memory requirements would be halfway.
159+
Currently you can count about _20 bytes_ of **GPU memory** for every
160+
_pixel and component_ for both encode and decode, eg. for 33 Mpix 4:4:4
161+
frame it is _7680x4320x3x20=1901 MiB_. If the JPEG is 4:2:0 subsampled,
162+
the memory requirements would be halfway.
163+
164+
You can check the amount of required GPU memory by running (adjust the
165+
image format and parameters according to your needs):
166+
167+
$ gpujpegtool -v -e 1920x1080.tst /dev/null # or output file "nul" in MSW
168+
$ gpujpegtool -v -S -N -ai -r 16 -e 1920x1080.p_4444-u8-p0123.tst /dev/null
169+
...
170+
Total GPU Memory Size: 102.6 MiB
155171

156-
The memory requirements may be excessive if dealing with really huge images - let us know
157-
if there is a problem with this.
172+
The memory requirements may be excessive if dealing with really huge
173+
images - let us know if there is a problem with this.
158174

0 commit comments

Comments
 (0)