slomo gst-plugins-good: gst-plugins-good/ gst-plugins-good/gst/spectrum/

[email protected] Wed, 14 Jan 2009 07:44:32 -0800 (PST)
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
--===============6062734459487325691==

CVS Root:       /cvs/gstreamer
Module:         gst-plugins-good
Changes by:     slomo
Date:           Wed Jan 14 2009  15:44:32 UTC

Log message:
* gst/spectrum/gstspectrum.c: (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
Use correct types for frame/fft counters and some minor
cleanup.

Modified files:
    .               : ChangeLog
    gst/spectrum    : gstspectrum.c gstspectrum.h

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/ChangeLog.diff?r1=1.3898&r2=1.3899
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/gst/spectrum/gstspectrum.c.diff?r1=1.51&r2=1.52
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/gst/spectrum/gstspectrum.h.diff?r1=1.15&r2=1.16

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-good/ChangeLog,v
retrieving revision 1.3898
retrieving revision 1.3899
diff -u -d -r1.3898 -r1.3899
--- ChangeLog	14 Jan 2009 15:37:05 -0000	1.3898
+++ ChangeLog	14 Jan 2009 15:44:15 -0000	1.3899
@@ -1,5 +1,12 @@
 2009-01-14  Sebastian Dröge  <[email protected]>
 
+	* gst/spectrum/gstspectrum.c: (gst_spectrum_transform_ip):
+	* gst/spectrum/gstspectrum.h:
+	Use correct types for frame/fft counters and some minor
+	cleanup.
+
+2009-01-14  Sebastian Dröge  <[email protected]>
 	Patch by: Lennart Poettering <lennart at poettering dot net>
 	* ext/pulse/pulseprobe.c: (gst_pulseprobe_new),
Index: gstspectrum.c
RCS file: /cvs/gstreamer/gst-plugins-good/gst/spectrum/gstspectrum.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- gstspectrum.c	14 Jan 2009 10:46:53 -0000	1.51
+++ gstspectrum.c	14 Jan 2009 15:44:18 -0000	1.52
@@ -482,6 +482,8 @@
   gfloat *spect_magnitude;
   gfloat *spect_phase;
   GstFFTF32 *fft_ctx;
+  const guint8 *data = GST_BUFFER_DATA (buffer);
+  guint size = GST_BUFFER_SIZE (buffer);
   GST_LOG_OBJECT (spectrum, "input size: %d bytes", GST_BUFFER_SIZE (buffer));
@@ -490,9 +492,6 @@
     gst_spectrum_reset_state (spectrum);
   }
-  /* Create a subbuffer to allow us to overwrite the buffer metadata later */
-  buffer = gst_buffer_create_sub (buffer, 0, GST_BUFFER_SIZE (buffer));
-
   /* If we don't have a FFT context yet get one and
    * allocate memory for everything
    */
@@ -521,26 +520,26 @@
   spect_phase = spectrum->spect_phase;
   fft_ctx = spectrum->fft_ctx;
-  while (GST_BUFFER_SIZE (buffer) >= width * channels) {
+  while (size >= width * channels) {
     /* Move the current frame into our ringbuffer and
      * take the average of all channels
      */
     spectrum->input[spectrum->input_pos] = 0.0;
     if (fp && width == 4) {
-      gfloat *in = (gfloat *) GST_BUFFER_DATA (buffer);
+      gfloat *in = (gfloat *) data;
       for (i = 0; i < channels; i++)
         spectrum->input[spectrum->input_pos] += in[i];
     } else if (fp && width == 8) {
-      gdouble *in = (gdouble *) GST_BUFFER_DATA (buffer);
+      gdouble *in = (gdouble *) data;
     } else if (!fp && width == 4) {
-      gint32 *in = (gint32 *) GST_BUFFER_DATA (buffer);
+      gint32 *in = (gint32 *) data;
         spectrum->input[spectrum->input_pos] += ((gfloat) in[i]) / G_MAXINT32;
     } else if (!fp && width == 2) {
-      gint16 *in = (gint16 *) GST_BUFFER_DATA (buffer);
+      gint16 *in = (gint16 *) data;
         spectrum->input[spectrum->input_pos] += ((gfloat) in[i]) / G_MAXINT16;
     } else {
@@ -548,8 +547,8 @@
     }
     spectrum->input[spectrum->input_pos] /= channels;
-    GST_BUFFER_DATA (buffer) += width * channels;
-    GST_BUFFER_SIZE (buffer) -= width * channels;
+    data += width * channels;
+    size -= width * channels;
     spectrum->input_pos = (spectrum->input_pos + 1) % nfft;
     spectrum->num_frames++;
@@ -612,9 +611,7 @@
-  g_assert (GST_BUFFER_SIZE (buffer) == 0);
-  gst_buffer_unref (buffer);
+  g_assert (size == 0);
   return GST_FLOW_OK;
 }
Index: gstspectrum.h
RCS file: /cvs/gstreamer/gst-plugins-good/gst/spectrum/gstspectrum.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- gstspectrum.h	14 Jan 2009 10:46:54 -0000	1.15
+++ gstspectrum.h	14 Jan 2009 15:44:18 -0000	1.16
@@ -49,9 +49,9 @@
   guint bands;                  /* number of spectrum bands */
   gint threshold;               /* energy level treshold */
-  guint num_frames;             /* frame count (1 sample per channel)
+  guint64 num_frames;           /* frame count (1 sample per channel)
                                  * since last emit */
-  guint num_fft;                /* number of FFTs since last emit */
+  guint64 num_fft;              /* number of FFTs since last emit */
   GstClockTime message_ts;      /* starttime for next message */
   /* <private> */


--===============6062734459487325691==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
--===============6062734459487325691==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
gstreamer-cvs-verbose mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose

--===============6062734459487325691==--