[x264-devel] Signal Progressive and Constrained profiles
Yusuke Nakamura
git at videolan.org
Tue Mar 12 19:32:01 CET 2019
x264 | branch: master | Yusuke Nakamura <muken.the.vfrmaniac at gmail.com> | Mon Apr 9 11:01:28 2018 +0900| [92d36908cbafd2a6edf7e61d69f341027b57f6f8] | committer: Anton Mitrofanov
Signal Progressive and Constrained profiles
Progressive High, Constrained High, and Progressive High 10.
Even in Main profile, constraint_set4_flag is now set to 1 if progressive,
and constraint_set5_flag is set to 1 if no B-slices are present.
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=92d36908cbafd2a6edf7e61d69f341027b57f6f8
---
common/set.h | 2 ++
encoder/encoder.c | 11 +++++++----
encoder/set.c | 12 ++++++++----
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/common/set.h b/common/set.h
index 32ea96ce..4f0e5ab3 100644
--- a/common/set.h
+++ b/common/set.h
@@ -53,6 +53,8 @@ typedef struct
int b_constraint_set1;
int b_constraint_set2;
int b_constraint_set3;
+ int b_constraint_set4;
+ int b_constraint_set5;
int i_log2_max_frame_num;
diff --git a/encoder/encoder.c b/encoder/encoder.c
index d3df5c13..d1305eb2 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -1764,10 +1764,13 @@ x264_t *x264_encoder_open( x264_param_t *param )
const char *profile = h->sps->i_profile_idc == PROFILE_BASELINE ? "Constrained Baseline" :
h->sps->i_profile_idc == PROFILE_MAIN ? "Main" :
- h->sps->i_profile_idc == PROFILE_HIGH ? "High" :
- h->sps->i_profile_idc == PROFILE_HIGH10 ? (h->sps->b_constraint_set3 == 1 ? "High 10 Intra" : "High 10") :
- h->sps->i_profile_idc == PROFILE_HIGH422 ? (h->sps->b_constraint_set3 == 1 ? "High 4:2:2 Intra" : "High 4:2:2") :
- h->sps->b_constraint_set3 == 1 ? "High 4:4:4 Intra" : "High 4:4:4 Predictive";
+ h->sps->i_profile_idc == PROFILE_HIGH ?
+ (h->sps->b_constraint_set4 ? (h->sps->b_constraint_set5 ? "Constrained High" : "Progressive High") : "High") :
+ h->sps->i_profile_idc == PROFILE_HIGH10 ?
+ (h->sps->b_constraint_set3 ? "High 10 Intra" : (h->sps->b_constraint_set4 ? "Progressive High 10" : "High 10")) :
+ h->sps->i_profile_idc == PROFILE_HIGH422 ?
+ (h->sps->b_constraint_set3 ? "High 4:2:2 Intra" : "High 4:2:2") :
+ h->sps->b_constraint_set3 ? "High 4:4:4 Intra" : "High 4:4:4 Predictive";
char level[4];
snprintf( level, sizeof(level), "%d.%d", h->sps->i_level_idc/10, h->sps->i_level_idc%10 );
if( h->sps->i_level_idc == 9 || ( h->sps->i_level_idc == 11 && h->sps->b_constraint_set3 &&
diff --git a/encoder/set.c b/encoder/set.c
index 6cfda793..1511d8e0 100644
--- a/encoder/set.c
+++ b/encoder/set.c
@@ -105,6 +105,9 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param )
sps->i_id = i_id;
sps->i_mb_width = ( param->i_width + 15 ) / 16;
sps->i_mb_height= ( param->i_height + 15 ) / 16;
+ sps->b_frame_mbs_only = !(param->b_interlaced || param->b_fake_interlaced);
+ if( !sps->b_frame_mbs_only )
+ sps->i_mb_height = ( sps->i_mb_height + 1 ) & ~1;
sps->i_chroma_format_idc = csp >= X264_CSP_I444 ? CHROMA_444 :
csp >= X264_CSP_I422 ? CHROMA_422 :
csp >= X264_CSP_I420 ? CHROMA_420 : CHROMA_400;
@@ -130,6 +133,8 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param )
/* Never set constraint_set2, it is not necessary and not used in real world. */
sps->b_constraint_set2 = 0;
sps->b_constraint_set3 = 0;
+ sps->b_constraint_set4 = sps->i_profile_idc >= PROFILE_MAIN && sps->i_profile_idc <= PROFILE_HIGH10 && sps->b_frame_mbs_only;
+ sps->b_constraint_set5 = (sps->i_profile_idc == PROFILE_MAIN || sps->i_profile_idc == PROFILE_HIGH) && param->i_bframe == 0;
sps->i_level_idc = param->i_level_idc;
if( param->i_level_idc == 9 && ( sps->i_profile_idc == PROFILE_BASELINE || sps->i_profile_idc == PROFILE_MAIN ) )
@@ -179,9 +184,6 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param )
sps->b_vui = 1;
sps->b_gaps_in_frame_num_value_allowed = 0;
- sps->b_frame_mbs_only = !(param->b_interlaced || param->b_fake_interlaced);
- if( !sps->b_frame_mbs_only )
- sps->i_mb_height = ( sps->i_mb_height + 1 ) & ~1;
sps->b_mb_adaptive_frame_field = param->b_interlaced;
sps->b_direct8x8_inference = 1;
@@ -309,8 +311,10 @@ void x264_sps_write( bs_t *s, x264_sps_t *sps )
bs_write1( s, sps->b_constraint_set1 );
bs_write1( s, sps->b_constraint_set2 );
bs_write1( s, sps->b_constraint_set3 );
+ bs_write1( s, sps->b_constraint_set4 );
+ bs_write1( s, sps->b_constraint_set5 );
- bs_write( s, 4, 0 ); /* reserved */
+ bs_write( s, 2, 0 ); /* reserved */
bs_write( s, 8, sps->i_level_idc );
More information about the x264-devel
mailing list