summaryrefslogtreecommitdiffstats
path: root/gtk/src
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2009-03-03 18:09:17 +0000
committerjstebbins <[email protected]>2009-03-03 18:09:17 +0000
commitdf20c24f9308bea08a200bc59269a724737b92da (patch)
tree6a428273ee7ce966b51ab2edff2f3e625fc3a8d5 /gtk/src
parent5fa5adbad9989eb4fa495c5737fad06ed3f925c0 (diff)
LinGui:
- fix picture preview scaling problem - change how contrib libs are referenced in gtk build system git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2211 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src')
-rw-r--r--gtk/src/Makefile.am42
-rw-r--r--gtk/src/hb-backend.c55
2 files changed, 50 insertions, 47 deletions
diff --git a/gtk/src/Makefile.am b/gtk/src/Makefile.am
index f30331241..e20d5be93 100644
--- a/gtk/src/Makefile.am
+++ b/gtk/src/Makefile.am
@@ -1,27 +1,27 @@
## Process this file with automake to produce Makefile.in
HB_LIBS=\
- $(HB_DIR)/libhb/libhb.a \
- $(HB_DIR)/contrib/lib/liba52.a \
- $(HB_DIR)/contrib/lib/libmkv.a \
- $(HB_DIR)/contrib/lib/libavformat.a \
- $(HB_DIR)/contrib/lib/libavcodec.a \
- $(HB_DIR)/contrib/lib/libavutil.a \
- $(HB_DIR)/contrib/lib/libdca.a \
- $(HB_DIR)/contrib/lib/libdvdread.a \
- $(HB_DIR)/contrib/lib/libfaac.a \
- $(HB_DIR)/contrib/lib/libmp3lame.a \
- $(HB_DIR)/contrib/lib/libmpeg2.a \
- $(HB_DIR)/contrib/lib/libvorbis.a \
- $(HB_DIR)/contrib/lib/libvorbisenc.a \
- $(HB_DIR)/contrib/lib/libogg.a \
- $(HB_DIR)/contrib/lib/libsamplerate.a \
- $(HB_DIR)/contrib/lib/libx264.a \
- $(HB_DIR)/contrib/lib/libxvidcore.a \
- $(HB_DIR)/contrib/lib/libmp4v2.a \
- $(HB_DIR)/contrib/lib/libswscale.a \
- $(HB_DIR)/contrib/lib/libtheora.a \
- $(HB_DIR)/contrib/lib/libfaad.a \
+ -lhb \
+ -la52 \
+ -lmkv \
+ -lavformat \
+ -lavcodec \
+ -lavutil \
+ -ldca \
+ -ldvdread \
+ -lfaac \
+ -lmp3lame \
+ -lmpeg2 \
+ -lvorbis \
+ -lvorbisenc \
+ -logg \
+ -lsamplerate \
+ -lx264 \
+ -lxvidcore \
+ -lmp4v2 \
+ -lswscale \
+ -ltheora \
+ -lfaad \
-lz \
-lbz2 \
-lpthread
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 94dead4a5..8c16b3fcd 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -2539,8 +2539,7 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
gboolean keep_height = (mode == GHB_SCALE_KEEP_HEIGHT);
gint step;
GtkWidget *widget;
- gint modshift;
- gint modround;
+ gint mod;
gint max_width = 0;
gint max_height = 0;
@@ -2573,8 +2572,7 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
// Align dimensions to either 16 or 2 pixels
// The scaler crashes if the dimensions are not divisible by 2
// x264 also will not accept dims that are not multiple of 2
- modshift = round_dims ? 4 : 1;
- modround = round_dims ? 8 : 1;
+ mod = round_dims ? 16 : 2;
if (autoscale)
{
keep_width = FALSE;
@@ -2607,8 +2605,9 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
// Adjust the cropping to accomplish the desired width and height
crop_width = tinfo.width - crop[2] - crop[3];
crop_height = tinfo.height - crop[0] - crop[1];
- width = (crop_width >> modshift) << modshift;
- height = (crop_height >> modshift) << modshift;
+ width = MULTIPLE_MOD(crop_width, mod);
+ height = MULTIPLE_MOD(crop_height, mod);
+
need1 = (crop_height - height) / 2;
need2 = crop_height - height - need1;
crop[0] += need1;
@@ -2646,9 +2645,6 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
height = ghb_settings_get_int(ud->settings, "scale_height");
max_width = ghb_settings_get_int(ud->settings, "PictureWidth");
max_height = ghb_settings_get_int(ud->settings, "PictureHeight");
- // Align max dims
- max_width = (max_width >> modshift) << modshift;
- max_height = (max_height >> modshift) << modshift;
// Adjust dims according to max values
if (!max_height)
{
@@ -2658,15 +2654,24 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
{
max_width = crop_width;
}
- height = MIN(height, max_height);
- width = MIN(width, max_width);
+ // Align max dims
+ max_width = MULTIPLE_MOD(max_width, mod);
+ max_height = MULTIPLE_MOD(max_height, mod);
g_debug("max_width %d, max_height %d\n", max_width, max_height);
}
+
if (width < 16)
width = title->width - crop[2] - crop[3];
if (height < 16)
height = title->height - crop[0] - crop[1];
+ width = MULTIPLE_MOD(width, mod);
+ height = MULTIPLE_MOD(height, mod);
+ if (max_height)
+ height = MIN(height, max_height);
+ if (max_width)
+ width = MIN(width, max_width);
+
if (anamorphic)
{
job->anamorphic.mode = autoscale ? 2 : 3;
@@ -2729,8 +2734,8 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
}
g_debug("new w %d h %d\n", width, height);
}
- width = ((width + modround) >> modshift) << modshift;
- height = ((height + modround) >> modshift) << modshift;
+ width = MULTIPLE_MOD(width, mod);
+ height = MULTIPLE_MOD(height, mod);
}
ghb_ui_update(ud, "scale_width", ghb_int64_value(width));
ghb_ui_update(ud, "scale_height", ghb_int64_value(height));
@@ -3774,6 +3779,16 @@ ghb_get_preview_image(
if (title->job->height > title->height)
title->job->height = title->height;
+
+ // hb_get_preview doesn't compensate for anamorphic, so lets
+ // calculate scale factors
+ gint width, height, par_width = 1, par_height = 1;
+ gboolean anamorphic = ghb_settings_get_boolean(settings, "anamorphic");
+ if (anamorphic)
+ {
+ hb_set_anamorphic_size( title->job, &width, &height, &par_width, &par_height );
+ }
+
// And also creates artifacts if the width is not a multiple of 8
//title->job->width = ((title->job->width + 4) >> 3) << 3;
// And the height must be a multiple of 2
@@ -3870,19 +3885,7 @@ ghb_get_preview_image(
dst += stride;
src += (srcWidth - dstWidth); // skip to next row in src
}
- // Got it, but hb_get_preview doesn't compensate for anamorphic, so lets
- // scale
- gint width, height, par_width, par_height;
- gboolean anamorphic = ghb_settings_get_boolean(settings, "anamorphic");
- if (anamorphic)
- {
- hb_set_anamorphic_size( title->job, &width, &height, &par_width, &par_height );
- ghb_par_scale(ud, &dstWidth, &dstHeight, par_width, par_height);
- }
- else
- {
- ghb_par_scale(ud, &dstWidth, &dstHeight, 1, 1);
- }
+ ghb_par_scale(ud, &dstWidth, &dstHeight, par_width, par_height);
*out_width = dstWidth;
*out_height = dstHeight;
if (ghb_settings_get_boolean(settings, "reduce_hd_preview"))