diff options
author | Rodeo <[email protected]> | 2012-03-28 23:22:17 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2012-03-28 23:22:17 +0000 |
commit | 39425d02862f054e3ef87ef45b789254c64511ad (patch) | |
tree | 30583795947cec54860e51a8b675bfd29f03a26a /libhb/encx264.c | |
parent | cca9c898d2f57047ab2cdabee8c794ddf2775aa7 (diff) |
libhb: use source colorimetry information when available.
When source colorimetry can't be determined, guess.
Added code to guess PAL SD content and updated code to guess HD content.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4552 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/encx264.c')
-rw-r--r-- | libhb/encx264.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/libhb/encx264.c b/libhb/encx264.c index f48aa499a..7345ab20e 100644 --- a/libhb/encx264.c +++ b/libhb/encx264.c @@ -139,27 +139,40 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job ) /* 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->color_matrix_code == 3 ) + if( job->color_matrix_code == 4 ) { // Custom param.vui.i_colorprim = job->color_prim; param.vui.i_transfer = job->color_transfer; param.vui.i_colmatrix = job->color_matrix; } - else if( ( job->color_matrix_code == 2 ) || - ( job->color_matrix_code == 0 && ( job->title->width >= 1280 || job->title->height >= 720 ) ) ) + else if( job->color_matrix_code == 3 ) { // ITU BT.709 HD content - param.vui.i_colorprim = 1; - param.vui.i_transfer = 1; - param.vui.i_colmatrix = 1; + param.vui.i_colorprim = HB_COLR_PRI_BT709; + param.vui.i_transfer = HB_COLR_TRA_BT709; + param.vui.i_colmatrix = HB_COLR_MAT_BT709; + } + else if( job->color_matrix_code == 2 ) + { + // ITU BT.601 DVD or SD TV content (PAL) + param.vui.i_colorprim = HB_COLR_PRI_EBUTECH; + param.vui.i_transfer = HB_COLR_TRA_BT709; + param.vui.i_colmatrix = HB_COLR_MAT_SMPTE170M; + } + else if( job->color_matrix_code == 1 ) + { + // ITU BT.601 DVD or SD TV content (NTSC) + param.vui.i_colorprim = HB_COLR_PRI_SMPTEC; + param.vui.i_transfer = HB_COLR_TRA_BT709; + param.vui.i_colmatrix = HB_COLR_MAT_SMPTE170M; } else { - // ITU BT.601 DVD or SD TV content - param.vui.i_colorprim = 6; - param.vui.i_transfer = 1; - param.vui.i_colmatrix = 6; + // detected during scan + param.vui.i_colorprim = job->title->color_prim; + param.vui.i_transfer = job->title->color_transfer; + param.vui.i_colmatrix = job->title->color_matrix; } /* place job->advanced_opts in an hb_dict_t for convenience */ @@ -185,7 +198,7 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job ) /* Reload colorimetry settings in case custom values were set * in the advanced_opts string */ - job->color_matrix_code = 3; + job->color_matrix_code = 4; job->color_prim = param.vui.i_colorprim; job->color_transfer = param.vui.i_transfer; job->color_matrix = param.vui.i_colmatrix; |