GNOME Bugzilla – Bug 702330
mpegvideoparse: Only map input buffer once
Last modified: 2013-07-22 11:47:53 UTC
Instead of constantly map/unmapping it a bit everywhere, we pass along to all functions the GstMapInfo. Makes mpeg video frame parsing 6% faster
Created attachment 246885 [details] [review] mpegvideoparse: Only map input buffer once
Comment on attachment 246885 [details] [review] mpegvideoparse: Only map input buffer once Hah, nice. > static gboolean >-gst_mpegv_parse_process_config (GstMpegvParse * mpvparse, GstBuffer * buf, >+gst_mpegv_parse_process_config (GstMpegvParse * mpvparse, GstMapInfo * info, > guint size) > { Minor nitpick: size is now also in info.size, isn't it (if you always pass gst_buffer_get_size() anyway), so doesn't have to be passed separately if info is passed? Also, I wonder if it wouldn't be even better to pass info.data instead of the whole GstMapInfo *? Then the compiler doesn't have to re-read info>data everytime it's accessed.
Just passing the data seems better to me too, otherwise looks good
I tried to keep the changes to a minimum in this patch, which is why I only replaced GstBuffer * with GstMapInfo *. There are multiple places where there are local "data" and "size" variables with different meanings/usage than the input buffer, so prefered to keep amount of changes to a minimum to avoid issues and potential bugs. OK to push as-is and leave further cleanups/optimisations to later fixes ?
Ok
Sure, but you don't have to call the variable with the data 'data' ;)
Needs complete change after GstMpegVideoPacket commit :(
Created attachment 249768 [details] [review] mpegvideoparse: Only map input buffer once Instead of constantly map/unmapping it a bit everywhere, we pass along to all functions the GstMapInfo. Makes mpeg video frame parsing 6% faster
commit 1db3d40a4bdaa3f77005ef99f7edda215919ef5e Author: Edward Hervey <edward@collabora.com> Date: Mon Jul 22 10:46:23 2013 +0200 mpegvideoparse: Only map input buffer once Instead of constantly map/unmapping it a bit everywhere, we pass along to all functions the GstMapInfo. Makes mpeg video frame parsing 6% faster https://bugzilla.gnome.org/show_bug.cgi?id=702330