diff options
| author | Jean-Philippe Bernardy <jeanphilippe.bernardy@gmail.com> | 2005-03-10 21:54:26 +0000 |
|---|---|---|
| committer | Jean-Philippe Bernardy <jeanphilippe.bernardy@gmail.com> | 2005-03-10 21:54:26 +0000 |
| commit | a9eda6060a2a204d279f547854c2c4be1bbf90d8 (patch) | |
| tree | 29a50d4077b3b118373dee2627daf713999fb108 /apps/codecs | |
| parent | ae4b2de6194467b290bc47319652f741fc70b7e2 (diff) | |
| download | rockbox-a9eda6060a2a204d279f547854c2c4be1bbf90d8.zip rockbox-a9eda6060a2a204d279f547854c2c4be1bbf90d8.tar.gz rockbox-a9eda6060a2a204d279f547854c2c4be1bbf90d8.tar.bz2 rockbox-a9eda6060a2a204d279f547854c2c4be1bbf90d8.tar.xz | |
oops, 1I^2 = 1...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6184 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs')
| -rw-r--r-- | apps/codecs/libmad/layer3.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/apps/codecs/libmad/layer3.c b/apps/codecs/libmad/layer3.c index a8d2d5f..732269f 100644 --- a/apps/codecs/libmad/layer3.c +++ b/apps/codecs/libmad/layer3.c @@ -25,6 +25,9 @@ # include "global.h" +#include "debug.h" + + # include <string.h> # ifdef HAVE_ASSERT_H @@ -834,8 +837,8 @@ void III_exponents(struct channel const *channel, exponents[sfbi] = gain - (signed int) ((channel->scalefac[sfbi] + (pretab[sfbi] & premask)) << scalefac_multiplier); - - l += sfbwidth[sfbi++]; + unsigned int w = sfbwidth[sfbi++]; + l += 3 * w; } } @@ -853,7 +856,7 @@ void III_exponents(struct channel const *channel, exponents[sfbi + 2] = gain2 - (signed int) (channel->scalefac[sfbi + 2] << scalefac_multiplier); - l += 3I * sfbwidth[sfbi]; + l += sfbwidth[sfbi]; sfbi += 3; } } @@ -2636,12 +2639,15 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) enum mad_error error; int result = 0; + DEBUGF("mad_layer_III: 0 Enter"); + /* allocate Layer III dynamic structures */ if (stream->main_data == 0) { stream->main_data = malloc(MAD_BUFFER_MDLEN); if (stream->main_data == 0) { stream->error = MAD_ERROR_NOMEM; + DEBUGF("mad_layer_III: Nomem 1"); return -1; } } @@ -2650,6 +2656,7 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) frame->overlap = calloc(2 * 32 * 18, sizeof(mad_fixed_t)); if (frame->overlap == 0) { stream->error = MAD_ERROR_NOMEM; + DEBUGF("mad_layer_III: Nomem 2"); return -1; } } @@ -2664,6 +2671,8 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) (signed int) si_len) { stream->error = MAD_ERROR_BADFRAMELEN; stream->md_len = 0; + DEBUGF("mad_layer_III: Insane frame"); + return -1; } @@ -2677,6 +2686,7 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) !(frame->options & MAD_OPTION_IGNORECRC)) { stream->error = MAD_ERROR_BADCRC; result = -1; + DEBUGF("mad_layer_III: CRC incorrect"); } } @@ -2687,6 +2697,7 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) if (error && result == 0) { stream->error = error; result = -1; + DEBUGF("mad_layer_III: III_sideinfo error"); } header->flags |= priv_bitlen; @@ -2734,6 +2745,9 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) if (result == 0) { stream->error = MAD_ERROR_BADDATAPTR; result = -1; + DEBUGF("mad_layer_III: bad data ptr si.main_data_begin=%x stream->md_len=%x", si.main_data_begin, stream->md_len); + DEBUGF("frame space = %x", frame_space); + DEBUGF("next_md_begin = %x", next_md_begin); } } else { @@ -2760,6 +2774,7 @@ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) error = III_decode(&ptr, frame, &si, nch); if (error) { stream->error = error; + DEBUGF("mad_layer_III: III_decode error"); result = -1; } |