[x264-devel] commit: Clip log2_max_frame_num (Jason Garrett-Glaser )
git version control
git at videolan.org
Wed Oct 7 03:27:44 CEST 2009
x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Tue Sep 29 23:32:07 2009 -0700| [8be3935a8cef95fe94e0b054f3b6cb904a1f363a] | committer: Jason Garrett-Glaser
Clip log2_max_frame_num
It's still much higher than it needs to be, but that will be fixed with the upcoming MMCO patch.
Also make sure we don't write too large a frame_num or poc in slice header.
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=8be3935a8cef95fe94e0b054f3b6cb904a1f363a
---
encoder/encoder.c | 4 ++--
encoder/set.c | 6 ++----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/encoder/encoder.c b/encoder/encoder.c
index c0b3b76..f2dbf70 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -175,7 +175,7 @@ static void x264_slice_header_write( bs_t *s, x264_slice_header_t *sh, int i_nal
bs_write_ue( s, sh->i_type + 5 ); /* same type things */
bs_write_ue( s, sh->i_pps_id );
- bs_write( s, sh->sps->i_log2_max_frame_num, sh->i_frame_num );
+ bs_write( s, sh->sps->i_log2_max_frame_num, sh->i_frame_num & ((1<<sh->sps->i_log2_max_frame_num)-1) );
if( !sh->sps->b_frame_mbs_only )
{
@@ -191,7 +191,7 @@ static void x264_slice_header_write( bs_t *s, x264_slice_header_t *sh, int i_nal
if( sh->sps->i_poc_type == 0 )
{
- bs_write( s, sh->sps->i_log2_max_poc_lsb, sh->i_poc_lsb );
+ bs_write( s, sh->sps->i_log2_max_poc_lsb, sh->i_poc_lsb & ((1<<sh->sps->i_log2_max_poc_lsb)-1) );
if( sh->pps->b_pic_order && !sh->b_field_pic )
{
bs_write_se( s, sh->i_delta_poc_bottom );
diff --git a/encoder/set.c b/encoder/set.c
index 5c00096..2f7e785 100644
--- a/encoder/set.c
+++ b/encoder/set.c
@@ -97,11 +97,9 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param )
sps->b_constraint_set2 = 0;
sps->i_log2_max_frame_num = 4; /* at least 4 */
- while( (1 << sps->i_log2_max_frame_num) <= param->i_keyint_max )
- {
+ while( (1 << sps->i_log2_max_frame_num) <= param->i_keyint_max && sps->i_log2_max_frame_num < 10 )
sps->i_log2_max_frame_num++;
- }
- sps->i_log2_max_frame_num++; /* just in case */
+ sps->i_log2_max_frame_num++;
sps->i_poc_type = 0;
if( sps->i_poc_type == 0 )
More information about the x264-devel
mailing list