We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3039217 commit 3b3db8bCopy full SHA for 3b3db8b
src/main.c
@@ -193,7 +193,11 @@ adjust_params(struct gpujpeg_parameters* param, struct gpujpeg_image_parameters*
193
}
194
195
if ( opts->keep_alpha && encode && param_image->pixel_format == GPUJPEG_4444_U8_P0123 ) {
196
- gpujpeg_parameters_chroma_subsampling(param, GPUJPEG_SUBSAMPLING_4444);
+ gpujpeg_sampling_factor_t subs = GPUJPEG_SUBSAMPLING_4444;
197
+ if ( opts->subsampling != GPUJPEG_SUBSAMPLING_UNKNOWN && (opts->subsampling & 0xFF) == 0 ) {
198
+ subs = opts->subsampling | opts->subsampling >> 24; // copy Y samp factor to alpha
199
+ }
200
+ gpujpeg_parameters_chroma_subsampling(param, subs);
201
202
203
if (encode && (param_image->width <= 0 || param_image->height <= 0)) {
0 commit comments