1e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard/*
2e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** Copyright 2003-2010, VisualOn, Inc.
3e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard **
4e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** Licensed under the Apache License, Version 2.0 (the "License");
5e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** you may not use this file except in compliance with the License.
6e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** You may obtain a copy of the License at
7e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard **
8e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard **     http://www.apache.org/licenses/LICENSE-2.0
9e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard **
10e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** Unless required by applicable law or agreed to in writing, software
11e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** distributed under the License is distributed on an "AS IS" BASIS,
12e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** See the License for the specific language governing permissions and
14e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** limitations under the License.
15e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard */
16e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
17e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard/***********************************************************************
18e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard*      File: q_pulse.c                                                 *
19e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard*                                                                      *
20e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard*      Description: Coding and decoding of algebraic codebook          *
21e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard*                                                                      *
22e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard************************************************************************/
23e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
24e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#include <stdio.h>
25e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#include "typedef.h"
26e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#include "basic_op.h"
27e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#include "q_pulse.h"
28e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
29e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define NB_POS 16                          /* pos in track, mask for sign bit */
30e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
31e2e838afcf03e603a41a0455846eaf9614537c16Mans RullgardWord32 quant_1p_N1(                        /* (o) return N+1 bits             */
32e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 pos,                        /* (i) position of the pulse       */
33e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 N)                          /* (i) number of bits for position */
34e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard{
35e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word16 mask;
36e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word32 index;
37e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
38e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	mask = (1 << N) - 1;              /* mask = ((1<<N)-1); */
39e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	/*-------------------------------------------------------*
40e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	 * Quantization of 1 pulse with N+1 bits:                *
41e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	 *-------------------------------------------------------*/
42e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	index = L_deposit_l((Word16) (pos & mask));
43e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	if ((pos & NB_POS) != 0)
44e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	{
45e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		index = vo_L_add(index, L_deposit_l(1 << N));   /* index += 1 << N; */
46e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	}
47e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	return (index);
48e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard}
49e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
50e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
51e2e838afcf03e603a41a0455846eaf9614537c16Mans RullgardWord32 quant_2p_2N1(                       /* (o) return (2*N)+1 bits         */
52e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 pos1,                          /* (i) position of the pulse 1     */
53e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 pos2,                          /* (i) position of the pulse 2     */
54e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 N)                             /* (i) number of bits for position */
55e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard{
56e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word16 mask, tmp;
57e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word32 index;
58e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	mask = (1 << N) - 1;              /* mask = ((1<<N)-1); */
59e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	/*-------------------------------------------------------*
60e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	 * Quantization of 2 pulses with 2*N+1 bits:             *
61e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	 *-------------------------------------------------------*/
62e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	if (((pos2 ^ pos1) & NB_POS) == 0)
63e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	{
64e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		/* sign of 1st pulse == sign of 2th pulse */
65e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		if(pos1 <= pos2)          /* ((pos1 - pos2) <= 0) */
66e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		{
67e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			/* index = ((pos1 & mask) << N) + (pos2 & mask); */
68e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = L_deposit_l(add1((((Word16) (pos1 & mask)) << N), ((Word16) (pos2 & mask))));
69e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		} else
70e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		{
71e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			/* ((pos2 & mask) << N) + (pos1 & mask); */
72e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = L_deposit_l(add1((((Word16) (pos2 & mask)) << N), ((Word16) (pos1 & mask))));
73e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		}
74e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		if ((pos1 & NB_POS) != 0)
75e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		{
76e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			tmp = (N << 1);
77e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, (1L << tmp));       /* index += 1 << (2*N); */
78e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		}
79e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	} else
80e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	{
81e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		/* sign of 1st pulse != sign of 2th pulse */
82e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		if (vo_sub((Word16) (pos1 & mask), (Word16) (pos2 & mask)) <= 0)
83e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		{
84e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			/* index = ((pos2 & mask) << N) + (pos1 & mask); */
85b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard			index = L_deposit_l(add1((((Word16) (pos2 & mask)) << N), ((Word16) (pos1 & mask))));
86e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			if ((pos2 & NB_POS) != 0)
87e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			{
88e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard				tmp = (N << 1);           /* index += 1 << (2*N); */
89e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard				index = vo_L_add(index, (1L << tmp));
90e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			}
91e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		} else
92e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		{
93e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			/* index = ((pos1 & mask) << N) + (pos2 & mask);	 */
94b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard			index = L_deposit_l(add1((((Word16) (pos1 & mask)) << N), ((Word16) (pos2 & mask))));
95e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			if ((pos1 & NB_POS) != 0)
96e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			{
97e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard				tmp = (N << 1);
98e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard				index = vo_L_add(index, (1 << tmp));    /* index += 1 << (2*N); */
99e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			}
100e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		}
101e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	}
102e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	return (index);
103e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard}
104e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
105e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
106e2e838afcf03e603a41a0455846eaf9614537c16Mans RullgardWord32 quant_3p_3N1(                       /* (o) return (3*N)+1 bits         */
107e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 pos1,                          /* (i) position of the pulse 1     */
108e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 pos2,                          /* (i) position of the pulse 2     */
109e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 pos3,                          /* (i) position of the pulse 3     */
110e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 N)                             /* (i) number of bits for position */
111e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard{
112e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word16 nb_pos;
113e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word32 index;
114e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
115e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	nb_pos =(1 <<(N - 1));            /* nb_pos = (1<<(N-1)); */
116e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	/*-------------------------------------------------------*
117e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	 * Quantization of 3 pulses with 3*N+1 bits:             *
118e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	 *-------------------------------------------------------*/
119e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	if (((pos1 ^ pos2) & nb_pos) == 0)
120e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	{
121e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		index = quant_2p_2N1(pos1, pos2, sub(N, 1));    /* index = quant_2p_2N1(pos1, pos2, (N-1)); */
122e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		/* index += (pos1 & nb_pos) << N; */
123b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard		index = vo_L_add(index, (L_deposit_l((Word16) (pos1 & nb_pos)) << N));
124e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		/* index += quant_1p_N1(pos3, N) << (2*N); */
125e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		index = vo_L_add(index, (quant_1p_N1(pos3, N)<<(N << 1)));
126e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
127e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	} else if (((pos1 ^ pos3) & nb_pos) == 0)
128e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	{
129e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		index = quant_2p_2N1(pos1, pos3, sub(N, 1));    /* index = quant_2p_2N1(pos1, pos3, (N-1)); */
130b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard		index = vo_L_add(index, (L_deposit_l((Word16) (pos1 & nb_pos)) << N));
131e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		/* index += (pos1 & nb_pos) << N; */
132e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		index = vo_L_add(index, (quant_1p_N1(pos2, N) << (N << 1)));
133e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		/* index += quant_1p_N1(pos2, N) <<
134e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		 * (2*N); */
135e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	} else
136e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	{
137e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		index = quant_2p_2N1(pos2, pos3, (N - 1));    /* index = quant_2p_2N1(pos2, pos3, (N-1)); */
138e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		/* index += (pos2 & nb_pos) << N;			 */
139b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard		index = vo_L_add(index, (L_deposit_l((Word16) (pos2 & nb_pos)) << N));
140e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		/* index += quant_1p_N1(pos1, N) << (2*N);	 */
141e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		index = vo_L_add(index, (quant_1p_N1(pos1, N) << (N << 1)));
142e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	}
143e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	return (index);
144e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard}
145e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
146e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
147e2e838afcf03e603a41a0455846eaf9614537c16Mans RullgardWord32 quant_4p_4N1(                       /* (o) return (4*N)+1 bits         */
148e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 pos1,                          /* (i) position of the pulse 1     */
149e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 pos2,                          /* (i) position of the pulse 2     */
150e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 pos3,                          /* (i) position of the pulse 3     */
151e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 pos4,                          /* (i) position of the pulse 4     */
152e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 N)                             /* (i) number of bits for position */
153e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard{
154e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word16 nb_pos;
155e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word32 index;
156e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
157e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	nb_pos = 1 << (N - 1);            /* nb_pos = (1<<(N-1));  */
158e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	/*-------------------------------------------------------*
159e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	 * Quantization of 4 pulses with 4*N+1 bits:             *
160e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	 *-------------------------------------------------------*/
161e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	if (((pos1 ^ pos2) & nb_pos) == 0)
162e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	{
163e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		index = quant_2p_2N1(pos1, pos2, sub(N, 1));    /* index = quant_2p_2N1(pos1, pos2, (N-1)); */
164e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		/* index += (pos1 & nb_pos) << N;	 */
165b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard		index = vo_L_add(index, (L_deposit_l((Word16) (pos1 & nb_pos)) << N));
166e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		/* index += quant_2p_2N1(pos3, pos4, N) << (2*N); */
167e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		index = vo_L_add(index, (quant_2p_2N1(pos3, pos4, N) << (N << 1)));
168e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	} else if (((pos1 ^ pos3) & nb_pos) == 0)
169e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	{
170e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		index = quant_2p_2N1(pos1, pos3, (N - 1));
171e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		/* index += (pos1 & nb_pos) << N; */
172b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard		index = vo_L_add(index, (L_deposit_l((Word16) (pos1 & nb_pos)) << N));
173e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		/* index += quant_2p_2N1(pos2, pos4, N) << (2*N); */
174e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		index = vo_L_add(index, (quant_2p_2N1(pos2, pos4, N) << (N << 1)));
175e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	} else
176e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	{
177e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		index = quant_2p_2N1(pos2, pos3, (N - 1));
178e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		/* index += (pos2 & nb_pos) << N; */
179b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard		index = vo_L_add(index, (L_deposit_l((Word16) (pos2 & nb_pos)) << N));
180e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		/* index += quant_2p_2N1(pos1, pos4, N) << (2*N); */
181e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		index = vo_L_add(index, (quant_2p_2N1(pos1, pos4, N) << (N << 1)));
182e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	}
183e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	return (index);
184e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard}
185e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
186e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
187e2e838afcf03e603a41a0455846eaf9614537c16Mans RullgardWord32 quant_4p_4N(                        /* (o) return 4*N bits             */
188e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 pos[],                         /* (i) position of the pulse 1..4  */
189e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 N)                             /* (i) number of bits for position */
190e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard{
191e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word16 nb_pos, mask, n_1, tmp;
192e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word16 posA[4], posB[4];
193e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word32 i, j, k, index;
194e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
195b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard	n_1 = (Word16) (N - 1);
196e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	nb_pos = (1 << n_1);                  /* nb_pos = (1<<n_1); */
197e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	mask = vo_sub((1 << N), 1);              /* mask = ((1<<N)-1); */
198e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
199b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard	i = 0;
200b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard	j = 0;
201e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	for (k = 0; k < 4; k++)
202e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	{
203e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		if ((pos[k] & nb_pos) == 0)
204e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		{
205b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard			posA[i++] = pos[k];
206e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		} else
207e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		{
208b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard			posB[j++] = pos[k];
209e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		}
210e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	}
211e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
212e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	switch (i)
213e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	{
214e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 0:
215e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			tmp = vo_sub((N << 2), 3);           /* index = 1 << ((4*N)-3); */
216e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = (1L << tmp);
217e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			/* index += quant_4p_4N1(posB[0], posB[1], posB[2], posB[3], n_1); */
218e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, quant_4p_4N1(posB[0], posB[1], posB[2], posB[3], n_1));
219e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
220e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 1:
221e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			/* index = quant_1p_N1(posA[0], n_1) << ((3*n_1)+1); */
222e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			tmp = add1((Word16)((vo_L_mult(3, n_1) >> 1)), 1);
223e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = L_shl(quant_1p_N1(posA[0], n_1), tmp);
224e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			/* index += quant_3p_3N1(posB[0], posB[1], posB[2], n_1); */
225e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, quant_3p_3N1(posB[0], posB[1], posB[2], n_1));
226e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
227e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 2:
228e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			tmp = ((n_1 << 1) + 1);         /* index = quant_2p_2N1(posA[0], posA[1], n_1) << ((2*n_1)+1); */
229e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = L_shl(quant_2p_2N1(posA[0], posA[1], n_1), tmp);
230e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			/* index += quant_2p_2N1(posB[0], posB[1], n_1); */
231e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, quant_2p_2N1(posB[0], posB[1], n_1));
232e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
233e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 3:
234e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			/* index = quant_3p_3N1(posA[0], posA[1], posA[2], n_1) << N; */
235e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = L_shl(quant_3p_3N1(posA[0], posA[1], posA[2], n_1), N);
236e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, quant_1p_N1(posB[0], n_1));        /* index += quant_1p_N1(posB[0], n_1); */
237e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
238e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 4:
239e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = quant_4p_4N1(posA[0], posA[1], posA[2], posA[3], n_1);
240e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
241e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		default:
242e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = 0;
243e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			fprintf(stderr, "Error in function quant_4p_4N\n");
244e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	}
245e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	tmp = ((N << 2) - 2);               /* index += (i & 3) << ((4*N)-2); */
246e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	index = vo_L_add(index, L_shl((L_deposit_l(i) & (3L)), tmp));
247e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
248e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	return (index);
249e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard}
250e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
251e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
252e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
253e2e838afcf03e603a41a0455846eaf9614537c16Mans RullgardWord32 quant_5p_5N(                        /* (o) return 5*N bits             */
254e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 pos[],                         /* (i) position of the pulse 1..5  */
255e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 N)                             /* (i) number of bits for position */
256e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard{
257e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word16 nb_pos, n_1, tmp;
258e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word16 posA[5], posB[5];
259e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word32 i, j, k, index, tmp2;
260e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
261b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard	n_1 = (Word16) (N - 1);
262e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	nb_pos = (1 << n_1);                  /* nb_pos = (1<<n_1); */
263e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
264b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard	i = 0;
265b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard	j = 0;
266e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	for (k = 0; k < 5; k++)
267e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	{
268e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		if ((pos[k] & nb_pos) == 0)
269e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		{
270b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard			posA[i++] = pos[k];
271e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		} else
272e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		{
273b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard			posB[j++] = pos[k];
274e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		}
275e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	}
276e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
277e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	switch (i)
278e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	{
279e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 0:
280e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			tmp = vo_sub((Word16)((vo_L_mult(5, N) >> 1)), 1);        /* ((5*N)-1)) */
281e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = L_shl(1L, tmp);   /* index = 1 << ((5*N)-1); */
282e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			tmp = add1((N << 1), 1);  /* index += quant_3p_3N1(posB[0], posB[1], posB[2], n_1) << ((2*N)+1);*/
283e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			tmp2 = L_shl(quant_3p_3N1(posB[0], posB[1], posB[2], n_1), tmp);
284e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, tmp2);
285e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, quant_2p_2N1(posB[3], posB[4], N));        /* index += quant_2p_2N1(posB[3], posB[4], N); */
286e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
287e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 1:
288e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			tmp = vo_sub((Word16)((vo_L_mult(5, N) >> 1)), 1);        /* index = 1 << ((5*N)-1); */
289e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = L_shl(1L, tmp);
290e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			tmp = add1((N << 1), 1);   /* index += quant_3p_3N1(posB[0], posB[1], posB[2], n_1) <<((2*N)+1);  */
291e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			tmp2 = L_shl(quant_3p_3N1(posB[0], posB[1], posB[2], n_1), tmp);
292e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, tmp2);
293e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, quant_2p_2N1(posB[3], posA[0], N));        /* index += quant_2p_2N1(posB[3], posA[0], N); */
294e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
295e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 2:
296e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			tmp = vo_sub((Word16)((vo_L_mult(5, N) >> 1)), 1);        /* ((5*N)-1)) */
297e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = L_shl(1L, tmp);            /* index = 1 << ((5*N)-1); */
298e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			tmp = add1((N << 1), 1);           /* index += quant_3p_3N1(posB[0], posB[1], posB[2], n_1) << ((2*N)+1);  */
299e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			tmp2 = L_shl(quant_3p_3N1(posB[0], posB[1], posB[2], n_1), tmp);
300e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, tmp2);
301e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, quant_2p_2N1(posA[0], posA[1], N));        /* index += quant_2p_2N1(posA[0], posA[1], N); */
302e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
303e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 3:
304e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			tmp = add1((N << 1), 1);           /* index = quant_3p_3N1(posA[0], posA[1], posA[2], n_1) << ((2*N)+1);  */
305e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = L_shl(quant_3p_3N1(posA[0], posA[1], posA[2], n_1), tmp);
306e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, quant_2p_2N1(posB[0], posB[1], N));        /* index += quant_2p_2N1(posB[0], posB[1], N); */
307e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
308e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 4:
309e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			tmp = add1((N << 1), 1);           /* index = quant_3p_3N1(posA[0], posA[1], posA[2], n_1) << ((2*N)+1);  */
310e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = L_shl(quant_3p_3N1(posA[0], posA[1], posA[2], n_1), tmp);
311e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, quant_2p_2N1(posA[3], posB[0], N));        /* index += quant_2p_2N1(posA[3], posB[0], N); */
312e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
313e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 5:
314e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			tmp = add1((N << 1), 1);           /* index = quant_3p_3N1(posA[0], posA[1], posA[2], n_1) << ((2*N)+1);  */
315e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = L_shl(quant_3p_3N1(posA[0], posA[1], posA[2], n_1), tmp);
316e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, quant_2p_2N1(posA[3], posA[4], N));        /* index += quant_2p_2N1(posA[3], posA[4], N); */
317e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
318e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		default:
319e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = 0;
320e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			fprintf(stderr, "Error in function quant_5p_5N\n");
321e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	}
322e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
323e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	return (index);
324e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard}
325e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
326e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
327e2e838afcf03e603a41a0455846eaf9614537c16Mans RullgardWord32 quant_6p_6N_2(                      /* (o) return (6*N)-2 bits         */
328e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 pos[],                         /* (i) position of the pulse 1..6  */
329e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		Word16 N)                             /* (i) number of bits for position */
330e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard{
331e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word16 nb_pos, n_1;
332e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word16 posA[6], posB[6];
333e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	Word32 i, j, k, index;
334e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
335e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	/* !!  N and n_1 are constants -> it doesn't need to be operated by Basic Operators */
336b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard	n_1 = (Word16) (N - 1);
337e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	nb_pos = (1 << n_1);                  /* nb_pos = (1<<n_1); */
338e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
339b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard	i = 0;
340b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard	j = 0;
341e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	for (k = 0; k < 6; k++)
342e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	{
343e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		if ((pos[k] & nb_pos) == 0)
344e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		{
345b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard			posA[i++] = pos[k];
346e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		} else
347e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		{
348b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard			posB[j++] = pos[k];
349e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		}
350e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	}
351e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
352e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	switch (i)
353e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	{
354e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 0:
355e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = (1 << (Word16) (6 * N - 5));        /* index = 1 << ((6*N)-5); */
356e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, (quant_5p_5N(posB, n_1) << N)); /* index += quant_5p_5N(posB, n_1) << N; */
357e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, quant_1p_N1(posB[5], n_1));        /* index += quant_1p_N1(posB[5], n_1); */
358e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
359e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 1:
360e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = (1L << (Word16) (6 * N - 5));        /* index = 1 << ((6*N)-5); */
361e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, (quant_5p_5N(posB, n_1) << N)); /* index += quant_5p_5N(posB, n_1) << N; */
362e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, quant_1p_N1(posA[0], n_1));        /* index += quant_1p_N1(posA[0], n_1); */
363e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
364e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 2:
365e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = (1L << (Word16) (6 * N - 5));        /* index = 1 << ((6*N)-5); */
366e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			/* index += quant_4p_4N(posB, n_1) << ((2*n_1)+1); */
367e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, (quant_4p_4N(posB, n_1) << (Word16) (2 * n_1 + 1)));
368e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, quant_2p_2N1(posA[0], posA[1], n_1));      /* index += quant_2p_2N1(posA[0], posA[1], n_1); */
369e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
370e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 3:
371b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard			index = (quant_3p_3N1(posA[0], posA[1], posA[2], n_1) << (Word16) (3 * n_1 + 1));
372e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			                                  /* index = quant_3p_3N1(posA[0], posA[1], posA[2], n_1) << ((3*n_1)+1); */
373b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard			index =vo_L_add(index, quant_3p_3N1(posB[0], posB[1], posB[2], n_1));
374e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			                                 /* index += quant_3p_3N1(posB[0], posB[1], posB[2], n_1); */
375e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
376e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 4:
377b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard			i = 2;
378e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = (quant_4p_4N(posA, n_1) << (Word16) (2 * n_1 + 1));  /* index = quant_4p_4N(posA, n_1) << ((2*n_1)+1); */
379e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, quant_2p_2N1(posB[0], posB[1], n_1));      /* index += quant_2p_2N1(posB[0], posB[1], n_1); */
380e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
381e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 5:
382b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard			i = 1;
383e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = (quant_5p_5N(posA, n_1) << N);       /* index = quant_5p_5N(posA, n_1) << N; */
384e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, quant_1p_N1(posB[0], n_1));        /* index += quant_1p_N1(posB[0], n_1); */
385e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
386e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		case 6:
387b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard			i = 0;
388e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = (quant_5p_5N(posA, n_1) << N);       /* index = quant_5p_5N(posA, n_1) << N; */
389e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = vo_L_add(index, quant_1p_N1(posA[5], n_1));        /* index += quant_1p_N1(posA[5], n_1); */
390e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			break;
391e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard		default:
392e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			index = 0;
393e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard			fprintf(stderr, "Error in function quant_6p_6N_2\n");
394e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	}
395e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	index = vo_L_add(index, ((L_deposit_l(i) & 3L) << (Word16) (6 * N - 4)));   /* index += (i & 3) << ((6*N)-4); */
396e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
397e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard	return (index);
398e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard}
399e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
400e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard
401