summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodeo <[email protected]>2012-04-10 14:15:29 +0000
committerRodeo <[email protected]>2012-04-10 14:15:29 +0000
commit9b3008bfb0e1902e4ab01b680c7475d1630e9544 (patch)
tree7b5440de111ca13beb33f958e1f212be7a17a198
parent1908ceb760de50f2be2ea874926d9c7a0c28c9f5 (diff)
Revision 4546 lost a call to hb_set_anamorphic_size, which in turn called hb_reduce on PAR values. Restore the call to hb_reduce, as the MacGui's custom anamorphic code doesn't reduce fractions on its own.
Also, call hb_reduce after each modification to the PAR in libavcodec compatibility code. This should reduce the loss of precision somewhat, by avoiding another division when the divided PAR width & height can be reduced to values <= 255. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4583 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--libhb/hb.c2
-rw-r--r--libhb/work.c19
2 files changed, 13 insertions, 8 deletions
diff --git a/libhb/hb.c b/libhb/hb.c
index a9e76b926..1dda37578 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -1209,7 +1209,7 @@ void hb_set_anamorphic_size( hb_job_t * job,
}
/* While x264 is smart enough to reduce fractions on its own, libavcodec
- needs some help with the math, so lose superfluous factors. */
+ * needs some help with the math, so lose superfluous factors. */
hb_reduce( output_par_width, output_par_height,
pixel_aspect_width, pixel_aspect_height );
}
diff --git a/libhb/work.c b/libhb/work.c
index c26739a31..7ea9878bf 100644
--- a/libhb/work.c
+++ b/libhb/work.c
@@ -567,19 +567,24 @@ static void do_job( hb_job_t * job )
if( job->anamorphic.mode )
{
+ /* While x264 is smart enough to reduce fractions on its own, libavcodec and
+ * the MacGUI need some help with the math, so lose superfluous factors. */
+ hb_reduce( &job->anamorphic.par_width, &job->anamorphic.par_height,
+ job->anamorphic.par_width, job->anamorphic.par_height );
if( job->vcodec & HB_VCODEC_FFMPEG_MASK )
{
/* 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))
+ * 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_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 );
}
- hb_reduce( &job->anamorphic.par_width, &job->anamorphic.par_height, job->anamorphic.par_width, job->anamorphic.par_height );
}
}