-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remaining stb_vorbis diff. #481
Comments
Yes
I don't know when this happened, but it disables code that we don't use
Don't know when this happened either, nor do I know if they're necessary
They are mine and they are actually good (can possibly be done better.)
They are to prevent some stupid stupid Watcom warnings
Can be removed here I think
Yes |
Let's re-implement it |
On further review, these modifications are connected: /* AmigaOS fixes by Chris Young <cdyoung@ntlworld.com>, Nov 25, 2007
*/
#if defined B_BEOS_VERSION
# include <SupportDefs.h>
#elif defined __amigaos4__
# include <exec/types.h>
#else
typedef signed char int8;
typedef signed short int int16;
typedef signed int int32;
typedef unsigned char uint8;
typedef unsigned short int uint16;
typedef unsigned int uint32;
#endif edit: replacing this doesn't seem to break anything, but I don't have BeOS or Amiga OS 4 toolchains right now to verify that portion is correct. |
If stb-mainstream ever change their typedefs they will have problems too, i.e. it still is a latent issue on their side. So, IMO, that |
What else is left to do except for cdf072f? Speaking of code dead-to-libxmp, we also don't use the seek api, along with a few other public functions which can shave off up to 4-5 kb from the final dll -- if we really want to try. Speaking of public functions in stb_vorbis: I think we should apply a libxmp namespace to non-static functions in vorbis.c. Otherwise, if a project itself uses stb_vorbis and wants to link statically to libxmp, it will fail. Something like the following perhaps? diff --git a/src/loaders/vorbis.h b/src/loaders/vorbis.h
index da7214e..af4a03e 100644
--- a/src/loaders/vorbis.h
+++ b/src/loaders/vorbis.h
@@ -6,6 +6,35 @@
#define STB_VORBIS_NO_COMMENTS
#define STB_VORBIS_NO_FLOAT_CONVERSION
+/* change namespace from stb_ to libxmp_ for public functions: */
+#define stb_vorbis_get_info libxmp_vorbis_get_info
+#define stb_vorbis_get_comment libxmp_vorbis_get_comment
+#define stb_vorbis_get_error libxmp_vorbis_get_error
+#define stb_vorbis_close libxmp_vorbis_close
+#define stb_vorbis_get_sample_offset libxmp_vorbis_get_sample_offset
+#define stb_vorbis_get_file_offset libxmp_vorbis_get_file_offset
+#define stb_vorbis_open_pushdata libxmp_vorbis_open_pushdata
+#define stb_vorbis_decode_frame_pushdata libxmp_vorbis_decode_frame_pushdata
+#define stb_vorbis_flush_pushdata libxmp_vorbis_flush_pushdata
+#define stb_vorbis_decode_filename libxmp_vorbis_decode_filename
+#define stb_vorbis_decode_memory libxmp_vorbis_decode_memory
+#define stb_vorbis_open_memory libxmp_vorbis_open_memory
+#define stb_vorbis_open_filename libxmp_vorbis_open_filename
+#define stb_vorbis_open_file libxmp_vorbis_open_file
+#define stb_vorbis_open_file_section libxmp_vorbis_open_file_section
+#define stb_vorbis_seek_frame libxmp_vorbis_seek_frame
+#define stb_vorbis_seek libxmp_vorbis_seek
+#define stb_vorbis_seek_start libxmp_vorbis_seek_start
+#define stb_vorbis_stream_length_in_samples libxmp_vorbis_stream_length_in_samples
+#define stb_vorbis_stream_length_in_seconds libxmp_vorbis_stream_length_in_seconds
+#define stb_vorbis_get_frame_float libxmp_vorbis_get_frame_float
+#define stb_vorbis_get_frame_short_interleaved libxmp_vorbis_get_frame_short_interleaved
+#define stb_vorbis_get_frame_short libxmp_vorbis_get_frame_short
+#define stb_vorbis_get_samples_float_interleaved libxmp_vorbis_get_samples_float_interleaved
+#define stb_vorbis_get_samples_float libxmp_vorbis_get_samples_float
+#define stb_vorbis_get_samples_short_interleaved libxmp_vorbis_get_samples_short_interleaved
+#define stb_vorbis_get_samples_short libxmp_vorbis_get_samples_short
+
#ifndef STB_VORBIS_C
/* client: */
#define STB_VORBIS_HEADER_ONLY |
Bound to the new STB_VORBIS_NO_SEEK_API define. The rest of the libxmp-unused functions in stb_vorbis are: stb_vorbis_get_info, stb_vorbis_get_error, stb_vorbis_get_sample_offset, stb_vorbis_get_samples_short, stb_vorbis_get_samples_short_interleaved, and stb_vorbis_stream_length_in_seconds which possibly aren't worth the trouble. Also see: libxmp#481
If I'm not missing anything, only the above patch remains to be resolved for this ticket. |
I haven't PRed any of the things in the initial post upstream yet... :( |
Should we pull in your nothings/stb#1312 from mainstream? |
I don't think it needs to be pulled in separately—currently I have it as part of the UBSan fuzzing patch I'm working on: master...AliceLR:fuzz-patch-20220315 |
@AliceLR: Do we want this one here: nothings/stb#1563 ? |
Hey, I wonder if this should be added in SDL_Sound too. |
Yes, that seems reasonable. |
This is the remaining diff between the local libxmp stb_vorbis and upstream + misc. patches I contributed pending merge. I've removed irrelevant portions and regrouped bits of it.
libxmp specific changes that probably shouldn't be upstreamed:
alloca
usage tweaks andSTB_FORCEINLINE
appear to be interconnected:"silence warnings" for which compilers/optimization flags? I haven't tried extensively but so far I haven't encountered warnings from these upstream. I'm OK with upstreaming this, but I need a compiler to cite.
Fairly useless changes to debug deadcode.Removed.Pointers of these were provided to functions expecting
uint32 *
, should definitely be upstreamed.There's also the outstanding issue of this patch not having been reimplemented yet, but that should be straightforward and likely it can be upstreamed too. Currently, the only place libxmp uses stb_vorbis is for decoding OXM samples, and OggMod was apparently never aware of stereo samples and always encoded them as a single mono stream. (The removal of this patch was probably also responsible for a noticeable dip in coverage, if that matters at all.)
@sezero any thoughts?
The text was updated successfully, but these errors were encountered: