- hb_log( "starting job" );
- hb_log( " + device %s", title->dvd );
- hb_log( " + title %d, chapter(s) %d to %d", title->index,
- job->chapter_start, job->chapter_end );
- if ( job->pixel_ratio == 1 )
- {
- /* Correct the geometry of the output movie when using PixelRatio */
- job->height=title->height-job->crop[0]-job->crop[1];
- job->width=title->width-job->crop[2]-job->crop[3];
- }
- else if ( job->pixel_ratio == 2 )
- {
- /* "Loose" anamorphic.
- - Uses mod16-compliant dimensions,
- - Allows users to set the width
- - Handles ITU pixel aspects
- */
- /* Use mod16 values for better compression */
- job->width = MULTIPLE_16( job->width );
- job->height = MULTIPLE_16( job->height );
- job->width = MAX( 16, job->width );
- job->height = MAX( 16, job->height );
-
- /* Set up some variables to make the math easier to follow. */
- int cropped_width = title->width - job->crop[2] - job->crop[3] ;
- int cropped_height = title->height - job->crop[0] - job->crop[1] ;
- int storage_aspect = cropped_width * HB_ASPECT_BASE / cropped_height;
- int pixels = job->width * (job->width / storage_aspect * HB_ASPECT_BASE);
-
- /* While keeping the DVD storage aspect, resize the job width and height
- so they fit into the user's specified dimensions. */
- hb_set_size(job, -1, pixels, 1);
-
- if (cropped_width <= 706)
- {
- /* Handle ITU PARs */
- if (title->height == 480)
- {
- /* It's NTSC */
- if (title->aspect == 16)
- {
- /* It's widescreen */
- job->pixel_aspect_width = 40;
- job->pixel_aspect_height = 33;
- }
- else
- {
- /*It's 4:3 */
- job->pixel_aspect_width = 10;
- job->pixel_aspect_height = 11;
- }
- }
- else if (title->height == 576)
- {
- /* It's PAL */
- if(title->aspect == 16)
- {
- /* It's widescreen */
- job->pixel_aspect_width = 16;
- job->pixel_aspect_height = 11;
- }
- else
- {
- /* It's 4:3 */
- job->pixel_aspect_width = 12;
- job->pixel_aspect_height = 11;
- }
- }
- }