OSDN Git Service

Organizes anamorphic parameters in a struct, requiring some minor search and replace...
authorjbrjake <jbrjake@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 26 Jan 2009 18:44:27 +0000 (18:44 +0000)
committerjbrjake <jbrjake@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 26 Jan 2009 18:44:27 +0000 (18:44 +0000)
git-svn-id: svn://localhost/HandBrake/trunk@2097 b64f7644-9d1e-0410-96f1-a4d463321fa5

15 files changed:
libhb/common.h
libhb/encavcodec.c
libhb/enctheora.c
libhb/encx264.c
libhb/encxvid.c
libhb/hb.c
libhb/muxavi.c
libhb/muxmkv.c
libhb/muxmp4.c
libhb/scan.c
libhb/work.c
macosx/Controller.mm
macosx/HBPreviewController.mm
macosx/PictureController.mm
test/test.c

index e037691..1121ae8 100644 (file)
@@ -147,10 +147,18 @@ struct hb_job_s
     int             height;
     int             keep_ratio;
     int             grayscale;
-    int             pixel_ratio;
-    int             pixel_aspect_width;
-    int             pixel_aspect_height;
-    int             modulus;
+
+    struct
+    {
+        int             mode;
+        int             modulus;
+        int             itu_par;
+        int             par_width;
+        int             par_height;
+        int             dar_width;
+        int             dar_height;
+    } anamorphic;
+    
     int             maxWidth;
     int             maxHeight;
 
index b0cf04e..22eb286 100644 (file)
@@ -106,13 +106,13 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job )
     context->gop_size  = 10 * job->vrate / job->vrate_base;
     context->pix_fmt   = PIX_FMT_YUV420P;
 
-    if( job->pixel_ratio )
+    if( job->anamorphic.mode )
     {
-        context->sample_aspect_ratio.num = job->pixel_aspect_width;
-        context->sample_aspect_ratio.den = job->pixel_aspect_height;
+        context->sample_aspect_ratio.num = job->anamorphic.par_width;
+        context->sample_aspect_ratio.den = job->anamorphic.par_height;
 
         hb_log( "encavcodec: encoding with stored aspect %d/%d",
-                job->pixel_aspect_width, job->pixel_aspect_height );
+                job->anamorphic.par_width, job->anamorphic.par_height );
     }
 
     if( job->mux & ( HB_MUX_MP4 | HB_MUX_PSP ) )
index bcc27eb..e340bad 100644 (file)
@@ -42,10 +42,10 @@ int enctheoraInit( hb_work_object_t * w, hb_job_t * job )
     ti.offset_x = ti.offset_y = 0;
     ti.fps_numerator = job->vrate;
     ti.fps_denominator = job->vrate_base;
-    if (job->pixel_ratio)
+    if( job->anamorphic.mode )
     {
-        ti.aspect_numerator = job->pixel_aspect_width;
-        ti.aspect_denominator = job->pixel_aspect_height;
+        ti.aspect_numerator = job->anamorphic.par_width;
+        ti.aspect_denominator = job->anamorphic.par_height;
     }
     else
     {
index 97de03e..eb8d842 100644 (file)
@@ -224,10 +224,10 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job )
         param.vui.i_colmatrix = 6;
     }
 
