diff options
author | van <[email protected]> | 2008-06-18 21:48:00 +0000 |
---|---|---|
committer | van <[email protected]> | 2008-06-18 21:48:00 +0000 |
commit | 211c12a5e341cf80147e88f0e332f6e709074e37 (patch) | |
tree | 348a9fc093797139586bbe439bd10fcd0fc9a9fb /libhb | |
parent | 17c3757468d7938785899492c6a04000fbf9fad9 (diff) |
- Add COLR atom support to mpeg4ip
- Add COLR atom to mp4 video tracks
- Add colorspace info to h.264 VUI header
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1528 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/encx264.c | 17 | ||||
-rw-r--r-- | libhb/muxmp4.c | 18 |
2 files changed, 35 insertions, 0 deletions
diff --git a/libhb/encx264.c b/libhb/encx264.c index 6c1f347e0..da8c7f979 100644 --- a/libhb/encx264.c +++ b/libhb/encx264.c @@ -198,6 +198,23 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job ) free(x264opts_start); } + /* set up the VUI color model & gamma to match what the COLR atom + * set in muxmp4.c says. See libhb/muxmp4.c for notes. */ + + if ( job->title->height >= 720 ) + { + // we guess that 720p or above is ITU BT.709 HD content + param.vui.i_colorprim = 1; + param.vui.i_transfer = 1; + param.vui.i_colmatrix = 1; + } + else + { + // ITU BT.601 DVD or SD TV content + param.vui.i_colorprim = 6; + param.vui.i_transfer = 1; + param.vui.i_colmatrix = 6; + } if( job->pixel_ratio ) { diff --git a/libhb/muxmp4.c b/libhb/muxmp4.c index b20b9a466..638bc7e9f 100644 --- a/libhb/muxmp4.c +++ b/libhb/muxmp4.c @@ -247,6 +247,24 @@ static int MP4Init( hb_mux_object_t * m ) } } + // COLR atom for color and gamma correction. + // Per the notes at: + // http://developer.apple.com/quicktime/icefloe/dispatch019.html#colr + // http://forum.doom9.org/showthread.php?t=133982#post1090068 + // we say anything that's likely to be HD content is ITU BT.709 and + // DVD, SD TV & other content is ITU BT.601. We look at the title height + // rather than the job height here to get uncropped input dimensions. + if ( job->title->height >= 720 ) + { + // we guess that 720p or above is ITU BT.709 HD content + MP4AddColr(m->file, mux_data->track, 1, 1, 1); + } + else + { + // ITU BT.601 DVD or SD TV content + MP4AddColr(m->file, mux_data->track, 6, 1, 6); + } + if( job->pixel_ratio ) { /* PASP atom for anamorphic video */ |