After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 619045 - [spectrum] Add support for 24-bit width and all depth combinations
[spectrum] Add support for 24-bit width and all depth combinations
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal enhancement
: 0.10.24
Assigned To: Alexander Kojevnikov
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-05-19 01:22 UTC by Alexander Kojevnikov
Modified: 2010-06-01 09:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (2.17 KB, patch)
2010-05-19 01:29 UTC, Alexander Kojevnikov
needs-work Details | Review
Support arbitrary bit depth (2.79 KB, patch)
2010-05-23 08:33 UTC, Alexander Kojevnikov
none Details | Review
fix a typo (2.79 KB, patch)
2010-05-23 08:49 UTC, Alexander Kojevnikov
needs-work Details | Review
Support 24-bit width (3.06 KB, patch)
2010-05-24 02:14 UTC, Alexander Kojevnikov
needs-work Details | Review
Now with Morse code support (3.02 KB, patch)
2010-05-24 12:29 UTC, Alexander Kojevnikov
committed Details | Review
Use macros from gstutils.h (2.22 KB, patch)
2010-05-24 12:30 UTC, Alexander Kojevnikov
none Details | Review
fix a typo in the second path (2.22 KB, patch)
2010-05-25 05:17 UTC, Alexander Kojevnikov
committed Details | Review

Description Alexander Kojevnikov 2010-05-19 01:22:56 UTC
The patch is coming.
Comment 1 Alexander Kojevnikov 2010-05-19 01:29:03 UTC
Created attachment 161399 [details] [review]
patch

A lot (if not most) vinyl rips use 24 bits. At the moment the spectrum plugin can process only 16 and 32 bit streams.
Comment 2 Alexander Kojevnikov 2010-05-19 02:30:53 UTC
Actually, prepending `spectrum` with an `audioconvert` element works too, so may be this fix is not really needed.
Comment 3 Tim-Philipp Müller 2010-05-19 08:27:52 UTC
It's still nice to have though, especially if it's quite easy to implement, as seems to be the case here.
Comment 4 Sebastian Dröge (slomo) 2010-05-19 12:27:30 UTC
Agreed and it would also be nice if random depths are supported for all sample widths. This should be quite easy to add the same way (dividing samples by the maximum value). Do you want to extend the patch to do that? Otherwise I'll do it on top of your patch.

(Also 24 bit width would be nice to have :) )
Comment 5 Alexander Kojevnikov 2010-05-19 12:41:09 UTC
(In reply to comment #4)
> Agreed and it would also be nice if random depths are supported for all sample
> widths. This should be quite easy to add the same way (dividing samples by the
> maximum value). Do you want to extend the patch to do that? Otherwise I'll do
> it on top of your patch.

You mean {8,16,24,32} bit depths for 32 bit width and {8,16} bit depths for 16 bit widths? Or all depths between 1 and the width?

Let me know, I will adapt the patch this weekend.

> (Also 24 bit width would be nice to have :) )

Just curious, is it possible to generate such a stream using standard plugins?
Comment 6 Sebastian Dröge (slomo) 2010-05-19 12:44:09 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Agreed and it would also be nice if random depths are supported for all sample
> > widths. This should be quite easy to add the same way (dividing samples by the
> > maximum value). Do you want to extend the patch to do that? Otherwise I'll do
> > it on top of your patch.
> 
> You mean {8,16,24,32} bit depths for 32 bit width and {8,16} bit depths for 16
> bit widths? Or all depths between 1 and the width?

All depths between 1 and width, i.e. [1,32] for width=32, [1,24] for width=24, etc.
 
> Let me know, I will adapt the patch this weekend.

Thanks :)

> > (Also 24 bit width would be nice to have :) )
> 
> Just curious, is it possible to generate such a stream using standard plugins?

Sure: audiotestsrc ! audioconvert ! "audio/x-raw-int,width=24" ! ...
Comment 7 Alexander Kojevnikov 2010-05-23 08:33:08 UTC
Created attachment 161759 [details] [review]
Support arbitrary bit depth

The patch adds support for depths between 2 and the width. The depth cannot be 1 bit because we are using signed ints.

I will look into 24-bit widths later and will submit it as a separate patch.
Comment 8 Alexander Kojevnikov 2010-05-23 08:49:17 UTC
Created attachment 161762 [details] [review]
fix a typo
Comment 9 Alexander Kojevnikov 2010-05-24 02:14:31 UTC
Created attachment 161821 [details] [review]
Support 24-bit width

This should be applied on top of the previous patch. It also fixes a compile warning introduced by the previous patch.
Comment 10 Sebastian Dröge (slomo) 2010-05-24 08:23:27 UTC
Review of attachment 161762 [details] [review]:

Looks good in general, thanks

::: gst/spectrum/gstspectrum.c
@@ +118,3 @@
     "audio/x-raw-int, "                                               \
     " width = (int) 32, "                                             \
+    " depth = (int) [ 2, 32 ], "                                      \

1 bit depth is supported too, not that it's very useful but still... Maybe someone uses it for morse codes ;)
Comment 11 Sebastian Dröge (slomo) 2010-05-24 08:27:21 UTC
Review of attachment 161821 [details] [review]:

::: gst/spectrum/gstspectrum.c
@@ +576,3 @@
+        }
+        if (value & 0x800000)
+          value = -(value ^ 0xffffff) - 1;

Use something like this here, that's used in GstByteReader too for example. Your's works too of course but that's a bit larger ;)

#if G_BYTE_ORDER == G_BIG_ENDIAN
  value = GST_UTIL_READ_UINT24_BE (data);
#else
  value = GST_UTIL_READ_UINT24_LE (data);
#endif
  if (value & 0x00800000)
    val |= 0xff000000;
Comment 12 Alexander Kojevnikov 2010-05-24 12:29:04 UTC
Created attachment 161858 [details] [review]
Now with Morse code support
Comment 13 Alexander Kojevnikov 2010-05-24 12:30:01 UTC
Created attachment 161859 [details] [review]
Use macros from gstutils.h
Comment 14 Alexander Kojevnikov 2010-05-25 05:17:21 UTC
Created attachment 161908 [details] [review]
fix a typo in the second path
Comment 15 Sebastian Dröge (slomo) 2010-05-25 17:55:22 UTC
Thanks, I'll push these patches after next gst-plugins-good release. Please base any new patches on top of these :)
Comment 16 Sebastian Dröge (slomo) 2010-06-01 09:25:12 UTC
commit 2d13b15376df91327f301f3225f404d7fb75bb9a
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Tue May 25 15:16:06 2010 +1000

    spectrum: support 24-bit width
    
    Fixes #619045

commit c69dd320af2ad8d1e5e97bf1c6a25c9a2a72071c
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Mon May 24 21:50:58 2010 +1000

    spectrum: support arbitrary bit depth
    
    Partially fixes #619045