[x264-devel] commit: Improve flash detection algorithm change in r1765 ( Anton Mitrofanov )
git at videolan.org
git at videolan.org
Sun Nov 14 08:10:01 CET 2010
x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Thu Nov 11 01:40:52 2010 +0300| [c9dad9e1508a4d430b9bab72c8875892cf7fef3c] | committer: Jason Garrett-Glaser
Improve flash detection algorithm change in r1765
Now only disables scenecuts only near real end of video, not just prior to forced keyframes.
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=c9dad9e1508a4d430b9bab72c8875892cf7fef3c
---
encoder/slicetype.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/encoder/slicetype.c b/encoder/slicetype.c
index 2d4a0f0..dc02fbd 100644
--- a/encoder/slicetype.c
+++ b/encoder/slicetype.c
@@ -1032,7 +1032,7 @@ static int scenecut_internal( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **f
return res;
}
-static int scenecut( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int p0, int p1, int real_scenecut, int num_frames )
+static int scenecut( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int p0, int p1, int real_scenecut, int num_frames, int i_max_search )
{
/* Only do analysis during a normal scenecut check. */
if( real_scenecut && h->param.i_bframe )
@@ -1061,7 +1061,7 @@ static int scenecut( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, in
* Instead, the first F frame becomes a scenecut.
* If the video ends before F, no frame becomes a scenecut. */
for( int curp0 = p0; curp0 <= maxp1; curp0++ )
- if( maxp1 != origmaxp1 || (curp0 < maxp1 && scenecut_internal( h, a, frames, curp0, maxp1, 0 )) )
+ if( origmaxp1 > i_max_search || (curp0 < maxp1 && scenecut_internal( h, a, frames, curp0, maxp1, 0 )) )
/* If cur_p0 is the p0 of a scenecut, it cannot be the p1 of a scenecut. */
frames[curp0]->b_scenecut = 0;
}
@@ -1119,7 +1119,7 @@ void x264_slicetype_analyse( x264_t *h, int keyframe )
int num_bframes = 0;
int num_analysed_frames = num_frames;
int reset_start;
- if( h->param.i_scenecut_threshold && scenecut( h, &a, frames, 0, 1, 1, orig_num_frames ) )
+ if( h->param.i_scenecut_threshold && scenecut( h, &a, frames, 0, 1, 1, orig_num_frames, i_max_search ) )
{
frames[1]->i_type = X264_TYPE_I;
return;
@@ -1201,7 +1201,7 @@ void x264_slicetype_analyse( x264_t *h, int keyframe )
/* Check scenecut on the first minigop. */
for( int j = 1; j < num_bframes+1; j++ )
- if( h->param.i_scenecut_threshold && scenecut( h, &a, frames, j, j+1, 0, orig_num_frames ) )
+ if( h->param.i_scenecut_threshold && scenecut( h, &a, frames, j, j+1, 0, orig_num_frames, i_max_search ) )
{
frames[j]->i_type = X264_TYPE_P;
num_analysed_frames = j;
More information about the x264-devel
mailing list