-    if( job->pixel_ratio )
+    if( job->anamorphic.mode )
     {
-        param.vui.i_sar_width = job->pixel_aspect_width;
-        param.vui.i_sar_height = job->pixel_aspect_height;
+        param.vui.i_sar_width  = job->anamorphic.par_width;
+        param.vui.i_sar_height = job->anamorphic.par_height;
 
         hb_log( "encx264: encoding with stored aspect %d/%d",
                 param.vui.i_sar_width, param.vui.i_sar_height );
index cb4ca01..6feadb7 100644 (file)
@@ -173,11 +173,11 @@ int encxvidWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
     frame.vol_flags = 0;
     frame.vop_flags = XVID_VOP_HALFPEL | XVID_VOP_INTER4V |
                       XVID_VOP_TRELLISQUANT | XVID_VOP_HQACPRED;
-    if( job->pixel_ratio )
+    if( job->anamorphic.mode )
     {
         frame.par = XVID_PAR_EXT;
-        frame.par_width = job->pixel_aspect_width;
-        frame.par_height = job->pixel_aspect_height;
+        frame.par_width  = job->anamorphic.par_width;
+        frame.par_height = job->anamorphic.par_height;
     }
 
     if( job->grayscale )
index 6c0aabc..08bea4b 100644 (file)
@@ -583,60 +583,20 @@ void hb_set_anamorphic_size( hb_job_t * job,
         int *output_width, int *output_height,
         int *output_par_width, int *output_par_height )
 {
-    /* "Loose" anamorphic.
-        - Uses mod16-compliant dimensions,
-        - Allows users to set the width
-        - Handles ITU pixel aspects
-    */
-
     /* Set up some variables to make the math easier to follow. */
     hb_title_t * title = job->title;
     int cropped_width = title->width - job->crop[2] - job->crop[3] ;
     int cropped_height = title->height - job->crop[0] - job->crop[1] ;
     double storage_aspect = (double)cropped_width / (double)cropped_height;
-    int width = job->width;
-    int height; // Gets set later, ignore user job->height value
-    int mod = job->modulus;
+    int mod = job->anamorphic.modulus ? job->anamorphic.modulus : 16;
     double aspect = title->aspect;
-
-    /* Gotta handle bounding dimensions differently
-       than for non-anamorphic encodes:
-       If the width is too big, just reset it with no rescaling.
-       Instead of using the aspect-scaled job height,
-       we need to see if the job width divided by the storage aspect
-       is bigger than the max. If so, set it to the max (this is sloppy).
-       If not, set job height to job width divided by storage aspect.
-    */
-
-    if ( job->maxWidth && (job->maxWidth < job->width) )
-        width = job->maxWidth;
-
-    height = ((double)width / storage_aspect) + 0.5;
-    if ( job->maxHeight && (job->maxHeight < height) )
-        height = job->maxHeight;
-
-    /* In case the user specified a modulus, use it */
-    if (job->modulus)
-        mod = job->modulus;
-    else
-        mod = 16;
-
-    /* Time to get picture dimensions that divide cleanly.*/
-    width  = MULTIPLE_MOD( width, mod);
-    height = MULTIPLE_MOD( height, mod);
-
-    /* Verify these new dimensions don't violate max height and width settings */
-    if ( job->maxWidth && (job->maxWidth < job->width) )
-        width = job->maxWidth;
-    if ( job->maxHeight && (job->maxHeight < height) )
-        height = job->maxHeight;
     
-    int pixel_aspect_width = job->pixel_aspect_width;
-    int pixel_aspect_height = job->pixel_aspect_height;
-    
-    /* If a source was really 704*480 and hard matted with cropping
-       to 720*480, replace the PAR values with the ITU broadcast ones. */
-    if (title->width == 720 && cropped_width <= 706)
+    int pixel_aspect_width  = job->anamorphic.par_width;
+    int pixel_aspect_height = job->anamorphic.par_height;
+
+    /* If a source was really NTSC or PAL and the user specified ITU PAR
+       values, replace the standard PAR values with the ITU broadcast ones. */
+    if( title->width == 720 && job->anamorphic.itu_par )
     {
         // convert aspect to a scaled integer so we can test for 16:9 & 4:3
         // aspect ratios ignoring insignificant differences in the LSBs of
@@ -678,20 +638,122 @@ void hb_set_anamorphic_size( hb_job_t * job,
         }
     }
 
-    /* Figure out what dimensions the source would display at. */
+    /* Figure out what width the source would display at. */
     int source_display_width = cropped_width * (double)pixel_aspect_width /
                                (double)pixel_aspect_height ;
-
-    /* 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;
-
-    /* Pass the results back to the caller */
-    *output_width = width;
-    *output_height = height;
-
+    
+    /*
+       3 different ways of deciding output dimensions:
+        - 1: Strict anamorphic, preserve source dimensions
+        - 2: Loose anamorphic, round to mod16 and preserve storage aspect ratio
+        - 3: Power user anamorphic, specify everything
+    */
+    int width, height;
+    switch( job->anamorphic.mode )
+    {
+        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;
+        break;
+
+        case 2:
+            /* "Loose" anamorphic.
+                - Uses mod16-compliant dimensions,
+                - Allows users to set the width
+            */
+            width = job->width;
+            height; // Gets set later, ignore user job->height value
+
+            /* Gotta handle bounding dimensions.
+               If the width is too big, just reset it with no rescaling.
+               Instead of using the aspect-scaled job height,
+               we need to see if the job width divided by the storage aspect
+               is bigger than the max. If so, set it to the max (this is sloppy).
+               If not, set job height to job width divided by storage aspect.
+            */
+
+            if ( job->maxWidth && (job->maxWidth < job->width) )
+                width = job->maxWidth;
+            height = ((double)width / storage_aspect) + 0.5;
+            
+            if ( job->maxHeight && (job->maxHeight < height) )
+                height = job->maxHeight;
+
+            /* Time to get picture dimensions that divide cleanly.*/
+            width  = MULTIPLE_MOD( width, mod);
+            height = MULTIPLE_MOD( height, mod);
+
+            /* Verify these new dimensions don't violate max height and width settings */
+            if ( job->maxWidth && (job->maxWidth < job->width) )
+                width = job->maxWidth;
+            if ( job->maxHeight && (job->maxHeight < height) )
+                height = job->maxHeight;
+
+            /* 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;
+
+            /* Pass the results back to the caller */
+            *output_width = width;
+            *output_height = height;
+        break;
+            
+        case 3:
+            /* Anamorphic 3: Power User Jamboree
+               - Set everything based on specified values */
+            
+            /* Use specified storage dimensions */
+            width = job->width;
+            height = job->height;
+            
+            /* Bind to max dimensions */
+            if( job->maxWidth && width > job->maxWidth )
+                width = job->maxWidth;
+            if( job->maxHeight && height > job->maxHeight )
+                height = job->maxHeight;
+            
+            /* Time to get picture dimensions that divide cleanly.*/
+            width  = MULTIPLE_MOD( width, mod);
+            height = MULTIPLE_MOD( height, mod);
+            
+            /* Verify we're still within max dimensions */
+            if( job->maxWidth && width > job->maxWidth )
+                width = job->maxWidth - (mod/2);
+            if( job->maxHeight && height > job->maxHeight )
+                height = job->maxHeight - (mod/2);
+                
+            /* Re-ensure we have picture dimensions that divide cleanly. */
+            width  = MULTIPLE_MOD( width, mod );
+            height = MULTIPLE_MOD( height, mod );
+            
+            /* That finishes the storage dimensions. On to display. */            
+            if( job->anamorphic.dar_width && job->anamorphic.dar_height )
+            {
+                /* We need to adjust the PAR to produce this aspect. */
+                pixel_aspect_width = height * job->anamorphic.dar_width / job->anamorphic.dar_height;
+                pixel_aspect_height = width;
+            }
+            else
+            {
+                /* We first need the display ar.
+                   That's the source display width divided by the source height after cropping.
+                   Then we multiple the output height by that to get the pixel aspect width,
+                   and the pixel aspect height is the storage width.*/
+                pixel_aspect_width = height * source_display_width / cropped_height;
+                pixel_aspect_height = width;
+            }
+            
+            /* Back to caller */
+            *output_width = width;
+            *output_height = height;
+        break;
+    }
+    
     /* While x264 is smart enough to reduce fractions on its own, libavcodec
        needs some help with the math, so lose superfluous factors.            */
     hb_reduce( output_par_width, output_par_height,
index 70d22f5..913e845 100644 (file)
@@ -394,7 +394,7 @@ static int AVIInit( hb_mux_object_t * m )
 
 #define g mux_data->vprp_header
     /* Vprp video stream header */     
-    AVRational sample_aspect_ratio = ( AVRational ){ job->pixel_aspect_width, job->pixel_aspect_height };
+    AVRational sample_aspect_ratio = ( AVRational ){ job->anamorphic.par_width, job->anamorphic.par_height };
     AVRational dar = av_mul_q( sample_aspect_ratio, ( AVRational ){ job->width, job->height } );
     int num, den;
     av_reduce(&num, &den, dar.num, dar.den, 0xFFFF);
@@ -490,7 +490,7 @@ static int AVIInit( hb_mux_object_t * m )
         /* video strf */
                sizeof( hb_bitmap_info_t ) +
         /* video vprp */
-        ( job->pixel_ratio ? sizeof( hb_avi_vprp_info_t ) : 0 ) +
+        ( job->anamorphic.mode ? sizeof( hb_avi_vprp_info_t ) : 0 ) +
         /* audios strf */
         audio_count * ( sizeof( hb_wave_formatex_t ) +
                         ( is_ac3 ? 0 : sizeof( hb_wave_mp3_t ) ) );
@@ -513,11 +513,11 @@ static int AVIInit( hb_mux_object_t * m )
     WriteInt32( m->file, FOURCC( "LIST" ) );
     WriteInt32( m->file, 4 + sizeof( hb_avi_stream_header_t ) +
                 sizeof( hb_bitmap_info_t )  +
-                ( job->pixel_ratio ? sizeof( hb_avi_vprp_info_t ) : 0 ) );
+                ( job->anamorphic.mode ? sizeof( hb_avi_vprp_info_t ) : 0 ) );
     WriteInt32( m->file, FOURCC( "strl" ) );
     WriteStreamHeader( m->file, &mux_data->header );
     WriteBitmapInfo( m->file, &mux_data->format.v );
-    if( job->pixel_ratio )
+    if( job->anamorphic.mode )
     {
         WriteVprpInfo( m->file, &mux_data->vprp_header );
     }
index 23d1b8a..a68e689 100644 (file)
@@ -138,9 +138,9 @@ static int MKVInit( hb_mux_object_t * m )
     track->extra.video.pixelWidth = job->width;
     track->extra.video.pixelHeight = job->height;
     track->extra.video.displayHeight = job->height;
-    if(job->pixel_ratio)
+    if( job->anamorphic.mode )
     {
-        track->extra.video.displayWidth = job->width * ((double)job->pixel_aspect_width / (double)job->pixel_aspect_height);
+        track->extra.video.displayWidth = job->width * ((double)job->anamorphic.par_width / (double)job->anamorphic.par_height);
     }
     else
     {
index 11523a9..1c82211 100644 (file)
@@ -183,14 +183,14 @@ static int MP4Init( hb_mux_object_t * m )
         MP4AddColr(m->file, mux_data->track, 6, 1, 6);
     }
 
-    if( job->pixel_ratio )
+    if( job->anamorphic.mode )
     {
         /* PASP atom for anamorphic video */
         float width, height;
 
-        width = job->pixel_aspect_width;
+        width  = job->anamorphic.par_width;
 
-        height = job->pixel_aspect_height;
+        height = job->anamorphic.par_height;
 
         MP4AddPixelAspectRatio(m->file, mux_data->track, (uint32_t)width, (uint32_t)height);
 
index 6cdaceb..aa91838 100644 (file)
@@ -192,14 +192,14 @@ static void ScanFunc( void * _data )
         /* Preserve a source's pixel aspect, if it's available. */
         if( title->pixel_aspect_width && title->pixel_aspect_height )
         {
-            job->pixel_aspect_width  = title->pixel_aspect_width;
-            job->pixel_aspect_height = title->pixel_aspect_height;
+            job->anamorphic.par_width  = title->pixel_aspect_width;
+            job->anamorphic.par_height = title->pixel_aspect_height;
         }
 
         if( title->aspect != 0 && title->aspect != 1. &&
-            !job->pixel_aspect_width && !job->pixel_aspect_height)
+            !job->anamorphic.par_width && !job->anamorphic.par_height)
         {
-            hb_reduce( &job->pixel_aspect_width, &job->pixel_aspect_height,
+            hb_reduce( &job->anamorphic.par_width, &job->anamorphic.par_height,
                        (int)(title->aspect * title->height + 0.5), title->width );
         }
 
index 0d57dd4..4ea0f5e 100644 (file)
@@ -202,15 +202,15 @@ void hb_display_job_info( hb_job_t * job )
             (float) title->rate / (float) title->rate_base, (float) job->vrate / (float) job->vrate_base );
     }
 
-    if( job->pixel_ratio )
+    if( job->anamorphic.mode )
     {
-        hb_log( "   + %s anamorphic", job->pixel_ratio == 1 ? "strict" : "loose" );
+        hb_log( "   + %s anamorphic", job->anamorphic.mode == 1 ? "strict" : "loose" );
         hb_log( "     + storage dimensions: %d * %d -> %d * %d, crop %d/%d/%d/%d",
                     title->width, title->height, job->width, job->height,
                     job->crop[0], job->crop[1], job->crop[2], job->crop[3] );
-        hb_log( "     + pixel aspect ratio: %i / %i", job->pixel_aspect_width, job->pixel_aspect_height );
+        hb_log( "     + pixel aspect ratio: %i / %i", job->anamorphic.par_width, job->anamorphic.par_height );
         hb_log( "     + display dimensions: %.0f * %i",
-            (float)( job->width * job->pixel_aspect_width / job->pixel_aspect_height ), job->height );
+            (float)( job->width * job->anamorphic.par_width / job->anamorphic.par_height ), job->height );
     }
     else
     {
@@ -365,45 +365,36 @@ static void do_job( hb_job_t * job, int cpu_count )
 
     hb_log( "starting job" );
 
-    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 )
+    if( job->anamorphic.mode )
     {
+        hb_set_anamorphic_size(job, &job->width, &job->height, &job->anamorphic.par_width, &job->anamorphic.par_height);
 
-        /* While keeping the DVD storage aspect, resize the job width and height
-           so they fit into the user's specified dimensions. */
-        hb_set_anamorphic_size(job, &job->width, &job->height, &job->pixel_aspect_width, &job->pixel_aspect_height);
-    }
-
-    if( job->pixel_ratio && job->vcodec == HB_VCODEC_FFMPEG)
-    {
-        /* Just to make working with ffmpeg even more fun,
-           lavc's MPEG-4 encoder can't handle PAR values >= 255,
-           even though AVRational does. Adjusting downwards
-           distorts the display aspect slightly, but such is life. */
-        while ((job->pixel_aspect_width & ~0xFF) ||
-               (job->pixel_aspect_height & ~0xFF))
+        if( job->vcodec == HB_VCODEC_FFMPEG )
         {
-            job->pixel_aspect_width >>= 1;
-            job->pixel_aspect_height >>= 1;
+            /* Just to make working with ffmpeg even more fun,
+               lavc's MPEG-4 encoder can't handle PAR values >= 255,
+               even though AVRational does. Adjusting downwards
+               distorts the display aspect slightly, but such is life. */
+            while ((job->anamorphic.par_width & ~0xFF) ||
+                   (job->anamorphic.par_height & ~0xFF))
+            {
+                job->anamorphic.par_width >>= 1;
+                job->anamorphic.par_height >>= 1;
+            }
         }
     }
