<div dir="ltr">Hi,<div><br></div><div>I have a doubt in the scenecut algorithm of x264 encoder. Specifically in the scenecut_internal function, I am pasting the code snippet below </div><div><br></div><div>    float f_bias;</div><div>    int i_gop_size = frame->i_frame - h->lookahead->i_last_keyframe;</div><div>    float f_thresh_max = h->param.i_scenecut_threshold / 100.0;</div><div>    /* magic numbers pulled out of thin air */</div><div>    float f_thresh_min = f_thresh_max * 0.25;</div><div>    int res;</div><div>    if (real_scenecut) {</div><div>        if (h->param.i_keyint_min == h->param.i_keyint_max)</div><div>            f_thresh_min = f_thresh_max;</div><div>        if (i_gop_size <= h->param.i_keyint_min / 4 || h->param.b_intra_refresh)</div><div>            f_bias = f_thresh_min / 4;</div><div>        else if (i_gop_size <= h->param.i_keyint_min)</div><div>            f_bias = f_thresh_min * i_gop_size / h->param.i_keyint_min;</div><div>        else</div><div>        {</div><div>            f_bias = f_thresh_min</div><div>                + (f_thresh_max - f_thresh_min)</div><div>                * (i_gop_size - h->param.i_keyint_min)</div><div>                / (h->param.i_keyint_max - h->param.i_keyint_min);</div><div>        }</div><div>    }</div><div>    res = pcost >= (1.0 - f_bias) * icost;</div><div><br></div><div>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.</div><div><br></div><div>Thank,</div><div>Gopi</div></div>