screenshots: add option to disable JPEG 4:4:4 output

That's what it's usually about.
This commit is contained in:
wm4 2015-04-29 21:01:08 +02:00
parent 38114b6a36
commit f07c9b16f9
3 changed files with 11 additions and 2 deletions

View File

@ -2654,6 +2654,10 @@ Screenshot
``--screenshot-jpeg-quality=<0-100>``
Set the JPEG quality level. Higher means better quality. The default is 90.
``--screenshot-jpeg-source-chroma=<yes|no>``
Write JPEG files with the same chroma subsampling as the video
(default: yes). If disabled, the libjpeg default is used.
``--screenshot-png-compression=<0-9>``
Set the PNG compression level. Higher means better compression. This will
affect the file size of the written screenshot file and the time it takes

View File

@ -48,6 +48,7 @@ const struct image_writer_opts image_writer_opts_defaults = {
.jpeg_optimize = 100,
.jpeg_smooth = 0,
.jpeg_baseline = 1,
.jpeg_source_chroma = 1,
.tag_csp = 1,
};
@ -59,6 +60,7 @@ const struct m_sub_options image_writer_conf = {
OPT_INTRANGE("jpeg-optimize", jpeg_optimize, 0, 0, 100),
OPT_INTRANGE("jpeg-smooth", jpeg_smooth, 0, 0, 100),
OPT_FLAG("jpeg-baseline", jpeg_baseline, 0),
OPT_FLAG("jpeg-source-chroma", jpeg_source_chroma, 0),
OPT_INTRANGE("png-compression", png_compression, 0, 0, 9),
OPT_INTRANGE("png-filter", png_filter, 0, 0, 5),
OPT_STRING("format", format, 0),
@ -193,8 +195,10 @@ static bool write_jpeg(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp
cinfo.optimize_coding = ctx->opts->jpeg_optimize;
cinfo.smoothing_factor = ctx->opts->jpeg_smooth;
cinfo.comp_info[0].h_samp_factor = 1 << ctx->original_format.chroma_xs;
cinfo.comp_info[0].v_samp_factor = 1 << ctx->original_format.chroma_ys;
if (ctx->opts->jpeg_source_chroma) {
cinfo.comp_info[0].h_samp_factor = 1 << ctx->original_format.chroma_xs;
cinfo.comp_info[0].v_samp_factor = 1 << ctx->original_format.chroma_ys;
}
jpeg_start_compress(&cinfo, TRUE);

View File

@ -28,6 +28,7 @@ struct image_writer_opts {
int jpeg_dpi;
int jpeg_progressive;
int jpeg_baseline;
int jpeg_source_chroma;
int tag_csp;
};