-
+    
     /* Keep width and height within these boundaries,
        but ignore for anamorphic. For "loose" anamorphic encodes,
        this stuff is covered in the pixel_ratio section above.    */
-    if ( job->maxHeight && ( job->height > job->maxHeight ) && ( !job->pixel_ratio ) )
+    if ( job->maxHeight && ( job->height > job->maxHeight ) && ( !job->anamorphic.mode ) )
     {
         job->height = job->maxHeight;
         hb_fix_aspect( job, HB_KEEP_HEIGHT );
         hb_log( "Height out of bounds, scaling down to %i", job->maxHeight );
         hb_log( "New dimensions %i * %i", job->width, job->height );
     }
-    if ( job->maxWidth && ( job->width > job->maxWidth ) && ( !job->pixel_ratio ) )
+    if ( job->maxWidth && ( job->width > job->maxWidth ) && ( !job->anamorphic.mode ) )
     {
         job->width = job->maxWidth;
         hb_fix_aspect( job, HB_KEEP_WIDTH );
index 5c78de0..18f21ce 100644 (file)
@@ -1901,7 +1901,7 @@ fWorkingCount = 0;
        [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PictureWidth"];
        [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"];
        [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"];
-       [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->pixel_ratio] forKey:@"PicturePAR"];
+       [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.mode] forKey:@"PicturePAR"];
     NSString * pictureSummary;
     pictureSummary = [NSString stringWithFormat:@"Source: %@ Output: %@ Anamorphic: %@", 
                      [fPicSettingsSrc stringValue], 
@@ -1996,7 +1996,7 @@ fWorkingCount = 0;
        [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PictureWidth"];
        [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"];
        [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"];
-       [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->pixel_ratio] forKey:@"PicturePAR"];
+       [queueFileJob setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.mode] forKey:@"PicturePAR"];
     
     /* Set crop settings here */
        [queueFileJob setObject:[NSNumber numberWithInt:[fPictureController autoCrop]] forKey:@"PictureAutoCrop"];
@@ -2410,7 +2410,7 @@ fWorkingCount = 0;
             hb_fix_aspect( job, HB_KEEP_HEIGHT );
         }
     }
-    job->pixel_ratio = [[queueToApply objectForKey:@"PicturePAR"]  intValue];
+    job->anamorphic.mode = [[queueToApply objectForKey:@"PicturePAR"]  intValue];
     
     
     /* If Cropping is set to custom, then recall all four crop values from
@@ -3012,7 +3012,7 @@ fWorkingCount = 0;
     job->height = [[queueToApply objectForKey:@"PictureHeight"]  intValue];
     
     job->keep_ratio = [[queueToApply objectForKey:@"PictureKeepRatio"]  intValue];
-    job->pixel_ratio = [[queueToApply objectForKey:@"PicturePAR"]  intValue];
+    job->anamorphic.mode = [[queueToApply objectForKey:@"PicturePAR"]  intValue];
     
     
     /* Here we use the crop values saved at the time the preset was saved */
@@ -3890,9 +3890,9 @@ the user is using "Custom" settings by determining the sender*/
     to use the index itself but this is easier */
     if (videoEncoder == HB_VCODEC_FFMPEG)
     {
-        if (job->pixel_ratio == 2)
+        if (job->anamorphic.mode == 2)
         {
-            job->pixel_ratio = 0;
+            job->anamorphic.mode = 0;
         }
         [fPictureController setAllowLooseAnamorphic:NO];
         /* We set the iPod atom checkbox to disabled and uncheck it as its only for x264 in the mp4
@@ -4139,18 +4139,18 @@ the user is using "Custom" settings by determining the sender*/
 {
        [fPicSettingsOutp setStringValue: [NSString stringWithFormat:@"%d x %d", fTitle->job->width, fTitle->job->height]];
        
-    if (fTitle->job->pixel_ratio == 1)
+    if (fTitle->job->anamorphic.mode == 1)
        {
         int titlewidth = fTitle->width-fTitle->job->crop[2]-fTitle->job->crop[3];
-        int arpwidth = fTitle->job->pixel_aspect_width;
-        int arpheight = fTitle->job->pixel_aspect_height;
+        int arpwidth = fTitle->job->anamorphic.par_width;
+        int arpheight = fTitle->job->anamorphic.par_height;
         int displayparwidth = titlewidth * arpwidth / arpheight;
         int displayparheight = fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1];
         [fPicSettingsOutp setStringValue: [NSString stringWithFormat:@"%d x %d", titlewidth, displayparheight]];
         [fPicSettingsAnamorphic setStringValue: [NSString stringWithFormat:@"%d x %d Strict", displayparwidth, displayparheight]];
         fTitle->job->keep_ratio = 0;
        }
-    else if (fTitle->job->pixel_ratio == 2)
+    else if (fTitle->job->anamorphic.mode == 2)
     {
         hb_job_t * job = fTitle->job;
         int output_width, output_height, output_par_width, output_par_height;
@@ -4249,7 +4249,7 @@ the user is using "Custom" settings by determining the sender*/
         [fPicSettingDeblock setStringValue: [NSString stringWithFormat:@"%d",[fPictureController deblock]]];
     }
        
-       if (fTitle->job->pixel_ratio > 0)
+       if (fTitle->job->anamorphic.mode > 0)
        {
                [fPicSettingPAR setStringValue: @""];
        }
@@ -5782,7 +5782,7 @@ return YES;
                         hb_fix_aspect( job, HB_KEEP_HEIGHT );
                     }
                 }
-                job->pixel_ratio = [[chosenPreset objectForKey:@"PicturePAR"]  intValue];
+                job->anamorphic.mode = [[chosenPreset objectForKey:@"PicturePAR"]  intValue];
             }
             else // /* If not 0 or 2 we assume objectForKey:@"UsesPictureSettings is 1 which is "Use picture sizing from when the preset was set" */
             {
@@ -5810,7 +5810,7 @@ return YES;
                         hb_fix_aspect( job, HB_KEEP_HEIGHT );
                     }
                 }
