1 /********************************************************************
3 * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
5 * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
6 * PLEASE READ THESE TERMS DISTRIBUTING. *
8 * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
9 * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
10 * http://www.xiph.org/ *
12 ********************************************************************
14 function: single-block PCM synthesis
15 last mod: $Id: synthesis.c,v 1.13 2000/01/20 04:43:04 xiphmont Exp $
17 ********************************************************************/
20 #include "vorbis/codec.h"
24 int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
25 vorbis_dsp_state *vd=vb->vd;
26 vorbis_info *vi=vd->vi;
27 oggpack_buffer *opb=&vb->opb;
31 /* first things first. Make sure decode is ready */
32 _vorbis_block_ripcord(vb);
33 _oggpack_readinit(opb,op->packet,op->bytes);
35 /* Check the packet type */
36 if(_oggpack_read(opb,1)!=0){
37 /* Oops. This is not an audio data packet */
42 mode=_oggpack_read(&vb->opb,vd->modebits);
43 type=vi->mappingtypes[mode]; /* unpack_header enforces range checking */
45 return(vorbis_map_synthesis_P[type](vb,vi->modelist[mode],op));