Skip to content

Commit

Permalink
several updates to libvorbisidec-1.2.1 (mostly from vorbis.git).
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Oct 6, 2019
1 parent 7bb1042 commit 7e2e3c8
Show file tree
Hide file tree
Showing 45 changed files with 10,254 additions and 8,791 deletions.
14 changes: 7 additions & 7 deletions external/libvorbisidec-1.2.1.patch
@@ -1,6 +1,6 @@
diff -ruN libvorbisidec-1.2.1.orig/Android.mk libvorbisidec-1.2.1/Android.mk
--- libvorbisidec-1.2.1.orig/Android.mk 1969-12-31 16:00:00.000000000 -0800
+++ libvorbisidec-1.2.1/Android.mk 2017-10-22 17:27:12.176911197 -0700
diff -u /dev/null libvorbisidec-1.2.1/Android.mk
--- /dev/null
+++ libvorbisidec-1.2.1/Android.mk
@@ -0,0 +1,32 @@
+LOCAL_PATH := $(call my-dir)
+
Expand All @@ -10,7 +10,7 @@ diff -ruN libvorbisidec-1.2.1.orig/Android.mk libvorbisidec-1.2.1/Android.mk
+
+LOCAL_C_INCLUDES :=
+
+LOCAL_CFLAGS :=
+LOCAL_CFLAGS := -DHAVE_ALLOCA -DVAR_ARRAYS
+
+ifeq ($(TARGET_ARCH),arm)
+ LOCAL_CFLAGS += -D_ARM_ASSEM_
Expand All @@ -34,9 +34,9 @@ diff -ruN libvorbisidec-1.2.1.orig/Android.mk libvorbisidec-1.2.1/Android.mk
+LOCAL_SHARED_LIBRARIES := ogg
+
+include $(BUILD_STATIC_LIBRARY)
diff -ruN libvorbisidec-1.2.1.orig/misc.h libvorbisidec-1.2.1/misc.h
--- libvorbisidec-1.2.1.orig/misc.h 2017-10-22 17:26:08.725205666 -0700
+++ libvorbisidec-1.2.1/misc.h 2017-10-12 20:05:06.719770194 -0700
diff -u libvorbisidec-1.2.1/misc.h~ libvorbisidec-1.2.1/misc.h
--- libvorbisidec-1.2.1/misc.h~
+++ libvorbisidec-1.2.1/misc.h
@@ -30,6 +30,7 @@

#include "asm_arm.h"
Expand Down
@@ -0,0 +1,29 @@
From f2f94d9682db9a5a2c493f8a995f80eebad0f0a6 Mon Sep 17 00:00:00 2001
From: sezero <sezero@users.sourceforge.net>
Date: Tue, 20 Mar 2018 11:20:02 +0300
Subject: [PATCH] os.h: change elif _WIN32 to elif defined(_WIN32)

This symbol is only defined (with the value 1) when building
for the Windows target, so we need to ifdef, not if.

(vorbis.git commit e3230ddc86f7164db1e310b7e7275e90a3556e3b)
---
os.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/os.h b/os.h
index 130d27d..12ba684 100644
--- a/os.h
+++ b/os.h
@@ -25,7 +25,7 @@

# ifdef __GNUC__
# define STIN static __inline__
-# elif _WIN32
+# elif defined(_WIN32)
# define STIN static __inline
# endif
#else
--
1.7.1

@@ -0,0 +1,29 @@
From 8fea0414f6a754f31221ff3fa291f20ba85a9907 Mon Sep 17 00:00:00 2001
From: sezero <sezero@users.sourceforge.net>
Date: Tue, 20 Mar 2018 11:20:10 +0300
Subject: [PATCH] mapping0.c (mapping0_unpack): kill a useless memset()

info is allocated with calloc() already.

(vorbis.git commit 8a8f8589e19c5016f6548d877a8fda231fce4f93)

Signed-off-by: Ralph Giles <giles@thaumas.net>
---
mapping0.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/mapping0.c b/mapping0.c
index aa03e85..17aa60b 100644
--- a/mapping0.c
+++ b/mapping0.c
@@ -129,7 +129,6 @@ static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb)
int i,b;
vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)_ogg_calloc(1,sizeof(*info));
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
- memset(info,0,sizeof(*info));

b=oggpack_read(opb,1);
if(b<0)goto err_out;
--
1.7.1

