65012fd005f23a520fd0a557dd6959e95e4c1934
[platform/upstream/libvorbis.git] / lib / res0.c
1 /********************************************************************
2  *                                                                  *
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.                            *
7  *                                                                  *
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/                                             *
11  *                                                                  *
12  ********************************************************************
13
14  function: residue backend 0 implementation
15  last mod: $Id: res0.c,v 1.4 2000/02/06 13:39:46 xiphmont Exp $
16
17  ********************************************************************/
18
19 #include <stdlib.h>
20 #include <string.h>
21 #include <math.h>
22 #include "vorbis/codec.h"
23 #include "bitwise.h"
24 #include "registry.h"
25
26 /* unfinished as of 20000118 */
27
28 void free_info(vorbis_info_residue *i){
29 }
30
31 void free_look(vorbis_look_residue *i){
32 }
33
34 /* not yet */
35 void pack(vorbis_info_residue *vr,oggpack_buffer *opb){
36 }
37
38 /* vorbis_info is for range checking */
39 vorbis_info_residue *unpack(vorbis_info *vi,oggpack_buffer *opb){
40   return "";
41 }
42
43 vorbis_look_residue *look (vorbis_info *vi,vorbis_info_mode *vm,
44                           vorbis_info_residue *vr){
45   return "";
46 }
47
48 int forward(vorbis_block *vb,vorbis_look_residue *l,
49             double **in,int **aux,int ch){
50   long i,j;
51   for(i=0;i<ch;i++)
52     for(j=0;j<vb->pcmend/2;j++)
53       _oggpack_write(&vb->opb,rint(in[i][j])+16,5);
54   return(0);
55 }
56
57 int inverse(vorbis_block *vb,vorbis_look_residue *l,double **in,int ch){
58   long i,j;
59   for(i=0;i<ch;i++)
60     for(j=0;j<vb->pcmend/2;j++)
61       in[i][j]*=_oggpack_read(&vb->opb,5)-16;
62   return(0);
63 }
64
65 vorbis_func_residue residue0_exportbundle={
66   &pack,
67   &unpack,
68   &look,
69   &free_info,
70   &free_look,
71   &forward,
72   &inverse
73 };