Commit a9c9a240 authored by Michel Bardiaux's avatar Michel Bardiaux

Supply context to tprintf

Originally committed as revision 8142 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 01ca9ac3
...@@ -938,10 +938,10 @@ static inline int get_xbits_trace(GetBitContext *s, int n, char *file, const cha ...@@ -938,10 +938,10 @@ static inline int get_xbits_trace(GetBitContext *s, int n, char *file, const cha
#define get_vlc(s, vlc) get_vlc_trace(s, (vlc)->table, (vlc)->bits, 3, __FILE__, __PRETTY_FUNCTION__, __LINE__) #define get_vlc(s, vlc) get_vlc_trace(s, (vlc)->table, (vlc)->bits, 3, __FILE__, __PRETTY_FUNCTION__, __LINE__)
#define get_vlc2(s, tab, bits, max) get_vlc_trace(s, tab, bits, max, __FILE__, __PRETTY_FUNCTION__, __LINE__) #define get_vlc2(s, tab, bits, max) get_vlc_trace(s, tab, bits, max, __FILE__, __PRETTY_FUNCTION__, __LINE__)
#define tprintf(...) av_log(NULL, AV_LOG_DEBUG, __VA_ARGS__) #define tprintf(p, ...) av_log(p, AV_LOG_DEBUG, __VA_ARGS__)
#else //TRACE #else //TRACE
#define tprintf(...) {} #define tprintf(p, ...) {}
#endif #endif
static inline int decode012(GetBitContext *gb){ static inline int decode012(GetBitContext *gb){
......
This diff is collapsed.
...@@ -268,14 +268,14 @@ int ff_wma_init(AVCodecContext * avctx, int flags2) ...@@ -268,14 +268,14 @@ int ff_wma_init(AVCodecContext * avctx, int flags2)
} }
s->exponent_high_sizes[k] = j; s->exponent_high_sizes[k] = j;
#if 0 #if 0
tprintf("%5d: coefs_end=%d high_band_start=%d nb_high_bands=%d: ", tprintf(s->avctx, "%5d: coefs_end=%d high_band_start=%d nb_high_bands=%d: ",
s->frame_len >> k, s->frame_len >> k,
s->coefs_end[k], s->coefs_end[k],
s->high_band_start[k], s->high_band_start[k],
s->exponent_high_sizes[k]); s->exponent_high_sizes[k]);
for(j=0;j<s->exponent_high_sizes[k];j++) for(j=0;j<s->exponent_high_sizes[k];j++)
tprintf(" %d", s->exponent_high_bands[k][j]); tprintf(s->avctx, " %d", s->exponent_high_bands[k][j]);
tprintf("\n"); tprintf(s->avctx, "\n");
#endif #endif
} }
} }
...@@ -284,12 +284,12 @@ int ff_wma_init(AVCodecContext * avctx, int flags2) ...@@ -284,12 +284,12 @@ int ff_wma_init(AVCodecContext * avctx, int flags2)
{ {
int i, j; int i, j;
for(i = 0; i < s->nb_block_sizes; i++) { for(i = 0; i < s->nb_block_sizes; i++) {
tprintf("%5d: n=%2d:", tprintf(s->avctx, "%5d: n=%2d:",
s->frame_len >> i, s->frame_len >> i,
s->exponent_sizes[i]); s->exponent_sizes[i]);
for(j=0;j<s->exponent_sizes[i];j++) for(j=0;j<s->exponent_sizes[i];j++)
tprintf(" %d", s->exponent_bands[i][j]); tprintf(s->avctx, " %d", s->exponent_bands[i][j]);
tprintf("\n"); tprintf(s->avctx, "\n");
} }
} }
#endif #endif
......
...@@ -59,6 +59,7 @@ typedef struct CoefVLCTable { ...@@ -59,6 +59,7 @@ typedef struct CoefVLCTable {
} CoefVLCTable; } CoefVLCTable;
typedef struct WMADecodeContext { typedef struct WMADecodeContext {
AVCodecContext* avctx;
GetBitContext gb; GetBitContext gb;
PutBitContext pb; PutBitContext pb;
int sample_rate; int sample_rate;
......
...@@ -48,34 +48,34 @@ ...@@ -48,34 +48,34 @@
static void wma_lsp_to_curve_init(WMADecodeContext *s, int frame_len); static void wma_lsp_to_curve_init(WMADecodeContext *s, int frame_len);
#ifdef TRACE #ifdef TRACE
static void dump_shorts(const char *name, const short *tab, int n) static void dump_shorts(WMADecodeContext *s, const char *name, const short *tab, int n)
{ {
int i; int i;
tprintf("%s[%d]:\n", name, n); tprintf(s->avctx, "%s[%d]:\n", name, n);
for(i=0;i<n;i++) { for(i=0;i<n;i++) {
if ((i & 7) == 0) if ((i & 7) == 0)
tprintf("%4d: ", i); tprintf(s->avctx, "%4d: ", i);
tprintf(" %5d.0", tab[i]); tprintf(s->avctx, " %5d.0", tab[i]);
if ((i & 7) == 7) if ((i & 7) == 7)
tprintf("\n"); tprintf(s->avctx, "\n");
} }
} }
static void dump_floats(const char *name, int prec, const float *tab, int n) static void dump_floats(WMADecodeContext *s, const char *name, int prec, const float *tab, int n)
{ {
int i; int i;
tprintf("%s[%d]:\n", name, n); tprintf(s->avctx, "%s[%d]:\n", name, n);
for(i=0;i<n;i++) { for(i=0;i<n;i++) {
if ((i & 7) == 0) if ((i & 7) == 0)
tprintf("%4d: ", i); tprintf(s->avctx, "%4d: ", i);
tprintf(" %8.*f", prec, tab[i]); tprintf(s->avctx, " %8.*f", prec, tab[i]);
if ((i & 7) == 7) if ((i & 7) == 7)
tprintf("\n"); tprintf(s->avctx, "\n");
} }
if ((i & 7) != 0) if ((i & 7) != 0)
tprintf("\n"); tprintf(s->avctx, "\n");
} }
#endif #endif
...@@ -85,6 +85,8 @@ static int wma_decode_init(AVCodecContext * avctx) ...@@ -85,6 +85,8 @@ static int wma_decode_init(AVCodecContext * avctx)
int i, flags1, flags2; int i, flags1, flags2;
uint8_t *extradata; uint8_t *extradata;
s->avctx = avctx;
/* extract flag infos */ /* extract flag infos */
flags1 = 0; flags1 = 0;
flags2 = 0; flags2 = 0;
...@@ -326,7 +328,7 @@ static int wma_decode_block(WMADecodeContext *s) ...@@ -326,7 +328,7 @@ static int wma_decode_block(WMADecodeContext *s)
float mdct_norm; float mdct_norm;
#ifdef TRACE #ifdef TRACE
tprintf("***decode_block: %d:%d\n", s->frame_count - 1, s->block_num); tprintf(s->avctx, "***decode_block: %d:%d\n", s->frame_count - 1, s->block_num);
#endif #endif
/* compute current block length */ /* compute current block length */
...@@ -567,7 +569,7 @@ static int wma_decode_block(WMADecodeContext *s) ...@@ -567,7 +569,7 @@ static int wma_decode_block(WMADecodeContext *s)
} }
exp_power[j] = e2 / n; exp_power[j] = e2 / n;
last_high_band = j; last_high_band = j;
tprintf("%d: power=%f (%d)\n", j, exp_power[j], n); tprintf(s->avctx, "%d: power=%f (%d)\n", j, exp_power[j], n);
} }
exp_ptr += n; exp_ptr += n;
} }
...@@ -628,8 +630,8 @@ static int wma_decode_block(WMADecodeContext *s) ...@@ -628,8 +630,8 @@ static int wma_decode_block(WMADecodeContext *s)
#ifdef TRACE #ifdef TRACE
for(ch = 0; ch < s->nb_channels; ch++) { for(ch = 0; ch < s->nb_channels; ch++) {
if (s->channel_coded[ch]) { if (s->channel_coded[ch]) {
dump_floats("exponents", 3, s->exponents[ch], s->block_len); dump_floats(s, "exponents", 3, s->exponents[ch], s->block_len);
dump_floats("coefs", 1, s->coefs[ch], s->block_len); dump_floats(s, "coefs", 1, s->coefs[ch], s->block_len);
} }
} }
#endif #endif
...@@ -642,7 +644,7 @@ static int wma_decode_block(WMADecodeContext *s) ...@@ -642,7 +644,7 @@ static int wma_decode_block(WMADecodeContext *s)
/* no need to optimize this case because it should almost /* no need to optimize this case because it should almost
never happen */ never happen */
if (!s->channel_coded[0]) { if (!s->channel_coded[0]) {
tprintf("rare ms-stereo case happened\n"); tprintf(s->avctx, "rare ms-stereo case happened\n");
memset(s->coefs[0], 0, sizeof(float) * s->block_len); memset(s->coefs[0], 0, sizeof(float) * s->block_len);
s->channel_coded[0] = 1; s->channel_coded[0] = 1;
} }
...@@ -744,7 +746,7 @@ static int wma_decode_frame(WMADecodeContext *s, int16_t *samples) ...@@ -744,7 +746,7 @@ static int wma_decode_frame(WMADecodeContext *s, int16_t *samples)
float *iptr; float *iptr;
#ifdef TRACE #ifdef TRACE
tprintf("***decode_frame: %d size=%d\n", s->frame_count++, s->frame_len); tprintf(s->avctx, "***decode_frame: %d size=%d\n", s->frame_count++, s->frame_len);
#endif #endif
/* read each block */ /* read each block */
...@@ -783,7 +785,7 @@ static int wma_decode_frame(WMADecodeContext *s, int16_t *samples) ...@@ -783,7 +785,7 @@ static int wma_decode_frame(WMADecodeContext *s, int16_t *samples)
} }
#ifdef TRACE #ifdef TRACE
dump_shorts("samples", samples, n * s->nb_channels); dump_shorts(s, "samples", samples, n * s->nb_channels);
#endif #endif
return 0; return 0;
} }
...@@ -797,7 +799,7 @@ static int wma_decode_superframe(AVCodecContext *avctx, ...@@ -797,7 +799,7 @@ static int wma_decode_superframe(AVCodecContext *avctx,
uint8_t *q; uint8_t *q;
int16_t *samples; int16_t *samples;
tprintf("***decode_superframe:\n"); tprintf(avctx, "***decode_superframe:\n");
if(buf_size==0){ if(buf_size==0){
s->last_superframe_len = 0; s->last_superframe_len = 0;
......
...@@ -31,6 +31,8 @@ static int encode_init(AVCodecContext * avctx){ ...@@ -31,6 +31,8 @@ static int encode_init(AVCodecContext * avctx){
int i, flags1, flags2; int i, flags1, flags2;
uint8_t *extradata; uint8_t *extradata;
s->avctx = avctx;
if(avctx->channels > MAX_CHANNELS) if(avctx->channels > MAX_CHANNELS)
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment