Debian Codegraph @

external/vorbis/vorbis_synthesis.cpp

raw symbols SCIP
1 /********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 * *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2015 *
9 * by the Xiph.Org Foundation https://xiph.org/ *
10 * *
11 ********************************************************************
12
13 function: single-block PCM synthesis
14
15 ********************************************************************/
16
17 #include "ogg.h"cxx . . $ `<file>/external/vorbis/ogg.h`/
18 #include "vorbis_codec.h"cxx . . $ `<file>/external/vorbis/vorbis_codec.h`/
19 #include "vorbis_codec_internal.h"cxx . . $ `<file>/external/vorbis/vorbis_codec_internal.h`/
20 #include "vorbis_registry.h"cxx . . $ `<file>/external/vorbis/vorbis_registry.h`/
21 #include "vorbis_misc.h"cxx . . $ `<file>/external/vorbis/vorbis_misc.h`/
22 #include "vorbis_os.h"cxx . . $ `<file>/external/vorbis/vorbis_os.h`/
23
24 int vorbis_synthesiscxx . . $ vorbis_synthesis(e9de88148c52a299).(vorbis_blockcxx . . $ vorbis_block# *vb,ogg_packetcxx . . $ ogg_packet# *op){
25 vorbis_dsp_statecxx . . $ vorbis_dsp_state# *vd= vb ? vb->vdcxx . . $ vorbis_block#vd. : 0;
26 private_statecxx . . $ private_state# *b = (private_statecxx . . $ private_state# *) (vd ? vd->backend_statecxx . . $ vorbis_dsp_state#backend_state. : nullptr);
27 vorbis_infocxx . . $ vorbis_info# *vi= vd ? vd->vicxx . . $ vorbis_dsp_state#vi. : 0;
28 codec_setup_infocxx . . $ codec_setup_info# *ci = (codec_setup_infocxx . . $ codec_setup_info# *) (vi ? vi->codec_setupcxx . . $ vorbis_info#codec_setup. : nullptr);
29 oggpack_buffercxx . . $ oggpack_buffer# *opb=vb ? &vb->opbcxx . . $ vorbis_block#opb. : 0;
30 int type,mode,i;
31
32 if (!vd || !b || !vi || !ci || !opb) {
33 return OV_EBADPACKETcxx . . $ `external/vorbis/vorbis_codec.h:228:9`!;
34 }
35
36 /* first things first. Make sure decode is ready */
37 _vorbis_block_ripcordcxx . . $ _vorbis_block_ripcord(b02413cf866c4e1f).(vb);
38 oggpack_readinitcxx . . $ oggpack_readinit(c5e395f807ba7ecc).(opb,op->packetcxx . . $ $anonymous_type_d401cdaf801be98c_4#packet.,op->bytescxx . . $ $anonymous_type_d401cdaf801be98c_4#bytes.);
39
40 /* Check the packet type */
41 if(oggpack_readcxx . . $ oggpack_read(e96bf1ebf62076a2).(opb,1)!=0){
42 /* Oops. This is not an audio data packet */
43 return(OV_ENOTAUDIOcxx . . $ `external/vorbis/vorbis_codec.h:227:9`!);
44 }
45
46 /* read our mode and pre/post windowsize */
47 mode=oggpack_readcxx . . $ oggpack_read(e96bf1ebf62076a2).(opb,b->modebitscxx . . $ private_state#modebits.);
48 if(mode==-1){
49 return(OV_EBADPACKETcxx . . $ `external/vorbis/vorbis_codec.h:228:9`!);
50 }
51
52 vb->modecxx . . $ vorbis_block#mode.=mode;
53 if(!ci->mode_paramcxx . . $ codec_setup_info#mode_param.[mode]){
54 return(OV_EBADPACKETcxx . . $ `external/vorbis/vorbis_codec.h:228:9`!);
55 }
56
57 vb->Wcxx . . $ vorbis_block#W.=ci->mode_paramcxx . . $ codec_setup_info#mode_param.[mode]->blockflagcxx . . $ $anonymous_type_ab7b9b6ac923d5fa_0#blockflag.;
58 if(vb->Wcxx . . $ vorbis_block#W.){
59
60 /* this doesn;t get mapped through mode selection as it's used
61 only for window selection */
62 vb->lWcxx . . $ vorbis_block#lW.=oggpack_readcxx . . $ oggpack_read(e96bf1ebf62076a2).(opb,1);
63 vb->nWcxx . . $ vorbis_block#nW.=oggpack_readcxx . . $ oggpack_read(e96bf1ebf62076a2).(opb,1);
64 if(vb->nWcxx . . $ vorbis_block#nW.==-1){
65 return(OV_EBADPACKETcxx . . $ `external/vorbis/vorbis_codec.h:228:9`!);
66 }
67 }else{
68 vb->lWcxx . . $ vorbis_block#lW.=0;
69 vb->nWcxx . . $ vorbis_block#nW.=0;
70 }
71
72 /* more setup */
73 vb->granuleposcxx . . $ vorbis_block#granulepos.=op->granuleposcxx . . $ $anonymous_type_d401cdaf801be98c_4#granulepos.;
74 vb->sequencecxx . . $ vorbis_block#sequence.=op->packetnocxx . . $ $anonymous_type_d401cdaf801be98c_4#packetno.;
75 vb->eofflagcxx . . $ vorbis_block#eofflag.=op->e_o_scxx . . $ $anonymous_type_d401cdaf801be98c_4#e_o_s.;
76
77 /* alloc pcm passback storage */
78 vb->pcmendcxx . . $ vorbis_block#pcmend.=ci->blocksizescxx . . $ codec_setup_info#blocksizes.[vb->Wcxx . . $ vorbis_block#W.];
79 vb->pcmcxx . . $ vorbis_block#pcm.= (float **) _vorbis_block_alloccxx . . $ _vorbis_block_alloc(339031f86f86193e).(vb,sizeof(*vb->pcmcxx . . $ vorbis_block#pcm.)*vi->channelscxx . . $ vorbis_info#channels.);
80 for(i=0;i<vi->channelscxx . . $ vorbis_info#channels.;i++)
81 vb->pcmcxx . . $ vorbis_block#pcm.[i] = (float *)_vorbis_block_alloccxx . . $ _vorbis_block_alloc(339031f86f86193e).(vb,vb->pcmendcxx . . $ vorbis_block#pcmend.*sizeof(*vb->pcmcxx . . $ vorbis_block#pcm.[i]));
82
83 /* unpack_header enforces range checking */
84 type=ci->map_typecxx . . $ codec_setup_info#map_type.[ci->mode_paramcxx . . $ codec_setup_info#mode_param.[mode]->mappingcxx . . $ $anonymous_type_ab7b9b6ac923d5fa_0#mapping.];
85
86 return(_mapping_Pcxx . . $ _mapping_P.[type]->inversecxx . . $ $anonymous_type_f527c519943fbe69_4#inverse.(vb,ci->map_paramcxx . . $ codec_setup_info#map_param.[ci->mode_paramcxx . . $ codec_setup_info#mode_param.[mode]->
87 mappingcxx . . $ $anonymous_type_ab7b9b6ac923d5fa_0#mapping.]));
88 }
89
90 /* used to track pcm position without actually performing decode.
91 Useful for sequential 'fast forward' */
92 int vorbis_synthesis_trackonlycxx . . $ vorbis_synthesis_trackonly(e9de88148c52a299).(vorbis_blockcxx . . $ vorbis_block# *vb,ogg_packetcxx . . $ ogg_packet# *op){
93 vorbis_dsp_statecxx . . $ vorbis_dsp_state# *vd=vb->vdcxx . . $ vorbis_block#vd.;
94 private_statecxx . . $ private_state# *b= (private_statecxx . . $ private_state# *) vd->backend_statecxx . . $ vorbis_dsp_state#backend_state.;
95 vorbis_infocxx . . $ vorbis_info# *vi=vd->vicxx . . $ vorbis_dsp_state#vi.;
96 codec_setup_infocxx . . $ codec_setup_info# *ci = (codec_setup_infocxx . . $ codec_setup_info# *) vi->codec_setupcxx . . $ vorbis_info#codec_setup.;
97 oggpack_buffercxx . . $ oggpack_buffer# *opb=&vb->opbcxx . . $ vorbis_block#opb.;
98 int mode;
99
100 /* first things first. Make sure decode is ready */
101 _vorbis_block_ripcordcxx . . $ _vorbis_block_ripcord(b02413cf866c4e1f).(vb);
102 oggpack_readinitcxx . . $ oggpack_readinit(c5e395f807ba7ecc).(opb,op->packetcxx . . $ $anonymous_type_d401cdaf801be98c_4#packet.,op->bytescxx . . $ $anonymous_type_d401cdaf801be98c_4#bytes.);
103
104 /* Check the packet type */
105 if(oggpack_readcxx . . $ oggpack_read(e96bf1ebf62076a2).(opb,1)!=0){
106 /* Oops. This is not an audio data packet */
107 return(OV_ENOTAUDIOcxx . . $ `external/vorbis/vorbis_codec.h:227:9`!);
108 }
109
110 /* read our mode and pre/post windowsize */
111 mode=oggpack_readcxx . . $ oggpack_read(e96bf1ebf62076a2).(opb,b->modebitscxx . . $ private_state#modebits.);
112 if(mode==-1)return(OV_EBADPACKETcxx . . $ `external/vorbis/vorbis_codec.h:228:9`!);
113
114 vb->modecxx . . $ vorbis_block#mode.=mode;
115 if(!ci->mode_paramcxx . . $ codec_setup_info#mode_param.[mode]){
116 return(OV_EBADPACKETcxx . . $ `external/vorbis/vorbis_codec.h:228:9`!);
117 }
118
119 vb->Wcxx . . $ vorbis_block#W.=ci->mode_paramcxx . . $ codec_setup_info#mode_param.[mode]->blockflagcxx . . $ $anonymous_type_ab7b9b6ac923d5fa_0#blockflag.;
120 if(vb->Wcxx . . $ vorbis_block#W.){
121 vb->lWcxx . . $ vorbis_block#lW.=oggpack_readcxx . . $ oggpack_read(e96bf1ebf62076a2).(opb,1);
122 vb->nWcxx . . $ vorbis_block#nW.=oggpack_readcxx . . $ oggpack_read(e96bf1ebf62076a2).(opb,1);
123 if(vb->nWcxx . . $ vorbis_block#nW.==-1) return(OV_EBADPACKETcxx . . $ `external/vorbis/vorbis_codec.h:228:9`!);
124 }else{
125 vb->lWcxx . . $ vorbis_block#lW.=0;
126 vb->nWcxx . . $ vorbis_block#nW.=0;
127 }
128
129 /* more setup */
130 vb->granuleposcxx . . $ vorbis_block#granulepos.=op->granuleposcxx . . $ $anonymous_type_d401cdaf801be98c_4#granulepos.;
131 vb->sequencecxx . . $ vorbis_block#sequence.=op->packetnocxx . . $ $anonymous_type_d401cdaf801be98c_4#packetno.;
132 vb->eofflagcxx . . $ vorbis_block#eofflag.=op->e_o_scxx . . $ $anonymous_type_d401cdaf801be98c_4#e_o_s.;
133
134 /* no pcm */
135 vb->pcmendcxx . . $ vorbis_block#pcmend.=0;
136 vb->pcmcxx . . $ vorbis_block#pcm.=nullptr;
137
138 return(0);
139 }
140
141 long vorbis_packet_blocksizecxx . . $ vorbis_packet_blocksize(5c730016bfddf4b1).(vorbis_infocxx . . $ vorbis_info# *vi,ogg_packetcxx . . $ ogg_packet# *op){
142 codec_setup_infocxx . . $ codec_setup_info# *ci = (codec_setup_infocxx . . $ codec_setup_info# *) vi->codec_setupcxx . . $ vorbis_info#codec_setup.;
143 oggpack_buffercxx . . $ oggpack_buffer# opb;
144 int mode;
145
146 if(ci==nullptr || ci->modescxx . . $ codec_setup_info#modes.<=0){
147 /* codec setup not properly intialized */
148 return(OV_EFAULTcxx . . $ `external/vorbis/vorbis_codec.h:221:9`!);
149 }
150
151 oggpack_readinitcxx . . $ oggpack_readinit(c5e395f807ba7ecc).(&opb,op->packetcxx . . $ $anonymous_type_d401cdaf801be98c_4#packet.,op->bytescxx . . $ $anonymous_type_d401cdaf801be98c_4#bytes.);
152
153 /* Check the packet type */
154 if(oggpack_readcxx . . $ oggpack_read(e96bf1ebf62076a2).(&opb,1)!=0){
155 /* Oops. This is not an audio data packet */
156 return(OV_ENOTAUDIOcxx . . $ `external/vorbis/vorbis_codec.h:227:9`!);
157 }
158
159 /* read our mode and pre/post windowsize */
160 mode=oggpack_readcxx . . $ oggpack_read(e96bf1ebf62076a2).(&opb,ov_ilogcxx . . $ ov_ilog(4c679297bf94b9eb).(ci->modescxx . . $ codec_setup_info#modes.-1));
161 if(mode==-1 || !ci->mode_paramcxx . . $ codec_setup_info#mode_param.[mode])return(OV_EBADPACKETcxx . . $ `external/vorbis/vorbis_codec.h:228:9`!);
162 return(ci->blocksizescxx . . $ codec_setup_info#blocksizes.[ci->mode_paramcxx . . $ codec_setup_info#mode_param.[mode]->blockflagcxx . . $ $anonymous_type_ab7b9b6ac923d5fa_0#blockflag.]);
163 }
164
165 int vorbis_synthesis_halfratecxx . . $ vorbis_synthesis_halfrate(567c21d5828d03ac).(vorbis_infocxx . . $ vorbis_info# *vi,int flag){
166 /* set / clear half-sample-rate mode */
167 codec_setup_infocxx . . $ codec_setup_info# *ci = (codec_setup_infocxx . . $ codec_setup_info# *) vi->codec_setupcxx . . $ vorbis_info#codec_setup.;
168
169 /* right now, our MDCT can't handle < 64 sample windows. */
170 if(ci->blocksizescxx . . $ codec_setup_info#blocksizes.[0]<=64 && flag)return -1;
171 ci->halfrate_flagcxx . . $ codec_setup_info#halfrate_flag.=(flag?1:0);
172 return 0;
173 }
174
175 int vorbis_synthesis_halfrate_pcxx . . $ vorbis_synthesis_halfrate_p(8afef93073a461ef).(vorbis_infocxx . . $ vorbis_info# *vi){
176 codec_setup_infocxx . . $ codec_setup_info# *ci = (codec_setup_infocxx . . $ codec_setup_info# *) vi->codec_setupcxx . . $ vorbis_info#codec_setup.;
177 return ci->halfrate_flagcxx . . $ codec_setup_info#halfrate_flag.;
178 }