Created
December 12, 2011 12:34
-
-
Save astrataro/1466956 to your computer and use it in GitHub Desktop.
[x264-patch] Force profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -uNrp a/common/common.c b/common/common.c | |
--- a/common/common.c 2011-11-20 19:59:26 +0000 | |
+++ b/common/common.c 2011-11-20 20:29:52 +0000 | |
@@ -71,6 +71,8 @@ void x264_param_default( x264_param_t *p | |
param->i_fps_den = 1; | |
param->i_level_idc = -1; | |
param->b_level_force = 0; | |
+ param->i_profile = 0; | |
+ param->b_profile_force = 0; | |
param->i_slice_max_size = 0; | |
param->i_slice_max_mbs = 0; | |
param->i_slice_count = 0; | |
@@ -509,6 +511,7 @@ int x264_param_apply_profile( x264_param | |
param->i_cqm_preset = X264_CQM_FLAT; | |
param->psz_cqm_file = NULL; | |
} | |
+ param->i_profile = p; | |
return 0; | |
} | |
@@ -662,6 +665,8 @@ int x264_param_parse( x264_param_t *p, c | |
} | |
OPT("level-force") | |
p->b_level_force = atobool(value); | |
+ OPT("profile-force") | |
+ p->b_profile_force = atobool(value); | |
OPT("bluray-compat") | |
p->b_bluray_compat = atobool(value); | |
OPT("sar") | |
diff -uNrp a/encoder/set.c b/encoder/set.c | |
--- a/encoder/set.c 2011-11-20 19:59:26 +0000 | |
+++ b/encoder/set.c 2011-11-20 20:32:07 +0000 | |
@@ -108,7 +108,9 @@ void x264_sps_init( x264_sps_t *sps, int | |
csp >= X264_CSP_I422 ? CHROMA_422 : CHROMA_420; | |
sps->b_qpprime_y_zero_transform_bypass = param->rc.i_rc_method == X264_RC_CQP && param->rc.i_qp_constant == 0; | |
- if( sps->b_qpprime_y_zero_transform_bypass || sps->i_chroma_format_idc == CHROMA_444 ) | |
+ if( param->b_profile_force && param->i_profile ) | |
+ sps->i_profile_idc = param->i_profile; | |
+ else if( sps->b_qpprime_y_zero_transform_bypass || sps->i_chroma_format_idc == CHROMA_444 ) | |
sps->i_profile_idc = PROFILE_HIGH444_PREDICTIVE; | |
else if( sps->i_chroma_format_idc == CHROMA_422 ) | |
sps->i_profile_idc = PROFILE_HIGH422; | |
diff -uNrp a/x264.c b/x264.c | |
--- a/x264.c 2011-11-20 19:59:26 +0000 | |
+++ b/x264.c 2011-11-20 20:10:00 +0000 | |
@@ -571,6 +571,7 @@ static void help( x264_param_t *defaults | |
#endif | |
"high444\n" | |
); | |
+ H1( " --profile-force Do not automatically decrease profile settings\n" ); | |
H0( " --preset <string> Use a preset to select encoding settings [medium]\n" | |
" Overridden by user settings.\n" ); | |
H2( " - ultrafast:\n" | |
@@ -1042,6 +1043,7 @@ static struct option long_options[] = | |
{ "fullhelp", no_argument, NULL, OPT_FULLHELP }, | |
{ "version", no_argument, NULL, 'V' }, | |
{ "profile", required_argument, NULL, OPT_PROFILE }, | |
+ { "profile-force", no_argument, NULL, 0 }, | |
{ "preset", required_argument, NULL, OPT_PRESET }, | |
{ "tune", required_argument, NULL, OPT_TUNE }, | |
{ "slow-firstpass", no_argument, NULL, OPT_SLOWFIRSTPASS }, | |
diff -uNrp a/x264.h b/x264.h | |
--- a/x264.h 2011-11-20 19:59:26 +0000 | |
+++ b/x264.h 2011-11-20 20:24:39 +0000 | |
@@ -265,6 +265,8 @@ typedef struct x264_param_t | |
int i_csp; /* CSP of encoded bitstream */ | |
int i_level_idc; | |
int b_level_force; /* force ref etc. for level */ | |
+ int i_profile; | |
+ int b_profile_force; /* do not automatically decrease profile settings even if not needed */ | |
int i_frame_total; /* number of frames to encode if known, else 0 */ | |
/* NAL HRD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment