diff options
author | Rodeo <[email protected]> | 2015-01-09 23:33:48 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2015-01-09 23:33:48 +0000 |
commit | 0fa6b85e0a0bd99a4333417b8ca120b8b83663ba (patch) | |
tree | fc847785cc66eee71286cb392cd25f806e45cdb4 /libhb/work.c | |
parent | 14ce48b7aa94bf0f5b0ec5ec54cde404574b1388 (diff) |
libhb: only sanitize PAR for the MPEG-4 encoder.
The MPEG-2 and VP8 encoders will initialize
fine regardless, and the PAR will be stored
at the container, not the bitstream level.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6713 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/work.c')
-rw-r--r-- | libhb/work.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/libhb/work.c b/libhb/work.c index 39f0dd3ac..20f8f8906 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -911,24 +911,14 @@ static void do_job(hb_job_t *job) job->cfr = 0; } - /* While x264 is smart enough to reduce fractions on its own, libavcodec - * needs some help with the math, so lose superfluous factors. */ - hb_reduce(&job->par.num, &job->par.den, - job->par.num, job->par.den); - if (job->vcodec & HB_VCODEC_FFMPEG_MASK) + /* + * MPEG-4 Part 2 stores the PAR num/den as unsigned 8-bit fields, + * and libavcodec's encoder fails to initialize if we don't handle it. + */ + if (job->vcodec == HB_VCODEC_FFMPEG_MPEG4) { - /* 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->par.num & ~0xFF) || - (job->par.den & ~0xFF)) - { - job->par.num >>= 1; - job->par.den >>= 1; - hb_reduce(&job->par.num, &job->par.den, - job->par.num, job->par.den); - } + hb_limit_rational(&job->par.num, &job->par.den, + job->par.num, job->par.den, 255); } #ifdef USE_QSV |