diff options
author | Mohamed Tarek <mt@rockbox.org> | 2010-07-14 19:37:52 +0000 |
---|---|---|
committer | Mohamed Tarek <mt@rockbox.org> | 2010-07-14 19:37:52 +0000 |
commit | d63abfc7eb7db5eb36b325198fbb6ceaf8778685 (patch) | |
tree | dc9496f504711569180fd9c5a91cf6e748815869 /apps | |
parent | 16284ae8aef30ec67d7fd9c34519bce17d64ab3a (diff) | |
download | rockbox-d63abfc7eb7db5eb36b325198fbb6ceaf8778685.tar.gz rockbox-d63abfc7eb7db5eb36b325198fbb6ceaf8778685.zip |
Add WMA Pro to the main build. WMA Pro now plays on target and decodes in 151% realtime in a 320kbps sample on a sansa e200. Lots of cleanup still need to be done, and optimisations should start soon too.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27417 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/codecs/SOURCES | 1 | ||||
-rw-r--r-- | apps/codecs/codecs.make | 4 | ||||
-rw-r--r-- | apps/codecs/libwmapro/SOURCES | 2 | ||||
-rw-r--r-- | apps/codecs/libwmapro/bitstream.c | 26 | ||||
-rw-r--r-- | apps/codecs/libwmapro/get_bits.h | 6 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/avutil.h | 2 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/bswap.h | 13 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/internal.h | 19 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/intreadwrite.h | 18 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/log.c | 9 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/log.h | 2 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/mathematics.c | 4 | ||||
-rw-r--r-- | apps/codecs/libwmapro/mathops.h | 14 | ||||
-rw-r--r-- | apps/codecs/libwmapro/put_bits.h | 2 | ||||
-rw-r--r-- | apps/codecs/libwmapro/wma.c | 3 | ||||
-rw-r--r-- | apps/codecs/libwmapro/wma.h | 88 | ||||
-rw-r--r-- | apps/codecs/libwmapro/wmapro_mdct.c | 1 | ||||
-rw-r--r-- | apps/codecs/libwmapro/wmaprodec.c | 71 | ||||
-rw-r--r-- | apps/codecs/wmapro.c | 2 |
19 files changed, 81 insertions, 206 deletions
diff --git a/apps/codecs/SOURCES b/apps/codecs/SOURCES index ca50529aed..1c484c4dcc 100644 --- a/apps/codecs/SOURCES +++ b/apps/codecs/SOURCES | |||
@@ -16,6 +16,7 @@ atrac3_rm.c | |||
16 | atrac3_oma.c | 16 | atrac3_oma.c |
17 | mpc.c | 17 | mpc.c |
18 | wma.c | 18 | wma.c |
19 | wmapro.c | ||
19 | sid.c | 20 | sid.c |
20 | ape.c | 21 | ape.c |
21 | nsf.c | 22 | nsf.c |
diff --git a/apps/codecs/codecs.make b/apps/codecs/codecs.make index c137426591..49407db6b8 100644 --- a/apps/codecs/codecs.make +++ b/apps/codecs/codecs.make | |||
@@ -37,6 +37,7 @@ include $(APPSDIR)/codecs/libspeex/libspeex.make | |||
37 | include $(APPSDIR)/codecs/libtremor/libtremor.make | 37 | include $(APPSDIR)/codecs/libtremor/libtremor.make |
38 | include $(APPSDIR)/codecs/libwavpack/libwavpack.make | 38 | include $(APPSDIR)/codecs/libwavpack/libwavpack.make |
39 | include $(APPSDIR)/codecs/libwma/libwma.make | 39 | include $(APPSDIR)/codecs/libwma/libwma.make |
40 | include $(APPSDIR)/codecs/libwmapro/libwmapro.make | ||
40 | include $(APPSDIR)/codecs/libcook/libcook.make | 41 | include $(APPSDIR)/codecs/libcook/libcook.make |
41 | include $(APPSDIR)/codecs/librm/librm.make | 42 | include $(APPSDIR)/codecs/librm/librm.make |
42 | include $(APPSDIR)/codecs/libatrac/libatrac.make | 43 | include $(APPSDIR)/codecs/libatrac/libatrac.make |
@@ -58,7 +59,7 @@ CODEC_CRT0 := $(CODECDIR)/codec_crt0.o | |||
58 | CODECLIBS := $(DEMACLIB) $(A52LIB) $(ALACLIB) $(ASAPLIB) \ | 59 | CODECLIBS := $(DEMACLIB) $(A52LIB) $(ALACLIB) $(ASAPLIB) \ |
59 | $(FAADLIB) $(FFMPEGFLACLIB) $(M4ALIB) $(MADLIB) $(MUSEPACKLIB) \ | 60 | $(FAADLIB) $(FFMPEGFLACLIB) $(M4ALIB) $(MADLIB) $(MUSEPACKLIB) \ |
60 | $(SPCLIB) $(SPEEXLIB) $(TREMORLIB) $(WAVPACKLIB) $(WMALIB) $(COOKLIB) \ | 61 | $(SPCLIB) $(SPEEXLIB) $(TREMORLIB) $(WAVPACKLIB) $(WMALIB) $(COOKLIB) \ |
61 | $(ATRACLIB) \ | 62 | $(ATRACLIB) $(WMAPROLIB) \ |
62 | $(CODECLIB) | 63 | $(CODECLIB) |
63 | 64 | ||
64 | $(CODECS): $(CODEC_CRT0) $(CODECLINK_LDS) | 65 | $(CODECS): $(CODEC_CRT0) $(CODECLINK_LDS) |
@@ -83,6 +84,7 @@ $(CODECDIR)/shorten.codec : $(CODECDIR)/libffmpegFLAC.a | |||
83 | $(CODECDIR)/ape-pre.map : $(CODECDIR)/libdemac-pre.a | 84 | $(CODECDIR)/ape-pre.map : $(CODECDIR)/libdemac-pre.a |
84 | $(CODECDIR)/ape.codec : $(CODECDIR)/libdemac.a | 85 | $(CODECDIR)/ape.codec : $(CODECDIR)/libdemac.a |
85 | $(CODECDIR)/wma.codec : $(CODECDIR)/libwma.a $(CODECDIR)/libasf.a | 86 | $(CODECDIR)/wma.codec : $(CODECDIR)/libwma.a $(CODECDIR)/libasf.a |
87 | $(CODECDIR)/wmapro.codec : $(CODECDIR)/libwmapro.a $(CODECDIR)/libasf.a | ||
86 | $(CODECDIR)/wavpack_enc.codec: $(CODECDIR)/libwavpack.a | 88 | $(CODECDIR)/wavpack_enc.codec: $(CODECDIR)/libwavpack.a |
87 | $(CODECDIR)/asap.codec : $(CODECDIR)/libasap.a | 89 | $(CODECDIR)/asap.codec : $(CODECDIR)/libasap.a |
88 | $(CODECDIR)/cook.codec : $(CODECDIR)/libcook.a $(CODECDIR)/librm.a | 90 | $(CODECDIR)/cook.codec : $(CODECDIR)/libcook.a $(CODECDIR)/librm.a |
diff --git a/apps/codecs/libwmapro/SOURCES b/apps/codecs/libwmapro/SOURCES index 1d5909bf9a..cfb1a97d4c 100644 --- a/apps/codecs/libwmapro/SOURCES +++ b/apps/codecs/libwmapro/SOURCES | |||
@@ -3,6 +3,4 @@ wma.c | |||
3 | mdct_tables.c | 3 | mdct_tables.c |
4 | bitstream.c | 4 | bitstream.c |
5 | wmapro_mdct.c | 5 | wmapro_mdct.c |
6 | libavutil/log.c | ||
7 | libavutil/mem.c | ||
8 | libavutil/mathematics.c | 6 | libavutil/mathematics.c |
diff --git a/apps/codecs/libwmapro/bitstream.c b/apps/codecs/libwmapro/bitstream.c index deb1d631e2..4ae9727ac0 100644 --- a/apps/codecs/libwmapro/bitstream.c +++ b/apps/codecs/libwmapro/bitstream.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #include "get_bits.h" | 32 | #include "get_bits.h" |
33 | #include "put_bits.h" | 33 | #include "put_bits.h" |
34 | 34 | ||
35 | #define av_log(...) | ||
36 | |||
35 | const uint8_t ff_log2_run[32]={ | 37 | const uint8_t ff_log2_run[32]={ |
36 | 0, 0, 0, 0, 1, 1, 1, 1, | 38 | 0, 0, 0, 0, 1, 1, 1, 1, |
37 | 2, 2, 2, 2, 3, 3, 3, 3, | 39 | 2, 2, 2, 2, 3, 3, 3, 3, |
@@ -108,10 +110,10 @@ static int alloc_table(VLC *vlc, int size, int use_static) | |||
108 | vlc->table_size += size; | 110 | vlc->table_size += size; |
109 | if (vlc->table_size > vlc->table_allocated) { | 111 | if (vlc->table_size > vlc->table_allocated) { |
110 | if(use_static) | 112 | if(use_static) |
111 | abort(); //cant do anything, init_vlc() is used with too little memory | 113 | return -1; //cant do anything, init_vlc() is used with too little memory |
112 | vlc->table_allocated += (1 << vlc->bits); | 114 | vlc->table_allocated += (1 << vlc->bits); |
113 | vlc->table = av_realloc(vlc->table, | 115 | //vlc->table = av_realloc(vlc->table, |
114 | sizeof(VLC_TYPE) * 2 * vlc->table_allocated); | 116 | // sizeof(VLC_TYPE) * 2 * vlc->table_allocated); |
115 | if (!vlc->table) | 117 | if (!vlc->table) |
116 | return -1; | 118 | return -1; |
117 | } | 119 | } |
@@ -218,14 +220,14 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, | |||
218 | if (n <= 0) | 220 | if (n <= 0) |
219 | break; | 221 | break; |
220 | code = codes[k].code; | 222 | code = codes[k].code; |
221 | if (code >> (32 - table_nb_bits) != code_prefix) | 223 | if (code >> (32 - table_nb_bits) != (unsigned)code_prefix) |
222 | break; | 224 | break; |
223 | codes[k].bits = n; | 225 | codes[k].bits = n; |
224 | codes[k].code = code << table_nb_bits; | 226 | codes[k].code = code << table_nb_bits; |
225 | subtable_bits = FFMAX(subtable_bits, n); | 227 | subtable_bits = FFMAX(subtable_bits, n); |
226 | } | 228 | } |
227 | subtable_bits = FFMIN(subtable_bits, table_nb_bits); | 229 | subtable_bits = FFMIN(subtable_bits, table_nb_bits); |
228 | j = (flags & INIT_VLC_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix; | 230 | j = (flags & INIT_VLC_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : (unsigned)code_prefix; |
229 | table[j][1] = -subtable_bits; | 231 | table[j][1] = -subtable_bits; |
230 | #ifdef DEBUG_VLC | 232 | #ifdef DEBUG_VLC |
231 | av_log(NULL,AV_LOG_DEBUG,"%4x: n=%d (subtable)\n", | 233 | av_log(NULL,AV_LOG_DEBUG,"%4x: n=%d (subtable)\n", |
@@ -284,7 +286,7 @@ int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, | |||
284 | if(vlc->table_size && vlc->table_size == vlc->table_allocated){ | 286 | if(vlc->table_size && vlc->table_size == vlc->table_allocated){ |
285 | return 0; | 287 | return 0; |
286 | }else if(vlc->table_size){ | 288 | }else if(vlc->table_size){ |
287 | abort(); // fatal error, we are called on a partially initialized table | 289 | return -1; // fatal error, we are called on a partially initialized table |
288 | } | 290 | } |
289 | }else { | 291 | }else { |
290 | vlc->table = NULL; | 292 | vlc->table = NULL; |
@@ -321,17 +323,11 @@ int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, | |||
321 | nb_codes = j; | 323 | nb_codes = j; |
322 | 324 | ||
323 | if (build_table(vlc, nb_bits, nb_codes, buf, flags) < 0) { | 325 | if (build_table(vlc, nb_bits, nb_codes, buf, flags) < 0) { |
324 | av_freep(&vlc->table); | 326 | //av_freep(&vlc->table); |
325 | return -1; | 327 | return -1; |
326 | } | 328 | } |
327 | if((flags & INIT_VLC_USE_NEW_STATIC) && vlc->table_size != vlc->table_allocated) | 329 | //if((flags & INIT_VLC_USE_NEW_STATIC) && vlc->table_size != vlc->table_allocated) |
328 | av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", vlc->table_size, vlc->table_allocated); | 330 | // av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", vlc->table_size, vlc->table_allocated); |
329 | return 0; | 331 | return 0; |
330 | } | 332 | } |
331 | 333 | ||
332 | |||
333 | void free_vlc(VLC *vlc) | ||
334 | { | ||
335 | av_freep(&vlc->table); | ||
336 | } | ||
337 | |||
diff --git a/apps/codecs/libwmapro/get_bits.h b/apps/codecs/libwmapro/get_bits.h index a21d05210f..ecbfc6967b 100644 --- a/apps/codecs/libwmapro/get_bits.h +++ b/apps/codecs/libwmapro/get_bits.h | |||
@@ -40,13 +40,7 @@ | |||
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #if !defined(LIBMPEG2_BITSTREAM_READER) && !defined(A32_BITSTREAM_READER) && !defined(ALT_BITSTREAM_READER) | 42 | #if !defined(LIBMPEG2_BITSTREAM_READER) && !defined(A32_BITSTREAM_READER) && !defined(ALT_BITSTREAM_READER) |
43 | # if ARCH_ARM && !HAVE_FAST_UNALIGNED | ||
44 | # define A32_BITSTREAM_READER | ||
45 | # else | ||
46 | # define ALT_BITSTREAM_READER | 43 | # define ALT_BITSTREAM_READER |
47 | //#define LIBMPEG2_BITSTREAM_READER | ||
48 | //#define A32_BITSTREAM_READER | ||
49 | # endif | ||
50 | #endif | 44 | #endif |
51 | 45 | ||
52 | /* bit input */ | 46 | /* bit input */ |
diff --git a/apps/codecs/libwmapro/libavutil/avutil.h b/apps/codecs/libwmapro/libavutil/avutil.h index 1b858f1fe6..fd6e313b59 100644 --- a/apps/codecs/libwmapro/libavutil/avutil.h +++ b/apps/codecs/libwmapro/libavutil/avutil.h | |||
@@ -79,7 +79,7 @@ enum AVMediaType { | |||
79 | }; | 79 | }; |
80 | 80 | ||
81 | #include "common.h" | 81 | #include "common.h" |
82 | #include "error.h" | 82 | //#include "error.h" |
83 | #include "mathematics.h" | 83 | #include "mathematics.h" |
84 | //#include "rational.h" | 84 | //#include "rational.h" |
85 | //#include "intfloat_readwrite.h" | 85 | //#include "intfloat_readwrite.h" |
diff --git a/apps/codecs/libwmapro/libavutil/bswap.h b/apps/codecs/libwmapro/libavutil/bswap.h index 5743e126b8..e15501778b 100644 --- a/apps/codecs/libwmapro/libavutil/bswap.h +++ b/apps/codecs/libwmapro/libavutil/bswap.h | |||
@@ -30,18 +30,6 @@ | |||
30 | //#include "config.h" | 30 | //#include "config.h" |
31 | #include "attributes.h" | 31 | #include "attributes.h" |
32 | 32 | ||
33 | #if ARCH_ARM | ||
34 | # include "arm/bswap.h" | ||
35 | #elif ARCH_AVR32 | ||
36 | # include "avr32/bswap.h" | ||
37 | #elif ARCH_BFIN | ||
38 | # include "bfin/bswap.h" | ||
39 | #elif ARCH_SH4 | ||
40 | # include "sh4/bswap.h" | ||
41 | #elif ARCH_X86 | ||
42 | # include "x86/bswap.h" | ||
43 | #endif | ||
44 | |||
45 | #ifndef bswap_16 | 33 | #ifndef bswap_16 |
46 | static av_always_inline av_const uint16_t bswap_16(uint16_t x) | 34 | static av_always_inline av_const uint16_t bswap_16(uint16_t x) |
47 | { | 35 | { |
@@ -82,6 +70,7 @@ static inline uint64_t av_const bswap_64(uint64_t x) | |||
82 | // be2me ... big-endian to machine-endian | 70 | // be2me ... big-endian to machine-endian |
83 | // le2me ... little-endian to machine-endian | 71 | // le2me ... little-endian to machine-endian |
84 | 72 | ||
73 | #define HAVE_BIGENDIAN 0 | ||
85 | #if HAVE_BIGENDIAN | 74 | #if HAVE_BIGENDIAN |
86 | #define be2me_16(x) (x) | 75 | #define be2me_16(x) (x) |
87 | #define be2me_32(x) (x) | 76 | #define be2me_32(x) (x) |
diff --git a/apps/codecs/libwmapro/libavutil/internal.h b/apps/codecs/libwmapro/libavutil/internal.h index 97087e462a..87a4d3ec10 100644 --- a/apps/codecs/libwmapro/libavutil/internal.h +++ b/apps/codecs/libwmapro/libavutil/internal.h | |||
@@ -55,7 +55,8 @@ | |||
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | #ifndef av_alias | 57 | #ifndef av_alias |
58 | #if HAVE_ATTRIBUTE_MAY_ALIAS && (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(3,3) | 58 | //#if HAVE_ATTRIBUTE_MAY_ALIAS && (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(3,3) |
59 | #if 0 | ||
59 | # define av_alias __attribute__((may_alias)) | 60 | # define av_alias __attribute__((may_alias)) |
60 | #else | 61 | #else |
61 | # define av_alias | 62 | # define av_alias |
@@ -106,7 +107,8 @@ | |||
106 | #define LABEL_MANGLE(a) EXTERN_PREFIX #a | 107 | #define LABEL_MANGLE(a) EXTERN_PREFIX #a |
107 | 108 | ||
108 | // Use rip-relative addressing if compiling PIC code on x86-64. | 109 | // Use rip-relative addressing if compiling PIC code on x86-64. |
109 | #if ARCH_X86_64 && defined(PIC) | 110 | //#if ARCH_X86_64 && defined(PIC) |
111 | #if 0 | ||
110 | # define LOCAL_MANGLE(a) #a "(%%rip)" | 112 | # define LOCAL_MANGLE(a) #a "(%%rip)" |
111 | #else | 113 | #else |
112 | # define LOCAL_MANGLE(a) #a | 114 | # define LOCAL_MANGLE(a) #a |
@@ -127,7 +129,8 @@ | |||
127 | 129 | ||
128 | /* math */ | 130 | /* math */ |
129 | 131 | ||
130 | #if ARCH_X86 | 132 | //#if ARCH_X86 |
133 | #if 0 | ||
131 | #define MASK_ABS(mask, level)\ | 134 | #define MASK_ABS(mask, level)\ |
132 | __asm__ volatile(\ | 135 | __asm__ volatile(\ |
133 | "cltd \n\t"\ | 136 | "cltd \n\t"\ |
@@ -198,10 +201,10 @@ | |||
198 | * without modification. Used to disable the definition of strings | 201 | * without modification. Used to disable the definition of strings |
199 | * (for example AVCodec long_names). | 202 | * (for example AVCodec long_names). |
200 | */ | 203 | */ |
201 | #if CONFIG_SMALL | 204 | //#if CONFIG_SMALL |
202 | # define NULL_IF_CONFIG_SMALL(x) NULL | 205 | //# define NULL_IF_CONFIG_SMALL(x) NULL |
203 | #else | 206 | //#else |
204 | # define NULL_IF_CONFIG_SMALL(x) x | 207 | //# define NULL_IF_CONFIG_SMALL(x) x |
205 | #endif | 208 | //#endif |
206 | 209 | ||
207 | #endif /* AVUTIL_INTERNAL_H */ | 210 | #endif /* AVUTIL_INTERNAL_H */ |
diff --git a/apps/codecs/libwmapro/libavutil/intreadwrite.h b/apps/codecs/libwmapro/libavutil/intreadwrite.h index 87098d707d..a88ffa80f6 100644 --- a/apps/codecs/libwmapro/libavutil/intreadwrite.h +++ b/apps/codecs/libwmapro/libavutil/intreadwrite.h | |||
@@ -52,24 +52,10 @@ typedef union { | |||
52 | * as inline functions. | 52 | * as inline functions. |
53 | */ | 53 | */ |
54 | 54 | ||
55 | #if ARCH_ARM | ||
56 | # include "arm/intreadwrite.h" | ||
57 | #elif ARCH_AVR32 | ||
58 | # include "avr32/intreadwrite.h" | ||
59 | #elif ARCH_MIPS | ||
60 | # include "mips/intreadwrite.h" | ||
61 | #elif ARCH_PPC | ||
62 | # include "ppc/intreadwrite.h" | ||
63 | #elif ARCH_TOMI | ||
64 | # include "tomi/intreadwrite.h" | ||
65 | #elif ARCH_X86 | ||
66 | # include "x86/intreadwrite.h" | ||
67 | #endif | ||
68 | |||
69 | /* | 55 | /* |
70 | * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers. | 56 | * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers. |
71 | */ | 57 | */ |
72 | 58 | #define HAVE_BIGENDIAN 0 | |
73 | #if HAVE_BIGENDIAN | 59 | #if HAVE_BIGENDIAN |
74 | 60 | ||
75 | # if defined(AV_RN16) && !defined(AV_RB16) | 61 | # if defined(AV_RN16) && !defined(AV_RB16) |
@@ -172,6 +158,8 @@ typedef union { | |||
172 | 158 | ||
173 | #endif /* !HAVE_BIGENDIAN */ | 159 | #endif /* !HAVE_BIGENDIAN */ |
174 | 160 | ||
161 | #define HAVE_ATTRIBUTE_PACKED 0 | ||
162 | #define HAVE_FAST_UNALIGNED 0 | ||
175 | /* | 163 | /* |
176 | * Define AV_[RW]N helper macros to simplify definitions not provided | 164 | * Define AV_[RW]N helper macros to simplify definitions not provided |
177 | * by per-arch headers. | 165 | * by per-arch headers. |
diff --git a/apps/codecs/libwmapro/libavutil/log.c b/apps/codecs/libwmapro/libavutil/log.c index 6cbe0da8b8..f93a0d6677 100644 --- a/apps/codecs/libwmapro/libavutil/log.c +++ b/apps/codecs/libwmapro/libavutil/log.c | |||
@@ -26,13 +26,16 @@ | |||
26 | 26 | ||
27 | #include "avutil.h" | 27 | #include "avutil.h" |
28 | #include "log.h" | 28 | #include "log.h" |
29 | /* disable sprintf functions */ | ||
30 | #define snprintf(...) | ||
31 | #define vsnprintf snprintf | ||
29 | 32 | ||
30 | #if LIBAVUTIL_VERSION_MAJOR > 50 | 33 | #if LIBAVUTIL_VERSION_MAJOR > 50 |
31 | static | 34 | static |
32 | #endif | 35 | #endif |
33 | int av_log_level = AV_LOG_INFO; | 36 | int av_log_level = AV_LOG_INFO; |
34 | 37 | ||
35 | void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) | 38 | void av_log_default_callback(void* ptr, int level) |
36 | { | 39 | { |
37 | static int print_prefix=1; | 40 | static int print_prefix=1; |
38 | static int count; | 41 | static int count; |
@@ -61,9 +64,9 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) | |||
61 | strcpy(prev, line); | 64 | strcpy(prev, line); |
62 | } | 65 | } |
63 | 66 | ||
64 | static void (*av_log_callback)(void*, int, const char*, va_list) = av_log_default_callback; | 67 | static void (*av_log_callback)(void*, int = av_log_default_callback; |
65 | 68 | ||
66 | void av_log(void* avcl, int level, const char *fmt, ...) | 69 | void av_log(void* avcl, int level) |
67 | { | 70 | { |
68 | va_list vl; | 71 | va_list vl; |
69 | va_start(vl, fmt); | 72 | va_start(vl, fmt); |
diff --git a/apps/codecs/libwmapro/libavutil/log.h b/apps/codecs/libwmapro/libavutil/log.h index b0a1493607..43228e4985 100644 --- a/apps/codecs/libwmapro/libavutil/log.h +++ b/apps/codecs/libwmapro/libavutil/log.h | |||
@@ -110,6 +110,6 @@ void av_vlog(void*, int level, const char *fmt, va_list); | |||
110 | int av_log_get_level(void); | 110 | int av_log_get_level(void); |
111 | void av_log_set_level(int); | 111 | void av_log_set_level(int); |
112 | void av_log_set_callback(void (*)(void*, int, const char*, va_list)); | 112 | void av_log_set_callback(void (*)(void*, int, const char*, va_list)); |
113 | void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); | 113 | void av_log_default_callback(void* ptr, int level); |
114 | 114 | ||
115 | #endif /* AVUTIL_LOG_H */ | 115 | #endif /* AVUTIL_LOG_H */ |
diff --git a/apps/codecs/libwmapro/libavutil/mathematics.c b/apps/codecs/libwmapro/libavutil/mathematics.c index 7af0104516..f607d68b6e 100644 --- a/apps/codecs/libwmapro/libavutil/mathematics.c +++ b/apps/codecs/libwmapro/libavutil/mathematics.c | |||
@@ -103,13 +103,13 @@ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd){ | |||
103 | a0 = a0*b0 + t1a; | 103 | a0 = a0*b0 + t1a; |
104 | a1 = a1*b1 + (t1>>32) + (a0<t1a); | 104 | a1 = a1*b1 + (t1>>32) + (a0<t1a); |
105 | a0 += r; | 105 | a0 += r; |
106 | a1 += a0<r; | 106 | a1 += a0<(unsigned)r; |
107 | 107 | ||
108 | for(i=63; i>=0; i--){ | 108 | for(i=63; i>=0; i--){ |
109 | // int o= a1 & 0x8000000000000000ULL; | 109 | // int o= a1 & 0x8000000000000000ULL; |
110 | a1+= a1 + ((a0>>i)&1); | 110 | a1+= a1 + ((a0>>i)&1); |
111 | t1+=t1; | 111 | t1+=t1; |
112 | if(/*o || */c <= a1){ | 112 | if(/*o || */(unsigned)c <= a1){ |
113 | a1 -= c; | 113 | a1 -= c; |
114 | t1++; | 114 | t1++; |
115 | } | 115 | } |
diff --git a/apps/codecs/libwmapro/mathops.h b/apps/codecs/libwmapro/mathops.h index 149910bb1d..f6555dda21 100644 --- a/apps/codecs/libwmapro/mathops.h +++ b/apps/codecs/libwmapro/mathops.h | |||
@@ -24,20 +24,6 @@ | |||
24 | 24 | ||
25 | #include "libavutil/common.h" | 25 | #include "libavutil/common.h" |
26 | 26 | ||
27 | #if ARCH_ARM | ||
28 | # include "arm/mathops.h" | ||
29 | #elif ARCH_AVR32 | ||
30 | # include "avr32/mathops.h" | ||
31 | #elif ARCH_BFIN | ||
32 | # include "bfin/mathops.h" | ||
33 | #elif ARCH_MIPS | ||
34 | # include "mips/mathops.h" | ||
35 | #elif ARCH_PPC | ||
36 | # include "ppc/mathops.h" | ||
37 | #elif ARCH_X86 | ||
38 | # include "x86/mathops.h" | ||
39 | #endif | ||
40 | |||
41 | /* generic implementation */ | 27 | /* generic implementation */ |
42 | 28 | ||
43 | #ifndef MULL | 29 | #ifndef MULL |
diff --git a/apps/codecs/libwmapro/put_bits.h b/apps/codecs/libwmapro/put_bits.h index 9f66256b79..91401ff3fa 100644 --- a/apps/codecs/libwmapro/put_bits.h +++ b/apps/codecs/libwmapro/put_bits.h | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | //#define ALT_BITSTREAM_WRITER | 38 | //#define ALT_BITSTREAM_WRITER |
39 | //#define ALIGNED_BITSTREAM_WRITER | 39 | //#define ALIGNED_BITSTREAM_WRITER |
40 | 40 | #define HAVE_FAST_UNALIGNED 0 | |
41 | /* buf and buf_end must be present and used by every alternative writer. */ | 41 | /* buf and buf_end must be present and used by every alternative writer. */ |
42 | typedef struct PutBitContext { | 42 | typedef struct PutBitContext { |
43 | #ifdef ALT_BITSTREAM_WRITER | 43 | #ifdef ALT_BITSTREAM_WRITER |
diff --git a/apps/codecs/libwmapro/wma.c b/apps/codecs/libwmapro/wma.c index b606f59dbf..30fb9e022a 100644 --- a/apps/codecs/libwmapro/wma.c +++ b/apps/codecs/libwmapro/wma.c | |||
@@ -467,7 +467,8 @@ unsigned int ff_wma_get_large_val(GetBitContext* gb) | |||
467 | * @param coef_nb_bits number of bits for escaped level codes | 467 | * @param coef_nb_bits number of bits for escaped level codes |
468 | * @return 0 on success, -1 otherwise | 468 | * @return 0 on success, -1 otherwise |
469 | */ | 469 | */ |
470 | int ff_wma_run_level_decode(AVCodecContext* avctx, GetBitContext* gb, | 470 | #define av_log(...) |
471 | int ff_wma_run_level_decode(GetBitContext* gb, | ||
471 | VLC *vlc, | 472 | VLC *vlc, |
472 | const int32_t *level_table, const uint16_t *run_table, | 473 | const int32_t *level_table, const uint16_t *run_table, |
473 | int version, int32_t *ptr, int offset, | 474 | int version, int32_t *ptr, int offset, |
diff --git a/apps/codecs/libwmapro/wma.h b/apps/codecs/libwmapro/wma.h index d23b7ea02f..e4a1601515 100644 --- a/apps/codecs/libwmapro/wma.h +++ b/apps/codecs/libwmapro/wma.h | |||
@@ -24,8 +24,6 @@ | |||
24 | 24 | ||
25 | #include "get_bits.h" | 25 | #include "get_bits.h" |
26 | #include "put_bits.h" | 26 | #include "put_bits.h" |
27 | #include "dsputil.h" | ||
28 | #include "fft.h" | ||
29 | 27 | ||
30 | /* size of blocks */ | 28 | /* size of blocks */ |
31 | #define BLOCK_MIN_BITS 7 | 29 | #define BLOCK_MIN_BITS 7 |
@@ -62,90 +60,6 @@ typedef struct CoefVLCTable { | |||
62 | const uint16_t *levels; ///< table to build run/level tables | 60 | const uint16_t *levels; ///< table to build run/level tables |
63 | } CoefVLCTable; | 61 | } CoefVLCTable; |
64 | 62 | ||
65 | typedef struct WMACodecContext { | ||
66 | AVCodecContext* avctx; | ||
67 | GetBitContext gb; | ||
68 | PutBitContext pb; | ||
69 | int sample_rate; | ||
70 | int nb_channels; | ||
71 | int bit_rate; | ||
72 | int version; ///< 1 = 0x160 (WMAV1), 2 = 0x161 (WMAV2) | ||
73 | int block_align; | ||
74 | int use_bit_reservoir; | ||
75 | int use_variable_block_len; | ||
76 | int use_exp_vlc; ///< exponent coding: 0 = lsp, 1 = vlc + delta | ||
77 | int use_noise_coding; ///< true if perceptual noise is added | ||
78 | int byte_offset_bits; | ||
79 | VLC exp_vlc; | ||
80 | int exponent_sizes[BLOCK_NB_SIZES]; | ||
81 | uint16_t exponent_bands[BLOCK_NB_SIZES][25]; | ||
82 | int high_band_start[BLOCK_NB_SIZES]; ///< index of first coef in high band | ||
83 | int coefs_start; ///< first coded coef | ||
84 | int coefs_end[BLOCK_NB_SIZES]; ///< max number of coded coefficients | ||
85 | int exponent_high_sizes[BLOCK_NB_SIZES]; | ||
86 | int exponent_high_bands[BLOCK_NB_SIZES][HIGH_BAND_MAX_SIZE]; | ||
87 | VLC hgain_vlc; | ||
88 | |||
89 | /* coded values in high bands */ | ||
90 | int high_band_coded[MAX_CHANNELS][HIGH_BAND_MAX_SIZE]; | ||
91 | int high_band_values[MAX_CHANNELS][HIGH_BAND_MAX_SIZE]; | ||
92 | |||
93 | /* there are two possible tables for spectral coefficients */ | ||
94 | //FIXME the following 3 tables should be shared between decoders | ||
95 | VLC coef_vlc[2]; | ||
96 | uint16_t *run_table[2]; | ||
97 | float *level_table[2]; | ||
98 | uint16_t *int_table[2]; | ||
99 | const CoefVLCTable *coef_vlcs[2]; | ||
100 | /* frame info */ | ||
101 | int frame_len; ///< frame length in samples | ||
102 | int frame_len_bits; ///< frame_len = 1 << frame_len_bits | ||
103 | int nb_block_sizes; ///< number of block sizes | ||
104 | /* block info */ | ||
105 | int reset_block_lengths; | ||
106 | int block_len_bits; ///< log2 of current block length | ||
107 | int next_block_len_bits; ///< log2 of next block length | ||
108 | int prev_block_len_bits; ///< log2 of prev block length | ||
109 | int block_len; ///< block length in samples | ||
110 | int block_num; ///< block number in current frame | ||
111 | int block_pos; ///< current position in frame | ||
112 | uint8_t ms_stereo; ///< true if mid/side stereo mode | ||
113 | uint8_t channel_coded[MAX_CHANNELS]; ///< true if channel is coded | ||
114 | int exponents_bsize[MAX_CHANNELS]; ///< log2 ratio frame/exp. length | ||
115 | DECLARE_ALIGNED(16, float, exponents)[MAX_CHANNELS][BLOCK_MAX_SIZE]; | ||
116 | float max_exponent[MAX_CHANNELS]; | ||
117 | WMACoef coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE]; | ||
118 | DECLARE_ALIGNED(16, float, coefs)[MAX_CHANNELS][BLOCK_MAX_SIZE]; | ||
119 | DECLARE_ALIGNED(16, FFTSample, output)[BLOCK_MAX_SIZE * 2]; | ||
120 | FFTContext mdct_ctx[BLOCK_NB_SIZES]; | ||
121 | float *windows[BLOCK_NB_SIZES]; | ||
122 | /* output buffer for one frame and the last for IMDCT windowing */ | ||
123 | DECLARE_ALIGNED(16, float, frame_out)[MAX_CHANNELS][BLOCK_MAX_SIZE * 2]; | ||
124 | /* last frame info */ | ||
125 | uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + 4]; /* padding added */ | ||
126 | int last_bitoffset; | ||
127 | int last_superframe_len; | ||
128 | float noise_table[NOISE_TAB_SIZE]; | ||
129 | int noise_index; | ||
130 | float noise_mult; /* XXX: suppress that and integrate it in the noise array */ | ||
131 | /* lsp_to_curve tables */ | ||
132 | float lsp_cos_table[BLOCK_MAX_SIZE]; | ||
133 | float lsp_pow_e_table[256]; | ||
134 | float lsp_pow_m_table1[(1 << LSP_POW_BITS)]; | ||
135 | float lsp_pow_m_table2[(1 << LSP_POW_BITS)]; | ||
136 | DSPContext dsp; | ||
137 | |||
138 | #ifdef TRACE | ||
139 | int frame_count; | ||
140 | #endif | ||
141 | } WMACodecContext; | ||
142 | |||
143 | extern const uint16_t ff_wma_critical_freqs[25]; | ||
144 | extern const uint16_t ff_wma_hgain_huffcodes[37]; | ||
145 | extern const uint8_t ff_wma_hgain_huffbits[37]; | ||
146 | extern const float ff_wma_lsp_codebook[NB_LSP_COEFS][16]; | ||
147 | extern const uint32_t ff_aac_scalefactor_code[121]; | ||
148 | extern const uint8_t ff_aac_scalefactor_bits[121]; | ||
149 | 63 | ||
150 | int av_cold ff_wma_get_frame_len_bits(int sample_rate, int version, | 64 | int av_cold ff_wma_get_frame_len_bits(int sample_rate, int version, |
151 | unsigned int decode_flags); | 65 | unsigned int decode_flags); |
@@ -153,7 +67,7 @@ int ff_wma_init(AVCodecContext * avctx, int flags2); | |||
153 | int ff_wma_total_gain_to_bits(int total_gain); | 67 | int ff_wma_total_gain_to_bits(int total_gain); |
154 | int ff_wma_end(AVCodecContext *avctx); | 68 | int ff_wma_end(AVCodecContext *avctx); |
155 | unsigned int ff_wma_get_large_val(GetBitContext* gb); | 69 | unsigned int ff_wma_get_large_val(GetBitContext* gb); |
156 | int ff_wma_run_level_decode(AVCodecContext* avctx, GetBitContext* gb, | 70 | int ff_wma_run_level_decode(GetBitContext* gb, |
157 | VLC *vlc, | 71 | VLC *vlc, |
158 | const int32_t *level_table, const uint16_t *run_table, | 72 | const int32_t *level_table, const uint16_t *run_table, |
159 | int version, int32_t *ptr, int offset, | 73 | int version, int32_t *ptr, int offset, |
diff --git a/apps/codecs/libwmapro/wmapro_mdct.c b/apps/codecs/libwmapro/wmapro_mdct.c index aaa95dccdf..8f651d224a 100644 --- a/apps/codecs/libwmapro/wmapro_mdct.c +++ b/apps/codecs/libwmapro/wmapro_mdct.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include "../lib/mdct_lookup.h" /* for revtab */ | 4 | #include "../lib/mdct_lookup.h" /* for revtab */ |
5 | #include "../lib/fft.h" /* for FFT data structures */ | 5 | #include "../lib/fft.h" /* for FFT data structures */ |
6 | #include "codeclib.h" | 6 | #include "codeclib.h" |
7 | #define ROCKBOX_BIG_ENDIAN 0 | ||
7 | #include "../lib/codeclib_misc.h" /* for XNPROD31 */ | 8 | #include "../lib/codeclib_misc.h" /* for XNPROD31 */ |
8 | #include "wmapro_math.h" | 9 | #include "wmapro_math.h" |
9 | 10 | ||
diff --git a/apps/codecs/libwmapro/wmaprodec.c b/apps/codecs/libwmapro/wmaprodec.c index 8a8171aeb6..2dd2a6a1e4 100644 --- a/apps/codecs/libwmapro/wmaprodec.c +++ b/apps/codecs/libwmapro/wmaprodec.c | |||
@@ -103,6 +103,13 @@ | |||
103 | /* Uncomment the following line to enable some debug output */ | 103 | /* Uncomment the following line to enable some debug output */ |
104 | //#define WMAPRO_DUMP_CTX_EN | 104 | //#define WMAPRO_DUMP_CTX_EN |
105 | 105 | ||
106 | #undef DEBUGF | ||
107 | #ifdef WMAPRO_DUMP_CTX_EN | ||
108 | # define DEBUGF printf | ||
109 | #else | ||
110 | # define DEBUGF(...) | ||
111 | #endif | ||
112 | |||
106 | /* Some defines to make it compile */ | 113 | /* Some defines to make it compile */ |
107 | #define AVERROR_INVALIDDATA -1 | 114 | #define AVERROR_INVALIDDATA -1 |
108 | #define AVERROR_PATCHWELCOME -2 | 115 | #define AVERROR_PATCHWELCOME -2 |
@@ -177,7 +184,6 @@ typedef struct { | |||
177 | typedef struct WMAProDecodeCtx { | 184 | typedef struct WMAProDecodeCtx { |
178 | /* generic decoder variables */ | 185 | /* generic decoder variables */ |
179 | AVCodecContext* avctx; ///< codec context for av_log | 186 | AVCodecContext* avctx; ///< codec context for av_log |
180 | DSPContext dsp; ///< accelerated DSP functions | ||
181 | uint8_t frame_data[MAX_FRAMESIZE + | 187 | uint8_t frame_data[MAX_FRAMESIZE + |
182 | FF_INPUT_BUFFER_PADDING_SIZE];///< compressed frame data | 188 | FF_INPUT_BUFFER_PADDING_SIZE];///< compressed frame data |
183 | PutBitContext pb; ///< context for filling the frame_data buffer | 189 | PutBitContext pb; ///< context for filling the frame_data buffer |
@@ -236,6 +242,8 @@ typedef struct WMAProDecodeCtx { | |||
236 | WMAProChannelCtx channel[WMAPRO_MAX_CHANNELS]; ///< per channel data | 242 | WMAProChannelCtx channel[WMAPRO_MAX_CHANNELS]; ///< per channel data |
237 | } WMAProDecodeCtx; | 243 | } WMAProDecodeCtx; |
238 | 244 | ||
245 | /* static decode context, to avoid malloc */ | ||
246 | static WMAProDecodeCtx globWMAProDecCtx; | ||
239 | 247 | ||
240 | /** | 248 | /** |
241 | *@brief helper function to print the most important members of the context | 249 | *@brief helper function to print the most important members of the context |
@@ -264,7 +272,7 @@ static void av_cold dump_context(WMAProDecodeCtx *s) | |||
264 | */ | 272 | */ |
265 | av_cold int decode_init(AVCodecContext *avctx) | 273 | av_cold int decode_init(AVCodecContext *avctx) |
266 | { | 274 | { |
267 | avctx->priv_data = malloc(sizeof(WMAProDecodeCtx)); | 275 | avctx->priv_data = &globWMAProDecCtx; |
268 | memset(avctx->priv_data, 0, sizeof(WMAProDecodeCtx)); | 276 | memset(avctx->priv_data, 0, sizeof(WMAProDecodeCtx)); |
269 | WMAProDecodeCtx *s = avctx->priv_data; | 277 | WMAProDecodeCtx *s = avctx->priv_data; |
270 | uint8_t *edata_ptr = avctx->extradata; | 278 | uint8_t *edata_ptr = avctx->extradata; |
@@ -276,8 +284,6 @@ av_cold int decode_init(AVCodecContext *avctx) | |||
276 | s->avctx = avctx; | 284 | s->avctx = avctx; |
277 | init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE); | 285 | init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE); |
278 | 286 | ||
279 | avctx->sample_fmt = SAMPLE_FMT_FLT; | ||
280 | |||
281 | if (avctx->extradata_size >= 18) { | 287 | if (avctx->extradata_size >= 18) { |
282 | s->decode_flags = AV_RL16(edata_ptr+14); | 288 | s->decode_flags = AV_RL16(edata_ptr+14); |
283 | channel_mask = AV_RL32(edata_ptr+2); | 289 | channel_mask = AV_RL32(edata_ptr+2); |
@@ -288,7 +294,7 @@ av_cold int decode_init(AVCodecContext *avctx) | |||
288 | dprintf(avctx, "\n"); | 294 | dprintf(avctx, "\n"); |
289 | 295 | ||
290 | } else { | 296 | } else { |
291 | av_log_ask_for_sample(avctx, "Unknown extradata size\n"); | 297 | DEBUGF("Unknown extradata size\n"); |
292 | return AVERROR_INVALIDDATA; | 298 | return AVERROR_INVALIDDATA; |
293 | } | 299 | } |
294 | 300 | ||
@@ -301,7 +307,7 @@ av_cold int decode_init(AVCodecContext *avctx) | |||
301 | s->len_prefix = (s->decode_flags & 0x40); | 307 | s->len_prefix = (s->decode_flags & 0x40); |
302 | 308 | ||
303 | if (!s->len_prefix) { | 309 | if (!s->len_prefix) { |
304 | av_log_ask_for_sample(avctx, "no length prefix\n"); | 310 | DEBUGF("no length prefix\n"); |
305 | return AVERROR_INVALIDDATA; | 311 | return AVERROR_INVALIDDATA; |
306 | } | 312 | } |
307 | 313 | ||
@@ -325,7 +331,7 @@ av_cold int decode_init(AVCodecContext *avctx) | |||
325 | s->dynamic_range_compression = (s->decode_flags & 0x80); | 331 | s->dynamic_range_compression = (s->decode_flags & 0x80); |
326 | 332 | ||
327 | if (s->max_num_subframes > MAX_SUBFRAMES) { | 333 | if (s->max_num_subframes > MAX_SUBFRAMES) { |
328 | av_log(avctx, AV_LOG_ERROR, "invalid number of subframes %i\n", | 334 | DEBUGF("invalid number of subframes %i\n", |
329 | s->max_num_subframes); | 335 | s->max_num_subframes); |
330 | return AVERROR_INVALIDDATA; | 336 | return AVERROR_INVALIDDATA; |
331 | } | 337 | } |
@@ -344,10 +350,10 @@ av_cold int decode_init(AVCodecContext *avctx) | |||
344 | } | 350 | } |
345 | 351 | ||
346 | if (s->num_channels < 0) { | 352 | if (s->num_channels < 0) { |
347 | av_log(avctx, AV_LOG_ERROR, "invalid number of channels %d\n", s->num_channels); | 353 | DEBUGF("invalid number of channels %d\n", s->num_channels); |
348 | return AVERROR_INVALIDDATA; | 354 | return AVERROR_INVALIDDATA; |
349 | } else if (s->num_channels > WMAPRO_MAX_CHANNELS) { | 355 | } else if (s->num_channels > WMAPRO_MAX_CHANNELS) { |
350 | av_log_ask_for_sample(avctx, "unsupported number of channels\n"); | 356 | DEBUGF("unsupported number of channels\n"); |
351 | return AVERROR_PATCHWELCOME; | 357 | return AVERROR_PATCHWELCOME; |
352 | } | 358 | } |
353 | 359 | ||
@@ -437,8 +443,6 @@ av_cold int decode_init(AVCodecContext *avctx) | |||
437 | #ifdef WMAPRO_DUMP_CTX_EN | 443 | #ifdef WMAPRO_DUMP_CTX_EN |
438 | dump_context(s); | 444 | dump_context(s); |
439 | #endif | 445 | #endif |
440 | |||
441 | avctx->channel_layout = channel_mask; | ||
442 | return 0; | 446 | return 0; |
443 | } | 447 | } |
444 | 448 | ||
@@ -469,7 +473,7 @@ static int decode_subframe_length(WMAProDecodeCtx *s, int offset) | |||
469 | /** sanity check the length */ | 473 | /** sanity check the length */ |
470 | if (subframe_len < s->min_samples_per_subframe || | 474 | if (subframe_len < s->min_samples_per_subframe || |
471 | subframe_len > s->samples_per_frame) { | 475 | subframe_len > s->samples_per_frame) { |
472 | av_log(s->avctx, AV_LOG_ERROR, "broken frame: subframe_len %i\n", | 476 | DEBUGF("broken frame: subframe_len %i\n", |
473 | subframe_len); | 477 | subframe_len); |
474 | return AVERROR_INVALIDDATA; | 478 | return AVERROR_INVALIDDATA; |
475 | } | 479 | } |
@@ -546,16 +550,15 @@ static int decode_tilehdr(WMAProDecodeCtx *s) | |||
546 | WMAProChannelCtx* chan = &s->channel[c]; | 550 | WMAProChannelCtx* chan = &s->channel[c]; |
547 | 551 | ||
548 | if (contains_subframe[c]) { | 552 | if (contains_subframe[c]) { |
549 | if (chan->num_subframes >= MAX_SUBFRAMES) { | 553 | if (chan->num_subframes >= MAX_SUBFRAMES) { |
550 | av_log(s->avctx, AV_LOG_ERROR, | 554 | DEBUGF("broken frame: num subframes > 31\n"); |
551 | "broken frame: num subframes > 31\n"); | ||
552 | return AVERROR_INVALIDDATA; | 555 | return AVERROR_INVALIDDATA; |
553 | } | 556 | } |
554 | chan->subframe_len[chan->num_subframes] = subframe_len; | 557 | chan->subframe_len[chan->num_subframes] = subframe_len; |
555 | num_samples[c] += subframe_len; | 558 | num_samples[c] += subframe_len; |
556 | ++chan->num_subframes; | 559 | ++chan->num_subframes; |
557 | if (num_samples[c] > s->samples_per_frame) { | 560 | if (num_samples[c] > s->samples_per_frame) { |
558 | av_log(s->avctx, AV_LOG_ERROR, "broken frame: " | 561 | DEBUGF("broken frame: " |
559 | "channel len > samples_per_frame\n"); | 562 | "channel len > samples_per_frame\n"); |
560 | return AVERROR_INVALIDDATA; | 563 | return AVERROR_INVALIDDATA; |
561 | } | 564 | } |
@@ -674,8 +677,7 @@ static int decode_channel_transform(WMAProDecodeCtx* s) | |||
674 | int remaining_channels = s->channels_for_cur_subframe; | 677 | int remaining_channels = s->channels_for_cur_subframe; |
675 | 678 | ||
676 | if (get_bits1(&s->gb)) { | 679 | if (get_bits1(&s->gb)) { |
677 | av_log_ask_for_sample(s->avctx, | 680 | DEBUGF("unsupported channel transform bit\n"); |
678 | "unsupported channel transform bit\n"); | ||
679 | return AVERROR_INVALIDDATA; | 681 | return AVERROR_INVALIDDATA; |
680 | } | 682 | } |
681 | 683 | ||
@@ -711,8 +713,7 @@ static int decode_channel_transform(WMAProDecodeCtx* s) | |||
711 | if (chgroup->num_channels == 2) { | 713 | if (chgroup->num_channels == 2) { |
712 | if (get_bits1(&s->gb)) { | 714 | if (get_bits1(&s->gb)) { |
713 | if (get_bits1(&s->gb)) { | 715 | if (get_bits1(&s->gb)) { |
714 | av_log_ask_for_sample(s->avctx, | 716 | DEBUGF("unsupported channel transform type\n"); |
715 | "unsupported channel transform type\n"); | ||
716 | } | 717 | } |
717 | } else { | 718 | } else { |
718 | chgroup->transform = 1; | 719 | chgroup->transform = 1; |
@@ -730,7 +731,7 @@ static int decode_channel_transform(WMAProDecodeCtx* s) | |||
730 | } | 731 | } |
731 | } | 732 | } |
732 | } else if (chgroup->num_channels > 2) { | 733 | } else if (chgroup->num_channels > 2) { |
733 | LOGF("in wmaprodec.c: Multichannel streams still not supported\n"); | 734 | DEBUGF("in wmaprodec.c: Multichannel streams still not supported\n"); |
734 | return -1; | 735 | return -1; |
735 | #if 0 | 736 | #if 0 |
736 | if (get_bits1(&s->gb)) { | 737 | if (get_bits1(&s->gb)) { |
@@ -857,7 +858,7 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c) | |||
857 | memset(&ci->coeffs[cur_coeff], 0, | 858 | memset(&ci->coeffs[cur_coeff], 0, |
858 | sizeof(*ci->coeffs) * (s->subframe_len - cur_coeff)); | 859 | sizeof(*ci->coeffs) * (s->subframe_len - cur_coeff)); |
859 | 860 | ||
860 | if (ff_wma_run_level_decode(s->avctx, &s->gb, vlc, | 861 | if (ff_wma_run_level_decode(&s->gb, vlc, |
861 | level, run, 1, ci->coeffs, | 862 | level, run, 1, ci->coeffs, |
862 | cur_coeff, s->subframe_len, | 863 | cur_coeff, s->subframe_len, |
863 | s->subframe_len, s->esc_len, 0)) | 864 | s->subframe_len, s->esc_len, 0)) |
@@ -937,8 +938,7 @@ static int decode_scale_factors(WMAProDecodeCtx* s) | |||
937 | 938 | ||
938 | i += skip; | 939 | i += skip; |
939 | if (i >= s->num_bands) { | 940 | if (i >= s->num_bands) { |
940 | av_log(s->avctx, AV_LOG_ERROR, | 941 | DEBUGF("invalid scale factor coding\n"); |
941 | "invalid scale factor coding\n"); | ||
942 | return AVERROR_INVALIDDATA; | 942 | return AVERROR_INVALIDDATA; |
943 | } | 943 | } |
944 | s->channel[c].scale_factors[i] += (val ^ sign) - sign; | 944 | s->channel[c].scale_factors[i] += (val ^ sign) - sign; |
@@ -1137,7 +1137,7 @@ static int decode_subframe(WMAProDecodeCtx *s) | |||
1137 | 1137 | ||
1138 | if (num_fill_bits >= 0) { | 1138 | if (num_fill_bits >= 0) { |
1139 | if (get_bits_count(&s->gb) + num_fill_bits > s->num_saved_bits) { | 1139 | if (get_bits_count(&s->gb) + num_fill_bits > s->num_saved_bits) { |
1140 | av_log(s->avctx, AV_LOG_ERROR, "invalid number of fill bits\n"); | 1140 | DEBUGF("invalid number of fill bits\n"); |
1141 | return AVERROR_INVALIDDATA; | 1141 | return AVERROR_INVALIDDATA; |
1142 | } | 1142 | } |
1143 | 1143 | ||
@@ -1147,7 +1147,7 @@ static int decode_subframe(WMAProDecodeCtx *s) | |||
1147 | 1147 | ||
1148 | /** no idea for what the following bit is used */ | 1148 | /** no idea for what the following bit is used */ |
1149 | if (get_bits1(&s->gb)) { | 1149 | if (get_bits1(&s->gb)) { |
1150 | av_log_ask_for_sample(s->avctx, "reserved bit set\n"); | 1150 | DEBUGF("reserved bit set\n"); |
1151 | return AVERROR_INVALIDDATA; | 1151 | return AVERROR_INVALIDDATA; |
1152 | } | 1152 | } |
1153 | 1153 | ||
@@ -1165,7 +1165,7 @@ static int decode_subframe(WMAProDecodeCtx *s) | |||
1165 | int quant_step = 90 * s->bits_per_sample >> 4; | 1165 | int quant_step = 90 * s->bits_per_sample >> 4; |
1166 | if ((get_bits1(&s->gb))) { | 1166 | if ((get_bits1(&s->gb))) { |
1167 | /** FIXME: might change run level mode decision */ | 1167 | /** FIXME: might change run level mode decision */ |
1168 | av_log_ask_for_sample(s->avctx, "unsupported quant step coding\n"); | 1168 | DEBUGF("unsupported quant step coding\n"); |
1169 | return AVERROR_INVALIDDATA; | 1169 | return AVERROR_INVALIDDATA; |
1170 | } | 1170 | } |
1171 | /** decode quantization step */ | 1171 | /** decode quantization step */ |
@@ -1181,7 +1181,7 @@ static int decode_subframe(WMAProDecodeCtx *s) | |||
1181 | quant_step += ((quant + step) ^ sign) - sign; | 1181 | quant_step += ((quant + step) ^ sign) - sign; |
1182 | } | 1182 | } |
1183 | if (quant_step < 0) { | 1183 | if (quant_step < 0) { |
1184 | av_log(s->avctx, AV_LOG_DEBUG, "negative quant step\n"); | 1184 | DEBUGF("negative quant step\n"); |
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | /** decode quantization step modifiers for every channel */ | 1187 | /** decode quantization step modifiers for every channel */ |
@@ -1245,7 +1245,7 @@ static int decode_subframe(WMAProDecodeCtx *s) | |||
1245 | s->channel[c].scale_factor_step; | 1245 | s->channel[c].scale_factor_step; |
1246 | 1246 | ||
1247 | if(exp < EXP_MIN || exp > EXP_MAX) { | 1247 | if(exp < EXP_MIN || exp > EXP_MAX) { |
1248 | LOGF("in wmaprodec.c : unhandled value for exp, please report sample.\n"); | 1248 | DEBUGF("in wmaprodec.c : unhandled value for exp, please report sample.\n"); |
1249 | return -1; | 1249 | return -1; |
1250 | } | 1250 | } |
1251 | const FIXED quant = QUANT(exp); | 1251 | const FIXED quant = QUANT(exp); |
@@ -1272,7 +1272,7 @@ static int decode_subframe(WMAProDecodeCtx *s) | |||
1272 | for (i = 0; i < s->channels_for_cur_subframe; i++) { | 1272 | for (i = 0; i < s->channels_for_cur_subframe; i++) { |
1273 | int c = s->channel_indexes_for_cur_subframe[i]; | 1273 | int c = s->channel_indexes_for_cur_subframe[i]; |
1274 | if (s->channel[c].cur_subframe >= s->channel[c].num_subframes) { | 1274 | if (s->channel[c].cur_subframe >= s->channel[c].num_subframes) { |
1275 | av_log(s->avctx, AV_LOG_ERROR, "broken subframe\n"); | 1275 | DEBUGF("broken subframe\n"); |
1276 | return AVERROR_INVALIDDATA; | 1276 | return AVERROR_INVALIDDATA; |
1277 | } | 1277 | } |
1278 | ++s->channel[c].cur_subframe; | 1278 | ++s->channel[c].cur_subframe; |
@@ -1297,8 +1297,7 @@ static int decode_frame(WMAProDecodeCtx *s) | |||
1297 | /** check for potential output buffer overflow */ | 1297 | /** check for potential output buffer overflow */ |
1298 | if (s->num_channels * s->samples_per_frame > s->samples_end - s->samples) { | 1298 | if (s->num_channels * s->samples_per_frame > s->samples_end - s->samples) { |
1299 | /** return an error if no frame could be decoded at all */ | 1299 | /** return an error if no frame could be decoded at all */ |
1300 | av_log(s->avctx, AV_LOG_ERROR, | 1300 | DEBUGF("not enough space for the output samples\n"); |
1301 | "not enough space for the output samples\n"); | ||
1302 | s->packet_loss = 1; | 1301 | s->packet_loss = 1; |
1303 | return 0; | 1302 | return 0; |
1304 | } | 1303 | } |
@@ -1317,7 +1316,7 @@ static int decode_frame(WMAProDecodeCtx *s) | |||
1317 | 1316 | ||
1318 | /** read postproc transform */ | 1317 | /** read postproc transform */ |
1319 | if (s->num_channels > 1 && get_bits1(gb)) { | 1318 | if (s->num_channels > 1 && get_bits1(gb)) { |
1320 | av_log_ask_for_sample(s->avctx, "Unsupported postproc transform found\n"); | 1319 | DEBUGF("Unsupported postproc transform found\n"); |
1321 | s->packet_loss = 1; | 1320 | s->packet_loss = 1; |
1322 | return 0; | 1321 | return 0; |
1323 | } | 1322 | } |
@@ -1391,7 +1390,7 @@ static int decode_frame(WMAProDecodeCtx *s) | |||
1391 | 1390 | ||
1392 | if (len != (get_bits_count(gb) - s->frame_offset) + 2) { | 1391 | if (len != (get_bits_count(gb) - s->frame_offset) + 2) { |
1393 | /** FIXME: not sure if this is always an error */ | 1392 | /** FIXME: not sure if this is always an error */ |
1394 | av_log(s->avctx, AV_LOG_ERROR, "frame[%i] would have to skip %i bits\n", | 1393 | DEBUGF("frame[%i] would have to skip %i bits\n", |
1395 | (int)s->frame_num, len - (get_bits_count(gb) - s->frame_offset) - 1); | 1394 | (int)s->frame_num, len - (get_bits_count(gb) - s->frame_offset) - 1); |
1396 | s->packet_loss = 1; | 1395 | s->packet_loss = 1; |
1397 | return 0; | 1396 | return 0; |
@@ -1443,7 +1442,7 @@ static void save_bits(WMAProDecodeCtx *s, GetBitContext* gb, int len, | |||
1443 | buflen = (s->num_saved_bits + len + 8) >> 3; | 1442 | buflen = (s->num_saved_bits + len + 8) >> 3; |
1444 | 1443 | ||
1445 | if (len <= 0 || buflen > MAX_FRAMESIZE) { | 1444 | if (len <= 0 || buflen > MAX_FRAMESIZE) { |
1446 | av_log_ask_for_sample(s->avctx, "input buffer too small\n"); | 1445 | DEBUGF("input buffer too small\n"); |
1447 | s->packet_loss = 1; | 1446 | s->packet_loss = 1; |
1448 | return; | 1447 | return; |
1449 | } | 1448 | } |
@@ -1516,7 +1515,7 @@ int decode_packet(AVCodecContext *avctx, | |||
1516 | if (!s->packet_loss && | 1515 | if (!s->packet_loss && |
1517 | ((s->packet_sequence_number + 1) & 0xF) != packet_sequence_number) { | 1516 | ((s->packet_sequence_number + 1) & 0xF) != packet_sequence_number) { |
1518 | s->packet_loss = 1; | 1517 | s->packet_loss = 1; |
1519 | av_log(avctx, AV_LOG_ERROR, "Packet loss detected! seq %x vs %x\n", | 1518 | DEBUGF("Packet loss detected! seq %x vs %x\n", |
1520 | s->packet_sequence_number, packet_sequence_number); | 1519 | s->packet_sequence_number, packet_sequence_number); |
1521 | } | 1520 | } |
1522 | s->packet_sequence_number = packet_sequence_number; | 1521 | s->packet_sequence_number = packet_sequence_number; |
diff --git a/apps/codecs/wmapro.c b/apps/codecs/wmapro.c index a31e63d79f..ba19e2925c 100644 --- a/apps/codecs/wmapro.c +++ b/apps/codecs/wmapro.c | |||
@@ -28,7 +28,7 @@ CODEC_HEADER | |||
28 | #define MAXSAMPLES (1L << 12) /* Max number of samples in a wma pro subframe */ | 28 | #define MAXSAMPLES (1L << 12) /* Max number of samples in a wma pro subframe */ |
29 | #define MAXCHANNELS 8 | 29 | #define MAXCHANNELS 8 |
30 | #define BUFSIZE MAXCHANNELS * MAXSAMPLES | 30 | #define BUFSIZE MAXCHANNELS * MAXSAMPLES |
31 | static int32_t decoded[BUFSIZE] IBSS_ATTR; | 31 | int32_t decoded[BUFSIZE]; |
32 | 32 | ||
33 | AVCodecContext avctx; | 33 | AVCodecContext avctx; |
34 | AVPacket avpkt; | 34 | AVPacket avpkt; |