-                job->pixel_ratio = [[chosenPreset objectForKey:@"PicturePAR"]  intValue];
+                job->anamorphic.mode = [[chosenPreset objectForKey:@"PicturePAR"]  intValue];
                 
             }
             
@@ -6063,7 +6063,7 @@ return YES;
         [preset setObject:[NSNumber numberWithInt:fTitle->job->width] forKey:@"PictureWidth"];
         [preset setObject:[NSNumber numberWithInt:fTitle->job->height] forKey:@"PictureHeight"];
         [preset setObject:[NSNumber numberWithInt:fTitle->job->keep_ratio] forKey:@"PictureKeepRatio"];
-        [preset setObject:[NSNumber numberWithInt:fTitle->job->pixel_ratio] forKey:@"PicturePAR"];
+        [preset setObject:[NSNumber numberWithInt:fTitle->job->anamorphic.mode] forKey:@"PicturePAR"];
         
         /* Set crop settings here */
         [preset setObject:[NSNumber numberWithInt:[fPictureController autoCrop]] forKey:@"PictureAutoCrop"];
index 6a50d46..dfcf554 100644 (file)
@@ -218,17 +218,17 @@ MaxOutputWidth = title->width - job->crop[2] - job->crop[3];
        
     NSSize displaySize = NSMakeSize( ( CGFloat )fTitle->width, ( CGFloat )fTitle->height );
     /* Set the picture size display fields below the Preview Picture*/
