Advertisement
Guest User

Untitled

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