*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
/* from g711.c by SUN microsystems (unrestricted use) */
-#define SIGN_BIT (0x80) /* Sign bit for a A-law byte. */
-#define QUANT_MASK (0xf) /* Quantization field mask. */
-#define NSEGS (8) /* Number of A-law segments. */
-#define SEG_SHIFT (4) /* Left shift for segment number. */
-#define SEG_MASK (0x70) /* Segment field mask. */
+#define SIGN_BIT (0x80) /* Sign bit for a A-law byte. */
+#define QUANT_MASK (0xf) /* Quantization field mask. */
+#define NSEGS (8) /* Number of A-law segments. */
+#define SEG_SHIFT (4) /* Left shift for segment number. */
+#define SEG_MASK (0x70) /* Segment field mask. */
-#define BIAS (0x84) /* Bias for linear code. */
+#define BIAS (0x84) /* Bias for linear code. */
/*
* alaw2linear() - Convert an A-law value to 16-bit linear PCM
*
*/
-static int alaw2linear(unsigned char a_val)
+static int alaw2linear(unsigned char a_val)
{
- int t;
- int seg;
+ int t;
+ int seg;
- a_val ^= 0x55;
+ a_val ^= 0x55;
- t = a_val & QUANT_MASK;
- seg = ((unsigned)a_val & SEG_MASK) >> SEG_SHIFT;
- if(seg) t= (t + t + 1 + 32) << (seg + 2);
- else t= (t + t + 1 ) << 3;
+ t = a_val & QUANT_MASK;
+ seg = ((unsigned)a_val & SEG_MASK) >> SEG_SHIFT;
+ if(seg) t= (t + t + 1 + 32) << (seg + 2);
+ else t= (t + t + 1 ) << 3;
- return ((a_val & SIGN_BIT) ? t : -t);
+ return ((a_val & SIGN_BIT) ? t : -t);
}
-static int ulaw2linear(unsigned char u_val)
+static int ulaw2linear(unsigned char u_val)
{
- int t;
+ int t;
- /* Complement to obtain normal u-law value. */
- u_val = ~u_val;
+ /* Complement to obtain normal u-law value. */
+ u_val = ~u_val;
- /*
- * Extract and bias the quantization bits. Then
- * shift up by the segment number and subtract out the bias.
- */
- t = ((u_val & QUANT_MASK) << 3) + BIAS;
- t <<= ((unsigned)u_val & SEG_MASK) >> SEG_SHIFT;
+ /*
+ * Extract and bias the quantization bits. Then
+ * shift up by the segment number and subtract out the bias.
+ */
+ t = ((u_val & QUANT_MASK) << 3) + BIAS;
+ t <<= ((unsigned)u_val & SEG_MASK) >> SEG_SHIFT;
- return ((u_val & SIGN_BIT) ? (BIAS - t) : (t - BIAS));
+ return ((u_val & SIGN_BIT) ? (BIAS - t) : (t - BIAS));
}
/* 16384 entries per table */
}
static int pcm_encode_frame(AVCodecContext *avctx,
- unsigned char *frame, int buf_size, void *data)
+ unsigned char *frame, int buf_size, void *data)
{
int n, sample_size, v;
short *samples;
}
static int pcm_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ void *data, int *data_size,
+ uint8_t *buf, int buf_size)
{
PCMDecode *s = avctx->priv_data;
int n;
CODEC_TYPE_AUDIO, \
id, \
0, \
- pcm_encode_init, \
- pcm_encode_frame, \
- pcm_encode_close, \
+ pcm_encode_init, \
+ pcm_encode_frame, \
+ pcm_encode_close, \
NULL, \
}; \
AVCodec name ## _decoder = { \
CODEC_TYPE_AUDIO, \
id, \
sizeof(PCMDecode), \
- pcm_decode_init, \
+ pcm_decode_init, \
NULL, \
NULL, \
pcm_decode_frame, \