-    if( fTitle->job->pixel_ratio == 1 ) // Original PAR Implementation
+    if( fTitle->job->anamorphic.mode == 1 ) // Original PAR Implementation
     {
         output_width = fTitle->width-fTitle->job->crop[2]-fTitle->job->crop[3];
         output_height = fTitle->height-fTitle->job->crop[0]-fTitle->job->crop[1];
-        display_width = output_width * fTitle->job->pixel_aspect_width / fTitle->job->pixel_aspect_height;
+        display_width = output_width * fTitle->job->anamorphic.par_width / fTitle->job->anamorphic.par_height;
         [fInfoField setStringValue:[NSString stringWithFormat:
                                     @"Source: %dx%d, Output: %dx%d, Anamorphic: %dx%d",
                                     fTitle->width, fTitle->height, output_width, output_height, display_width, output_height]];
-        displaySize.width *= ( ( CGFloat )fTitle->job->pixel_aspect_width ) / ( ( CGFloat )fTitle->job->pixel_aspect_height );   
+        displaySize.width *= ( ( CGFloat )fTitle->job->anamorphic.par_width ) / ( ( CGFloat )fTitle->job->anamorphic.par_height );   
     }
-    else if (fTitle->job->pixel_ratio == 2) // Loose Anamorphic
+    else if (fTitle->job->anamorphic.mode == 2) // Loose Anamorphic
     {
     hb_set_anamorphic_size(job, &output_width, &output_height, &output_par_width, &output_par_height);
         display_width = output_width * output_par_width / output_par_height;
@@ -251,8 +251,8 @@ MaxOutputWidth = title->width - job->crop[2] - job->crop[3];
     {
         /* In the case of loose anamorphic, do not resize the window when scaling down */
         // FIX ME: we need a new way to do this as we do not havefWidthField anymore
-        //if (fTitle->job->pixel_ratio != 2 || [fWidthField intValue] == fTitle->width)
-        if (fTitle->job->pixel_ratio != 2 || (fTitle->job->pixel_ratio == 2 && output_width == fTitle->width))
+        //if (fTitle->job->anamorphic.mode != 2 || [fWidthField intValue] == fTitle->width)
+        if (fTitle->job->anamorphic.mode != 2 || (fTitle->job->anamorphic.mode == 2 && output_width == fTitle->width))
         {
             [self resizeSheetForViewSize:viewSize];
             [self setViewSize:viewSize];
index 9cf4010..e93840c 100644 (file)
     {
     [fAnamorphicPopUp addItemWithTitle: @"Loose"];
     }
-    [fAnamorphicPopUp selectItemAtIndex: job->pixel_ratio];
+    [fAnamorphicPopUp selectItemAtIndex: job->anamorphic.mode];
     
     /* We initially set the previous state of keep ar to on */
     keepAspectRatioPreviousState = 1;
@@ -253,7 +253,7 @@ are maintained across different sources */
        {
         if ([fAnamorphicPopUp indexOfSelectedItem] == 2) // Loose anamorphic
         {
-            job->pixel_ratio = 2;
+            job->anamorphic.mode = 2;
             [fWidthStepper setEnabled: YES];
             [fWidthField setEnabled: YES];
             /* We set job->width and call hb_set_anamorphic_size in libhb to do a "dry run" to get
@@ -286,7 +286,7 @@ are maintained across different sources */
             job->width       = [fWidthStepper  intValue];
             job->height      = [fHeightStepper intValue];
             
-            job->pixel_ratio = 1;
+            job->anamorphic.mode = 1;
             [fWidthStepper setEnabled: NO];
             [fWidthField setEnabled: NO];
         }
@@ -309,7 +309,7 @@ are maintained across different sources */
        {
         job->width       = [fWidthStepper  intValue];
         job->height      = [fHeightStepper intValue];
-        job->pixel_ratio = 0;
+        job->anamorphic.mode = 0;
         [fWidthStepper setEnabled: YES];
         [fWidthField setEnabled: YES];
         [fHeightStepper setEnabled: YES];
index a04897c..2c24d4c 100644 (file)
@@ -1137,21 +1137,21 @@ static int HandleEvents( hb_handle_t * h )
             job->grayscale   = grayscale;
             if (loosePixelratio)
             {
-                job->pixel_ratio = 2;
+                job->anamorphic.mode = 2;
                 if (modulus)
                 {
-                    job->modulus = modulus;
+                    job->anamorphic.modulus = modulus;
                 }
                 if( par_width && par_height )
                 {
-                    job->pixel_ratio = 3;
-                    job->pixel_aspect_width = par_width;
-                    job->pixel_aspect_height = par_height;
+                    job->anamorphic.mode = 3;
+                    job->anamorphic.par_width = par_width;
+                    job->anamorphic.par_height = par_height;
                 }
             }
             else
             {
-                job->pixel_ratio = pixelratio;
+                job->anamorphic.mode = pixelratio;
             }
 
             /* Add selected filters */