diff options
author | jstebbins <[email protected]> | 2010-12-17 16:31:54 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2010-12-17 16:31:54 +0000 |
commit | 3bc190cb636fc3d5e9bff79b0b0be534a5d1d2d3 (patch) | |
tree | d0663976f20158be6967c1f8c8ae64012d9c671e | |
parent | 8289b05efce0dcbe22881abd2a060b3998641cdf (diff) |
prevent crash with strict ana and non-mod-2 dimensions.
and make par computation in loose ana a little more accurate.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3710 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | libhb/hb.c | 14 | ||||
-rw-r--r-- | libhb/work.c | 1 |
2 files changed, 9 insertions, 6 deletions
diff --git a/libhb/hb.c b/libhb/hb.c index 3d669f2b2..da09ea0a6 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -963,10 +963,12 @@ void hb_set_anamorphic_size( hb_job_t * job, { case 1: /* Strict anamorphic */ - *output_width = cropped_width; - *output_height = cropped_height; - *output_par_width = title->pixel_aspect_width; - *output_par_height = title->pixel_aspect_height; + *output_width = MULTIPLE_MOD( cropped_width, 2 ); + *output_height = MULTIPLE_MOD( cropped_height, 2 ); + // adjust the source PAR for new width/height + // new PAR = source PAR * ( old width / new_width ) * ( new_height / old_height ) + pixel_aspect_width = title->pixel_aspect_width * cropped_width * (*output_height); + pixel_aspect_height = title->pixel_aspect_height * (*output_width) * cropped_height; break; case 2: @@ -1007,8 +1009,8 @@ void hb_set_anamorphic_size( hb_job_t * job, /* The film AR is the source's display width / cropped source height. The output display width is the output height * film AR. The output PAR is the output display width / output storage width. */ - pixel_aspect_width = height * source_display_width / cropped_height; - pixel_aspect_height = width; + pixel_aspect_width = height * cropped_width * pixel_aspect_width; + pixel_aspect_height = width * cropped_height * pixel_aspect_height; /* Pass the results back to the caller */ *output_width = width; diff --git a/libhb/work.c b/libhb/work.c index cf8d4d464..9504d4dd3 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -449,6 +449,7 @@ static void do_job( hb_job_t * job, int cpu_count ) job->anamorphic.par_width >>= 1; job->anamorphic.par_height >>= 1; } + hb_reduce( &job->anamorphic.par_width, &job->anamorphic.par_height, job->anamorphic.par_width, job->anamorphic.par_height ); } } |