[x264-devel] commit: Fix MB-tree with keyint<3 (Jason Garrett-Glaser )
git version control
git at videolan.org
Thu Aug 20 22:10:03 CEST 2009
x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Tue Aug 18 21:53:28 2009 -0700| [d345ab05391e2b32c0d567aaa9945f63ce892016] | committer: Jason Garrett-Glaser
Fix MB-tree with keyint<3
Also slightly improve VBV keyint handling.
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=d345ab05391e2b32c0d567aaa9945f63ce892016
---
encoder/encoder.c | 2 +-
encoder/slicetype.c | 12 +++++-------
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/encoder/encoder.c b/encoder/encoder.c
index 66d7dda..343e27c 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -496,7 +496,7 @@ static int x264_validate_parameters( x264_t *h )
if( h->param.rc.b_stat_read )
h->param.rc.i_lookahead = 0;
- else if( !h->param.rc.i_lookahead )
+ else if( !h->param.rc.i_lookahead || h->param.i_keyint_max == 1 )
h->param.rc.b_mb_tree = 0;
if( h->param.rc.f_qcompress == 1 )
h->param.rc.b_mb_tree = 0;
diff --git a/encoder/slicetype.c b/encoder/slicetype.c
index 1dc1c2b..d16ee22 100644
--- a/encoder/slicetype.c
+++ b/encoder/slicetype.c
@@ -848,21 +848,19 @@ static void x264_slicetype_analyse( x264_t *h, int keyframe )
frames[j]->i_type = X264_TYPE_P;
/* Perform the actual macroblock tree analysis.
- * Don't go farther than the lookahead parameter; this helps in short GOPs. */
+ * Don't go farther than the maximum keyframe interval; this helps in short GOPs. */
if( h->param.rc.b_mb_tree )
- x264_macroblock_tree( h, &a, frames, X264_MIN(num_frames, h->param.rc.i_lookahead), keyframe );
+ x264_macroblock_tree( h, &a, frames, X264_MIN(num_frames, h->param.i_keyint_max), keyframe );
/* Enforce keyframe limit. */
for( j = 0; j < num_frames; j++ )
{
- if( (j+1)%h->param.i_keyint_max > keyint_limit )
+ if( ((j-keyint_limit) % h->param.i_keyint_max) == 0 )
{
if( j )
frames[j]->i_type = X264_TYPE_P;
- frames[j+1]->i_type = idr_frame_type;
- if( j <= num_bframes )
- reset_start = j+2;
- break;
+ frames[j+1]->i_type = X264_TYPE_IDR;
+ reset_start = X264_MIN( reset_start, j+2 );
}
}
More information about the x264-devel
mailing list