[x264-devel] Doubts in scenecut algorithm

A gopi sathya krishna agopikrishna13 at gmail.com
Fri Nov 18 13:46:02 CET 2016


Hi,

I have a doubt in the scenecut algorithm of x264 encoder. Specifically in
the scenecut_internal function, I am pasting the code snippet below

    float f_bias;
    int i_gop_size = frame->i_frame - h->lookahead->i_last_keyframe;
    float f_thresh_max = h->param.i_scenecut_threshold / 100.0;
    /* magic numbers pulled out of thin air */
    float f_thresh_min = f_thresh_max * 0.25;
    int res;
    if (real_scenecut) {
        if (h->param.i_keyint_min == h->param.i_keyint_max)
            f_thresh_min = f_thresh_max;
        if (i_gop_size <= h->param.i_keyint_min / 4 ||
h->param.b_intra_refresh)
            f_bias = f_thresh_min / 4;
        else if (i_gop_size <= h->param.i_keyint_min)
            f_bias = f_thresh_min * i_gop_size / h->param.i_keyint_min;
        else
        {
            f_bias = f_thresh_min
                + (f_thresh_max - f_thresh_min)
                * (i_gop_size - h->param.i_keyint_min)
                / (h->param.i_keyint_max - h->param.i_keyint_min);
        }
    }
    res = pcost >= (1.0 - f_bias) * icost;

As I understand, the f_bias value changes based on the location of the
current frame from the last keyframe. The f_bias value for the frames
closer to the last keyframe is less when compared to the frames far away
from the last keyframe, thus frames away from the last keyframe are more
likely to be detected as scenecut (I frame). My doubt is, why the location
of the scenecut frame is important for coding it as I frame.

Thank,
Gopi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20161118/1e52e69c/attachment.html>


More information about the x264-devel mailing list