[MPlayer-cvslog] CVS: main/libvo vo_jpeg.c,1.29,1.30
Atmosfear
syncmail at mplayerhq.hu
Fri Jan 20 02:37:17 CET 2006
CVS change done by Atmosfear
Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv7716/libvo
Modified Files:
vo_jpeg.c
Log Message:
Added DPI (Print-Resolution) and Pixel-Aspect awareness to vo_jpeg.
Use -noaspect if you want Square-Px AR for anamorphic content (old behaviour).
Note: Many applications might ignore these settings, but they matter for
print design and video editing (Tested with Photoshop).
Index: vo_jpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_jpeg.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- vo_jpeg.c 5 Aug 2005 01:24:36 -0000 1.29
+++ vo_jpeg.c 20 Jan 2006 01:37:15 -0000 1.30
@@ -67,12 +67,15 @@
static int image_width;
static int image_height;
+static int image_d_width;
+static int image_d_height;
int jpeg_baseline = 1;
int jpeg_progressive_mode = 0;
int jpeg_optimize = 100;
int jpeg_smooth = 0;
int jpeg_quality = 75;
+int jpeg_dpi = 72; /** Screen resolution = 72 dpi */
char *jpeg_outdir = NULL;
char *jpeg_subdirs = NULL;
int jpeg_maxfiles = 1000;
@@ -158,6 +161,9 @@
image_height = height;
image_width = width;
+ /* Save for JFIF-Header PAR */
+ image_d_width = d_width;
+ image_d_height = d_height;
return 0;
}
@@ -190,8 +196,19 @@
cinfo.image_height = image_height;
cinfo.input_components = 3;
cinfo.in_color_space = JCS_RGB;
-
+
jpeg_set_defaults(&cinfo);
+ /* Important: Header info must be set AFTER jpeg_set_defaults() */
+ cinfo.write_JFIF_header = TRUE;
+ cinfo.JFIF_major_version = 1;
+ cinfo.JFIF_minor_version = 2;
+ cinfo.density_unit = 1; /* 0=unknown, 1=dpi, 2=dpcm */
+ /* Image DPI is determined by Y_density, so we leave that at
+ jpeg_dpi if possible and crunch X_density instead (PAR > 1) */
+ cinfo.X_density = jpeg_dpi*image_width/image_d_width;
+ cinfo.Y_density = jpeg_dpi*image_height/image_d_height;
+ cinfo.write_Adobe_marker = TRUE;
+
jpeg_set_quality(&cinfo,jpeg_quality, jpeg_baseline);
cinfo.optimize_coding = jpeg_optimize;
cinfo.smoothing_factor = jpeg_smooth;
@@ -324,6 +341,7 @@
(opt_test_f)int_zero_hundred, 0},
{"quality", OPT_ARG_INT, &jpeg_quality,
(opt_test_f)int_zero_hundred, 0},
+ {"dpi", OPT_ARG_INT, &jpeg_dpi, NULL, 0},
{"outdir", OPT_ARG_MSTRZ, &jpeg_outdir, NULL, 0},
{"subdirs", OPT_ARG_MSTRZ, &jpeg_subdirs, NULL, 0},
{"maxfiles", OPT_ARG_INT, &jpeg_maxfiles, (opt_test_f)int_pos, 0},
@@ -361,6 +379,8 @@
jpeg_smooth);
mp_msg(MSGT_VO, MSGL_V, "%s: quality --> %d\n", info.short_name,
jpeg_quality);
+ mp_msg(MSGT_VO, MSGL_V, "%s: dpi --> %d\n", info.short_name,
+ jpeg_dpi);
mp_msg(MSGT_VO, MSGL_V, "%s: outdir --> %s\n", info.short_name,
jpeg_outdir);
if (jpeg_subdirs) {
More information about the MPlayer-cvslog
mailing list