GNOME Bugzilla – Bug 797164
x264enc: Avoid format decision per frame
Last modified: 2018-09-22 11:45:30 UTC
Avoid switch/case per frame for format decision and detect the format only if where it could be changed. Note that, whenever encoder->input_state is changed, gst_x264_enc_init_encoder() is called.
Created attachment 373687 [details] [review] x264enc: Add some G_UNLIKELY macro
Created attachment 373688 [details] [review] x264enc: Avoid format decision per frame
Comment on attachment 373687 [details] [review] x264enc: Add some G_UNLIKELY macro I know we use these macros everywhere, but I've actually been removing them when touching code. I think they make the code harder to read and have virtually no measurable effect anywhere apart from the tightest inner loops. In GLib there were even cases where the compiler did the wrong/opposite thing when these macros where used IIRC (but I might be making this up). So if you don't mind too much I would like to give this patch a miss unless you have performance data that shows significant improvements from sprinkling these here. I don't mind turning the x264enc NULL check into an early return in itself though.
Pushed, thanks for the patch! commit 7e639433617c4e3969ed27b600f0508e4d7252b8 Author: Seungha Yang <seungha.yang@navercorp.com> Date: Tue Sep 18 21:43:14 2018 +0900 x264enc: Avoid format decision per frame Avoid switch/case per frame for format decision and detect the format only if where it could be changed. Note that, whenever encoder->input_state is changed, gst_x264_enc_init_encoder() is called. https://bugzilla.gnome.org/show_bug.cgi?id=797164