summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorEdward Hervey <edward.hervey@collabora.co.uk>2012-06-05 17:57:41 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2012-06-06 10:33:18 +0200
commit7d4f1aa8e85162b393d7c0fa8aca29512bb425ca (patch)
tree4c65343521431710de6c5534d7ba874b762bf129 /gst-libs
parent4cc905409e0b76e19fefe316c386597e393cfaad (diff)
downloadgstreamer-plugins-bad-7d4f1aa8e85162b393d7c0fa8aca29512bb425ca.tar.gz
h264parser: Remove un-needed checks and inline some functions
val and nr always exist (&nr, &value) bits is always called smaller than the width Makes parsing 30% faster
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/codecparsers/gsth264parser.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/gst-libs/gst/codecparsers/gsth264parser.c b/gst-libs/gst/codecparsers/gsth264parser.c
index 00c151799..9dbfe46b9 100644
--- a/gst-libs/gst/codecparsers/gsth264parser.c
+++ b/gst-libs/gst/codecparsers/gsth264parser.c
@@ -188,7 +188,7 @@ nal_reader_init (NalReader * nr, const guint8 * data, guint size)
nr->cache = 0xff;
}
-static gboolean
+static inline gboolean
nal_reader_read (NalReader * nr, guint nbits)
{
if (G_UNLIKELY (nr->byte * 8 + (nbits - nr->bits_in_cache) > nr->size * 8)) {
@@ -227,8 +227,6 @@ nal_reader_read (NalReader * nr, guint nbits)
static inline gboolean
nal_reader_skip (NalReader * nr, guint nbits)
{
- g_return_val_if_fail (nr != NULL, FALSE);
-
if (G_UNLIKELY (!nal_reader_read (nr, nbits)))
return FALSE;
@@ -240,8 +238,6 @@ nal_reader_skip (NalReader * nr, guint nbits)
static inline gboolean
nal_reader_skip_to_byte (NalReader * nr)
{
- g_return_val_if_fail (nr != NULL, FALSE);
-
if (nr->bits_in_cache == 0) {
if (G_LIKELY ((nr->size - nr->byte) > 0))
nr->byte++;
@@ -278,10 +274,6 @@ nal_reader_get_bits_uint##bits (NalReader *nr, guint##bits *val, guint nbits) \
{ \
guint shift; \
\
- g_return_val_if_fail (nr != NULL, FALSE); \
- g_return_val_if_fail (val != NULL, FALSE); \
- g_return_val_if_fail (nbits <= bits, FALSE); \
- \
if (!nal_reader_read (nr, nbits)) \
return FALSE; \
\
@@ -309,7 +301,6 @@ nal_reader_peek_bits_uint##bits (const NalReader *nr, guint##bits *val, guint nb
{ \
NalReader tmp; \
\
- g_return_val_if_fail (nr != NULL, FALSE); \
tmp = *nr; \
return nal_reader_get_bits_uint##bits (&tmp, val, nbits); \
}
@@ -345,7 +336,7 @@ nal_reader_get_ue (NalReader * nr, guint32 * val)
return TRUE;
}
-static gboolean
+static inline gboolean
nal_reader_get_se (NalReader * nr, gint32 * val)
{
guint32 value;