summaryrefslogtreecommitdiffstats
path: root/libfaad2/huffman.c
diff options
context:
space:
mode:
authordiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-06-02 22:59:04 +0000
committerdiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-06-02 22:59:04 +0000
commit228ca70d485e2660c2e381d7112cbcca65c156a0 (patch)
treef7ab4303f2daa68c76271787a60d50cb1ada2e46 /libfaad2/huffman.c
parenteb1dee5cbf86fba8d5081bae6071cc4a4fd68306 (diff)
downloadmpv-228ca70d485e2660c2e381d7112cbcca65c156a0.tar.bz2
mpv-228ca70d485e2660c2e381d7112cbcca65c156a0.tar.xz
update to the 2.0 release of faad, patch by adland
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12528 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libfaad2/huffman.c')
-rw-r--r--libfaad2/huffman.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/libfaad2/huffman.c b/libfaad2/huffman.c
index 62831ad8df..d3d3bdf262 100644
--- a/libfaad2/huffman.c
+++ b/libfaad2/huffman.c
@@ -1,6 +1,6 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
-** $Id: huffman.c,v 1.4 2003/09/09 18:12:00 menno Exp $
+** $Id: huffman.c,v 1.1 2003/10/03 22:23:26 alex Exp $
**/
#include "common.h"
@@ -38,6 +38,19 @@
#include "codebook/hcb.h"
+/* static function declarations */
+static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len);
+static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp);
+static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static int16_t huffman_codebook(uint8_t i);
+
int8_t huffman_scale_factor(bitfile *ld)
{
uint16_t offset = 0;
@@ -107,7 +120,7 @@ static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len)
static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp)
{
uint8_t neg, i;
- int16_t j;
+ int32_t j;
int32_t off;
if (sp < 0)
@@ -116,7 +129,7 @@ static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp)
return sp;
neg = 1;
} else {
- if(sp != 16)
+ if (sp != 16)
return sp;
neg = 0;
}
@@ -133,7 +146,7 @@ static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp)
off = faad_getbits(ld, i
DEBUGVAR(1,9,"huffman_getescape(): escape"));
- j = off + (1<<i);
+ j = off | (1<<i);
if (neg)
j = -j;
@@ -216,7 +229,7 @@ static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp)
return 0;
}
-static huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
+static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint8_t err = huffman_2step_pair(cb, ld, sp);
huffman_sign_bits(ld, sp, PAIR_LEN);
@@ -319,7 +332,7 @@ uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp)
case 10:
return huffman_2step_pair_sign(cb, ld, sp);
case 12: {
- uint8_t err = huffman_2step_quad(1, ld, sp);
+ uint8_t err = huffman_2step_pair(11, ld, sp);
sp[0] = huffman_codebook(0); sp[1] = huffman_codebook(1);
return err; }
case 11:
@@ -357,7 +370,6 @@ int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp)
uint16_t offset = 0;
uint8_t extra_bits;
uint8_t i;
- uint8_t save_cb = cb;
switch (cb)