After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 797164 - x264enc: Avoid format decision per frame
x264enc: Avoid format decision per frame
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-ugly
git master
Other Linux
: Normal normal
: 1.15.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-09-18 12:56 UTC by Seungha Yang
Modified: 2018-09-22 11:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
x264enc: Add some G_UNLIKELY macro (1.51 KB, patch)
2018-09-18 12:59 UTC, Seungha Yang
rejected Details | Review
x264enc: Avoid format decision per frame (2.29 KB, patch)
2018-09-18 12:59 UTC, Seungha Yang
committed Details | Review

Description Seungha Yang 2018-09-18 12:56:01 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.
Comment 1 Seungha Yang 2018-09-18 12:59:18 UTC
Created attachment 373687 [details] [review]
x264enc: Add some G_UNLIKELY macro
Comment 2 Seungha Yang 2018-09-18 12:59:35 UTC
Created attachment 373688 [details] [review]
x264enc: Avoid format decision per frame
Comment 3 Tim-Philipp Müller 2018-09-22 11:13:14 UTC
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.
Comment 4 Tim-Philipp Müller 2018-09-22 11:45:15 UTC
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