@@ -0,0 +1,32 @@
From 45de67aa9d15102546d1956bbf2c0e770072e595 Mon Sep 17 00:00:00 2001
From: Monty <xiphmont@xiph.org>
Date: Tue, 20 Mar 2018 11:21:50 +0300
Subject: [PATCH] Add return code check to _initial_pcmoffset as vorbis_packet_blocksize can fail. Closes Trac #2142

(backport from vorbis svn r19434)
---
vorbisfile.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/vorbisfile.c b/vorbisfile.c
index cd4814d..ca583c8 100644
--- a/vorbisfile.c
+++ b/vorbisfile.c
@@ -433,9 +433,11 @@ static ogg_int64_t _initial_pcmoffset(OggVorbis_File *vf, vorbis_info *vi){
while((result=ogg_stream_packetout(&vf->os,&op))){
if(result>0){ /* ignore holes */
long thisblock=vorbis_packet_blocksize(vi,&op);
- if(lastblock!=-1)
- accumulated+=(lastblock+thisblock)>>2;
- lastblock=thisblock;
+ if(thisblock>=0){
+ if(lastblock!=-1)
+ accumulated+=(lastblock+thisblock)>>2;
+ lastblock=thisblock;
+ }
}
}

--
1.7.1

@@ -0,0 +1,26 @@
From 1a72827e1ad990b09f252c4f643b762b8070e8f5 Mon Sep 17 00:00:00 2001
From: sezero <sezero@users.sourceforge.net>
Date: Tue, 20 Mar 2018 11:24:24 +0300
Subject: [PATCH] configury: do AC_LIBTOOL_WIN32_DLL for win32 dll builds

---
configure.in | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/configure.in b/configure.in
index e7f5690..152cb04 100644
--- a/configure.in
+++ b/configure.in
@@ -36,7 +36,8 @@ AC_PROG_CC
AC_PROG_CPP
CFLAGS="$cflags_save"

-AM_PROG_LIBTOOL
+AC_LIBTOOL_WIN32_DLL
+AC_PROG_LIBTOOL

dnl --------------------------------------------------
dnl Set build flags based on environment
--
1.7.1

@@ -0,0 +1,41 @@
From f016bee5e8682cdb387434c1ff83c8274a8e4578 Mon Sep 17 00:00:00 2001
From: sezero <sezero@users.sourceforge.net>
Date: Tue, 20 Mar 2018 11:27:00 +0300
Subject: [PATCH] configury: add Version_script to LDFLAGS after all checks

because Version_script won't be generated yet.
---
configure.in | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/configure.in b/configure.in
index 152cb04..98d5395 100644
--- a/configure.in
+++ b/configure.in
@@ -79,10 +79,6 @@ LDFLAGS="$LDFLAGS $ldflags_save"
# Test whenever ld supports -version-script
AC_PROG_LD
AC_PROG_LD_GNU
-if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
- SHLIB_VERSION_ARG="-Wl,--version-script=Version_script"
- LDFLAGS="$LDFLAGS $SHLIB_VERSION_ARG"
-fi

dnl --------------------------------------------------
dnl Options
@@ -134,6 +130,12 @@ dnl --------------------------------------------------
AC_FUNC_ALLOCA
AC_FUNC_MEMCMP

+# do this last after all checks, because Version_script is not generated yet.
+if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
+ SHLIB_VERSION_ARG="-Wl,--version-script=Version_script"
+ LDFLAGS="$LDFLAGS $SHLIB_VERSION_ARG"
+fi
+
dnl --------------------------------------------------
dnl Do substitutions
dnl --------------------------------------------------
--
1.7.1

@@ -0,0 +1,33 @@
From 35994da5e574e7e0c256ca1fc3cb903a9afe7eff Mon Sep 17 00:00:00 2001
From: sezero <sezero@users.sourceforge.net>
Date: Tue, 20 Mar 2018 11:29:10 +0300
Subject: [PATCH] configury: add -no-undefined to libvorbisidec_la_LDFLAGS

---
Makefile.am | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 0a4bb2c..60c39fa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
AUTOMAKE_OPTIONS = foreign

-INCLUDES = -I./ @OGG_CFLAGS@
+INCLUDES = -I. @OGG_CFLAGS@

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = vorbisidec.pc
@@ -17,7 +17,7 @@ libvorbisidec_la_SOURCES = mdct.c block.c window.c \
registry.h window.h window_lookup.h\
codec_internal.h backends.h \
asm_arm.h ivorbiscodec.h
-libvorbisidec_la_LDFLAGS = -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@
+libvorbisidec_la_LDFLAGS = -no-undefined -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@
libvorbisidec_la_LIBADD = @OGG_LIBS@

EXTRA_PROGRAMS = ivorbisfile_example iseeking_example
--
1.7.1

27 changes: 27 additions & 0 deletions external/libvorbisidec-1.2.1/0007-os.h-include-config.h.patch
@@ -0,0 +1,27 @@
From a31174f922504f54acf47b2088f75c37d1f2cfa1 Mon Sep 17 00:00:00 2001
From: sezero <sezero@users.sourceforge.net>
Date: Tue, 20 Mar 2018 11:30:00 +0300
Subject: [PATCH] os.h: include config.h

---
os.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/os.h b/os.h
index 12ba684..69dc200 100644
--- a/os.h
+++ b/os.h
@@ -17,6 +17,10 @@

********************************************************************/

+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <math.h>
#include <ogg/os_types.h>

--
1.7.1

@@ -0,0 +1,89 @@
From b9773c676623706fcd1a9446b97662821c62f83c Mon Sep 17 00:00:00 2001
From: sezero <sezero@users.sourceforge.net>
Date: Tue, 20 Mar 2018 11:33:28 +0300
Subject: [PATCH] remove const from LOOKUP_T definition to avoid 'double const' warnings

---
mdct.c | 10 +++++-----
misc.h | 4 ++--
window.c | 5 ++++-
3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/mdct.c b/mdct.c
index 2aed62c..3ad4483 100644
--- a/mdct.c
+++ b/mdct.c
@@ -147,7 +147,7 @@ STIN void mdct_butterfly_32(DATA_TYPE *x){
/* N/stage point generic N stage butterfly (in place, 2 register) */
STIN void mdct_butterfly_generic(DATA_TYPE *x,int points,int step){

- LOOKUP_T *T = sincos_lookup0;
+ const LOOKUP_T *T = sincos_lookup0;
DATA_TYPE *x1 = x + points - 8;
DATA_TYPE *x2 = x + (points>>1) - 8;
REG_TYPE r0;
@@ -257,8 +257,8 @@ STIN void mdct_bitreverse(DATA_TYPE *x,int n,int step,int shift){
int bit = 0;
DATA_TYPE *w0 = x;
DATA_TYPE *w1 = x = w0+(n>>1);
- LOOKUP_T *T = (step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
- LOOKUP_T *Ttop = T+1024;
+ const LOOKUP_T *T = (step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
+ const LOOKUP_T *Ttop = T+1024;
DATA_TYPE r2;

do{
@@ -342,8 +342,8 @@ void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out){
int n4=n>>2;
DATA_TYPE *iX;
DATA_TYPE *oX;
- LOOKUP_T *T;
- LOOKUP_T *V;
+ const LOOKUP_T *T;
+ const LOOKUP_T *V;
int shift;
int step;

diff --git a/misc.h b/misc.h
index 1ae4d2e..ee5660d 100644
--- a/misc.h
+++ b/misc.h
@@ -22,10 +22,10 @@

#ifdef _LOW_ACCURACY_
# define X(n) (((((n)>>22)+1)>>1) - ((((n)>>22)+1)>>9))
-# define LOOKUP_T const unsigned char
+# define LOOKUP_T unsigned char
#else
# define X(n) (n)
-# define LOOKUP_T const ogg_int32_t
+# define LOOKUP_T ogg_int32_t
#endif

#include "asm_arm.h"
diff --git a/window.c b/window.c
index 006a1ee..3f2917f 100644
--- a/window.c
+++ b/window.c
@@ -56,7 +56,7 @@ void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2],
long *blocksizes,
int lW,int W,int nW){

- LOOKUP_T *window[2]={window_p[0],window_p[1]};
+ const LOOKUP_T *window[2];
long n=blocksizes[W];
long ln=blocksizes[lW];
long rn=blocksizes[nW];
@@ -69,6 +69,9 @@ void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2],

int i,p;

+ window[0] = (const LOOKUP_T *)window_p[0];
+ window[1] = (const LOOKUP_T *)window_p[1];
+
for(i=0;i<leftbegin;i++)
d[i]=0;

--
1.7.1

0 comments on commit 7e2e3c8

Please sign in to comment.