[gstreamer-bugs] [Bug 594225] New: [API] [bytereader] add _unchecked() variants and inline most common functions

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Sat Sep 5 05:24:44 PDT 2009


http://bugzilla.gnome.org/show_bug.cgi?id=594225

           Summary: [API] [bytereader] add _unchecked() variants and
                    inline most common functions
    Classification: Desktop
           Product: GStreamer
           Version: git
        OS/Version: All
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: Normal
         Component: gstreamer (core)
        AssignedTo: gstreamer-bugs at lists.sourceforge.net
        ReportedBy: t.i.m at zen.co.uk
         QAContact: gstreamer-bugs at lists.sourceforge.net
      GNOME target: ---
     GNOME version: ---


--- Comment #0 from Tim-Philipp Müller <t.i.m at zen.co.uk> 2009-09-05 12:24:37 UTC ---
I propose (inlined) _unchecked() variants for the most common get and peek
functions. This is useful e.g. for reading data in inner loops where we've
already checked that sufficient data is available. Of course GST_READ_*() could
be used there, but I believe that using GstByteReader + _unchecked() functions
is generally the better alternative because the code isn't cluttered with
statements that move the read pointer forward, and also the _unchecked() suffix
makes it clear that one should check whether there's enough data available
beforehand.

Secondly, I propose to inline the most common getters and setters. The attached
patch does this by adding private _gst_byter_reader_*inline() variants and then
mapping the normal functions to the inline functions with an additional
G_LIKELY where it makes sense. Besides the presumed performance increase
through inlining, I hope the compiler will be able to generate better/tighter
code for the most common use case where the byte reader is allocated on the
stack and not touched by any external functions.

The change also cleans up the code a bit by removing the non-macro generated
special cases for *int8, *int24 and float* (hopefully correctly).

-- 
Configure bugmail: http://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.



More information about the Gstreamer-bugs mailing list