Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 895 if( h->param.i_lookahead_threads == X264_THREADS_AUTO )
- 896 {
- 897 if( h->param.b_sliced_threads )
- 898 h->param.i_lookahead_threads = h->param.i_threads;
- 899 else
- 900 {
- 901 /* If we're using much slower lookahead settings than encoding settings, it helps a lot to use
- 902 * more lookahead threads. This typically happens in the first pass of a two-pass encode, so
- 903 * try to guess at this sort of case.
- 904 *
- 905 * Tuned by a little bit of real encoding with the various presets. */
- 906 int badapt = h->param.i_bframe_adaptive == X264_B_ADAPT_TRELLIS;
- 907 int subme = X264_MIN( h->param.analyse.i_subpel_refine / 3, 3 ) + (h->param.analyse.i_subpel_refine > 1);
- 908 int bframes = X264_MIN( (h->param.i_bframe - 1) / 3, 3 );
- 909
- 910 /* [b-adapt 0/1 vs 2][quantized subme][quantized bframes] */
- 911 static const uint8_t lookahead_thread_div[2][5][4] =
- 912 {{{6,6,6,6}, {3,3,3,3}, {4,4,4,4}, {6,6,6,6}, {12,12,12,12}},
- 913 {{3,2,1,1}, {2,1,1,1}, {4,3,2,1}, {6,4,3,2}, {12, 9, 6, 4}}};
- 914
- 915 h->param.i_lookahead_threads = h->param.i_threads / lookahead_thread_div[badapt][subme][bframes];
- 916 /* Since too many lookahead threads significantly degrades lookahead accuracy, limit auto
- 917 * lookahead threads to about 8 macroblock rows high each at worst. This number is chosen
- 918 * pretty much arbitrarily. */
- 919 h->param.i_lookahead_threads = X264_MIN( h->param.i_lookahead_threads, h->param.i_height / 128 );
- 920 }
- 921 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement