From a633347ed1a1d2e4241b25392b18732fe005fcfb Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 23 May 2012 08:39:21 +0200 Subject: [PATCH] mpegtsbase: Speed up _is_psi() By making it inline and simplifying the bit macros --- gst/mpegtsdemux/mpegtsbase.c | 3 ++- gst/mpegtsdemux/mpegtsbase.h | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c index 1997c7ab4d..8383385c23 100644 --- a/gst/mpegtsdemux/mpegtsbase.c +++ b/gst/mpegtsdemux/mpegtsbase.c @@ -752,12 +752,13 @@ mpegts_base_activate_program (MpegTSBase * base, MpegTSBaseProgram * program, GST_DEBUG_OBJECT (base, "new pmt %" GST_PTR_FORMAT, pmt_info); } -gboolean +static inline gboolean mpegts_base_is_psi (MpegTSBase * base, MpegTSPacketizerPacket * packet) { gboolean retval = FALSE; guint8 *data, table_id, pointer; int i; + static const guint8 si_tables[] = { 0x00, 0x01, 0x02, 0x03, 0x40, 0x41, 0x42, 0x46, 0x4A, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, diff --git a/gst/mpegtsdemux/mpegtsbase.h b/gst/mpegtsdemux/mpegtsbase.h index 225d53dccc..e12f591987 100644 --- a/gst/mpegtsdemux/mpegtsbase.h +++ b/gst/mpegtsdemux/mpegtsbase.h @@ -176,9 +176,9 @@ struct _MpegTSBaseClass { void (*eit_info) (GstStructure *eit); }; -#define MPEGTS_BIT_SET(field, offs) ((field)[(offs) / 8] |= (1 << ((offs) % 8))) -#define MPEGTS_BIT_UNSET(field, offs) ((field)[(offs) / 8] &= ~(1 << ((offs) % 8))) -#define MPEGTS_BIT_IS_SET(field, offs) ((field)[(offs) / 8] & (1 << ((offs) % 8))) +#define MPEGTS_BIT_SET(field, offs) ((field)[(offs) >> 3] |= (1 << ((offs) & 0xf))) +#define MPEGTS_BIT_UNSET(field, offs) ((field)[(offs) >> 3] &= ~(1 << ((offs) & 0xf))) +#define MPEGTS_BIT_IS_SET(field, offs) ((field)[(offs) >> 3] & (1 << ((offs) & 0xf))) GType mpegts_base_get_type(void); @@ -193,7 +193,6 @@ mpegts_base_handle_seek_event(MpegTSBase * base, GstPad * pad, GstEvent * event) gboolean gst_mpegtsbase_plugin_init (GstPlugin * plugin); -gboolean mpegts_base_is_psi (MpegTSBase * base, MpegTSPacketizerPacket * packet); gboolean mpegts_base_handle_psi (MpegTSBase * base, MpegTSPacketizerSection * section); void mpegts_base_program_remove_stream (MpegTSBase * base, MpegTSBaseProgram * program, guint16 pid);