githubのコードからのfolk
修订版 | bd48bff38ee978ac17f47f9302c90ffa9d7cefe7 (tree) |
---|---|
时间 | 2010-12-18 01:31:54 |
作者 | jstebbins <jstebbins@b64f...> |
Commiter | jstebbins |
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://localhost/HandBrake/trunk@3710 b64f7644-9d1e-0410-96f1-a4d463321fa5
@@ -963,10 +963,12 @@ void hb_set_anamorphic_size( hb_job_t * job, | ||
963 | 963 | { |
964 | 964 | case 1: |
965 | 965 | /* Strict anamorphic */ |
966 | - *output_width = cropped_width; | |
967 | - *output_height = cropped_height; | |
968 | - *output_par_width = title->pixel_aspect_width; | |
969 | - *output_par_height = title->pixel_aspect_height; | |
966 | + *output_width = MULTIPLE_MOD( cropped_width, 2 ); | |
967 | + *output_height = MULTIPLE_MOD( cropped_height, 2 ); | |
968 | + // adjust the source PAR for new width/height | |
969 | + // new PAR = source PAR * ( old width / new_width ) * ( new_height / old_height ) | |
970 | + pixel_aspect_width = title->pixel_aspect_width * cropped_width * (*output_height); | |
971 | + pixel_aspect_height = title->pixel_aspect_height * (*output_width) * cropped_height; | |
970 | 972 | break; |
971 | 973 | |
972 | 974 | case 2: |
@@ -1007,8 +1009,8 @@ void hb_set_anamorphic_size( hb_job_t * job, | ||
1007 | 1009 | /* The film AR is the source's display width / cropped source height. |
1008 | 1010 | The output display width is the output height * film AR. |
1009 | 1011 | The output PAR is the output display width / output storage width. */ |
1010 | - pixel_aspect_width = height * source_display_width / cropped_height; | |
1011 | - pixel_aspect_height = width; | |
1012 | + pixel_aspect_width = height * cropped_width * pixel_aspect_width; | |
1013 | + pixel_aspect_height = width * cropped_height * pixel_aspect_height; | |
1012 | 1014 | |
1013 | 1015 | /* Pass the results back to the caller */ |
1014 | 1016 | *output_width = width; |
@@ -449,6 +449,7 @@ static void do_job( hb_job_t * job, int cpu_count ) | ||
449 | 449 | job->anamorphic.par_width >>= 1; |
450 | 450 | job->anamorphic.par_height >>= 1; |
451 | 451 | } |
452 | + hb_reduce( &job->anamorphic.par_width, &job->anamorphic.par_height, job->anamorphic.par_width, job->anamorphic.par_height ); | |
452 | 453 | } |
453 | 454 | } |
454 | 455 |