From 7ec0ff2589ffd5774e78f9e6b436ea55be45deb1 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 14 Feb 2024 12:21:33 +1100 Subject: Switch to the lowmem tremor branch in addition to using slightly less memory, this branch also doesn't seem to have the same issues with `-O2` builds that the main branch has. --- lib/tremor/codec_internal.h | 191 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 156 insertions(+), 35 deletions(-) (limited to 'lib/tremor/codec_internal.h') diff --git a/lib/tremor/codec_internal.h b/lib/tremor/codec_internal.h index 3ca7f547..f9a768bb 100644 --- a/lib/tremor/codec_internal.h +++ b/lib/tremor/codec_internal.h @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. * * * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 * * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * * * ******************************************************************** @@ -18,36 +18,149 @@ #ifndef _V_CODECI_H_ #define _V_CODECI_H_ +#define CHUNKSIZE 1024 + #include "codebook.h" +#include "ivorbiscodec.h" + +#define VI_TRANSFORMB 1 +#define VI_WINDOWB 1 +#define VI_TIMEB 1 +#define VI_FLOORB 2 +#define VI_RESB 3 +#define VI_MAPB 1 -typedef void vorbis_look_mapping; -typedef void vorbis_look_floor; -typedef void vorbis_look_residue; -typedef void vorbis_look_transform; +typedef void vorbis_info_floor; + +/* vorbis_dsp_state buffers the current vorbis audio + analysis/synthesis state. The DSP state belongs to a specific + logical bitstream ****************************************************/ +struct vorbis_dsp_state{ + vorbis_info *vi; + tremor_oggpack_buffer opb; + + tremor_ogg_int32_t **work; + tremor_ogg_int32_t **mdctright; + int out_begin; + int out_end; + + long lW; + long W; + + tremor_ogg_int64_t granulepos; + tremor_ogg_int64_t sequence; + tremor_ogg_int64_t sample_count; + +}; + + +/* Floor backend generic *****************************************/ + +extern vorbis_info_floor *floor0_info_unpack(vorbis_info *,tremor_oggpack_buffer *); +extern void floor0_free_info(vorbis_info_floor *); +extern int floor0_memosize(vorbis_info_floor *); +extern tremor_ogg_int32_t *floor0_inverse1(struct vorbis_dsp_state *, + vorbis_info_floor *,tremor_ogg_int32_t *); +extern int floor0_inverse2 (struct vorbis_dsp_state *,vorbis_info_floor *, + tremor_ogg_int32_t *buffer,tremor_ogg_int32_t *); + +extern vorbis_info_floor *floor1_info_unpack(vorbis_info *,tremor_oggpack_buffer *); +extern void floor1_free_info(vorbis_info_floor *); +extern int floor1_memosize(vorbis_info_floor *); +extern tremor_ogg_int32_t *floor1_inverse1(struct vorbis_dsp_state *, + vorbis_info_floor *,tremor_ogg_int32_t *); +extern int floor1_inverse2 (struct vorbis_dsp_state *,vorbis_info_floor *, + tremor_ogg_int32_t *buffer,tremor_ogg_int32_t *); + +typedef struct{ + int order; + long rate; + long barkmap; + + int ampbits; + int ampdB; + + int numbooks; /* <= 16 */ + char books[16]; + +} vorbis_info_floor0; + +typedef struct{ + char class_dim; /* 1 to 8 */ + char class_subs; /* 0,1,2,3 (bits: 1<