Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /******************************************************************** |
michael@0 | 2 | * * |
michael@0 | 3 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * |
michael@0 | 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * |
michael@0 | 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * |
michael@0 | 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * |
michael@0 | 7 | * * |
michael@0 | 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * |
michael@0 | 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * |
michael@0 | 10 | * * |
michael@0 | 11 | ******************************************************************** |
michael@0 | 12 | |
michael@0 | 13 | function: libvorbis backend and mapping structures; needed for |
michael@0 | 14 | static mode headers |
michael@0 | 15 | last mod: $Id: backends.h 16962 2010-03-11 07:30:34Z xiphmont $ |
michael@0 | 16 | |
michael@0 | 17 | ********************************************************************/ |
michael@0 | 18 | |
michael@0 | 19 | /* this is exposed up here because we need it for static modes. |
michael@0 | 20 | Lookups for each backend aren't exposed because there's no reason |
michael@0 | 21 | to do so */ |
michael@0 | 22 | |
michael@0 | 23 | #ifndef _vorbis_backend_h_ |
michael@0 | 24 | #define _vorbis_backend_h_ |
michael@0 | 25 | |
michael@0 | 26 | #include "codec_internal.h" |
michael@0 | 27 | |
michael@0 | 28 | /* this would all be simpler/shorter with templates, but.... */ |
michael@0 | 29 | /* Floor backend generic *****************************************/ |
michael@0 | 30 | typedef struct{ |
michael@0 | 31 | void (*pack) (vorbis_info_floor *,oggpack_buffer *); |
michael@0 | 32 | vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *); |
michael@0 | 33 | vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_floor *); |
michael@0 | 34 | void (*free_info) (vorbis_info_floor *); |
michael@0 | 35 | void (*free_look) (vorbis_look_floor *); |
michael@0 | 36 | void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *); |
michael@0 | 37 | int (*inverse2) (struct vorbis_block *,vorbis_look_floor *, |
michael@0 | 38 | void *buffer,float *); |
michael@0 | 39 | } vorbis_func_floor; |
michael@0 | 40 | |
michael@0 | 41 | typedef struct{ |
michael@0 | 42 | int order; |
michael@0 | 43 | long rate; |
michael@0 | 44 | long barkmap; |
michael@0 | 45 | |
michael@0 | 46 | int ampbits; |
michael@0 | 47 | int ampdB; |
michael@0 | 48 | |
michael@0 | 49 | int numbooks; /* <= 16 */ |
michael@0 | 50 | int books[16]; |
michael@0 | 51 | |
michael@0 | 52 | float lessthan; /* encode-only config setting hacks for libvorbis */ |
michael@0 | 53 | float greaterthan; /* encode-only config setting hacks for libvorbis */ |
michael@0 | 54 | |
michael@0 | 55 | } vorbis_info_floor0; |
michael@0 | 56 | |
michael@0 | 57 | |
michael@0 | 58 | #define VIF_POSIT 63 |
michael@0 | 59 | #define VIF_CLASS 16 |
michael@0 | 60 | #define VIF_PARTS 31 |
michael@0 | 61 | typedef struct{ |
michael@0 | 62 | int partitions; /* 0 to 31 */ |
michael@0 | 63 | int partitionclass[VIF_PARTS]; /* 0 to 15 */ |
michael@0 | 64 | |
michael@0 | 65 | int class_dim[VIF_CLASS]; /* 1 to 8 */ |
michael@0 | 66 | int class_subs[VIF_CLASS]; /* 0,1,2,3 (bits: 1<<n poss) */ |
michael@0 | 67 | int class_book[VIF_CLASS]; /* subs ^ dim entries */ |
michael@0 | 68 | int class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */ |
michael@0 | 69 | |
michael@0 | 70 | |
michael@0 | 71 | int mult; /* 1 2 3 or 4 */ |
michael@0 | 72 | int postlist[VIF_POSIT+2]; /* first two implicit */ |
michael@0 | 73 | |
michael@0 | 74 | |
michael@0 | 75 | /* encode side analysis parameters */ |
michael@0 | 76 | float maxover; |
michael@0 | 77 | float maxunder; |
michael@0 | 78 | float maxerr; |
michael@0 | 79 | |
michael@0 | 80 | float twofitweight; |
michael@0 | 81 | float twofitatten; |
michael@0 | 82 | |
michael@0 | 83 | int n; |
michael@0 | 84 | |
michael@0 | 85 | } vorbis_info_floor1; |
michael@0 | 86 | |
michael@0 | 87 | /* Residue backend generic *****************************************/ |
michael@0 | 88 | typedef struct{ |
michael@0 | 89 | void (*pack) (vorbis_info_residue *,oggpack_buffer *); |
michael@0 | 90 | vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *); |
michael@0 | 91 | vorbis_look_residue *(*look) (vorbis_dsp_state *, |
michael@0 | 92 | vorbis_info_residue *); |
michael@0 | 93 | void (*free_info) (vorbis_info_residue *); |
michael@0 | 94 | void (*free_look) (vorbis_look_residue *); |
michael@0 | 95 | long **(*class) (struct vorbis_block *,vorbis_look_residue *, |
michael@0 | 96 | int **,int *,int); |
michael@0 | 97 | int (*forward) (oggpack_buffer *,struct vorbis_block *, |
michael@0 | 98 | vorbis_look_residue *, |
michael@0 | 99 | int **,int *,int,long **,int); |
michael@0 | 100 | int (*inverse) (struct vorbis_block *,vorbis_look_residue *, |
michael@0 | 101 | float **,int *,int); |
michael@0 | 102 | } vorbis_func_residue; |
michael@0 | 103 | |
michael@0 | 104 | typedef struct vorbis_info_residue0{ |
michael@0 | 105 | /* block-partitioned VQ coded straight residue */ |
michael@0 | 106 | long begin; |
michael@0 | 107 | long end; |
michael@0 | 108 | |
michael@0 | 109 | /* first stage (lossless partitioning) */ |
michael@0 | 110 | int grouping; /* group n vectors per partition */ |
michael@0 | 111 | int partitions; /* possible codebooks for a partition */ |
michael@0 | 112 | int partvals; /* partitions ^ groupbook dim */ |
michael@0 | 113 | int groupbook; /* huffbook for partitioning */ |
michael@0 | 114 | int secondstages[64]; /* expanded out to pointers in lookup */ |
michael@0 | 115 | int booklist[512]; /* list of second stage books */ |
michael@0 | 116 | |
michael@0 | 117 | const int classmetric1[64]; |
michael@0 | 118 | const int classmetric2[64]; |
michael@0 | 119 | } vorbis_info_residue0; |
michael@0 | 120 | |
michael@0 | 121 | /* Mapping backend generic *****************************************/ |
michael@0 | 122 | typedef struct{ |
michael@0 | 123 | void (*pack) (vorbis_info *,vorbis_info_mapping *, |
michael@0 | 124 | oggpack_buffer *); |
michael@0 | 125 | vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *); |
michael@0 | 126 | void (*free_info) (vorbis_info_mapping *); |
michael@0 | 127 | int (*forward) (struct vorbis_block *vb); |
michael@0 | 128 | int (*inverse) (struct vorbis_block *vb,vorbis_info_mapping *); |
michael@0 | 129 | } vorbis_func_mapping; |
michael@0 | 130 | |
michael@0 | 131 | typedef struct vorbis_info_mapping0{ |
michael@0 | 132 | int submaps; /* <= 16 */ |
michael@0 | 133 | int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */ |
michael@0 | 134 | |
michael@0 | 135 | int floorsubmap[16]; /* [mux] submap to floors */ |
michael@0 | 136 | int residuesubmap[16]; /* [mux] submap to residue */ |
michael@0 | 137 | |
michael@0 | 138 | int coupling_steps; |
michael@0 | 139 | int coupling_mag[256]; |
michael@0 | 140 | int coupling_ang[256]; |
michael@0 | 141 | |
michael@0 | 142 | } vorbis_info_mapping0; |
michael@0 | 143 | |
michael@0 | 144 | #endif |