Commit 02a8d43a authored by Diego Biurrun's avatar Diego Biurrun

Replace some av_log/printf + #ifdef combinations by av_dlog.

parent 1f6b9cc3
...@@ -81,8 +81,6 @@ void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length) ...@@ -81,8 +81,6 @@ void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
/* VLC decoding */ /* VLC decoding */
//#define DEBUG_VLC
#define GET_DATA(v, table, i, wrap, size) \ #define GET_DATA(v, table, i, wrap, size) \
{\ {\
const uint8_t *ptr = (const uint8_t *)table + i * wrap;\ const uint8_t *ptr = (const uint8_t *)table + i * wrap;\
...@@ -162,10 +160,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, ...@@ -162,10 +160,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
table_size = 1 << table_nb_bits; table_size = 1 << table_nb_bits;
table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC); table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC);
#ifdef DEBUG_VLC av_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size);
av_log(NULL,AV_LOG_DEBUG,"new table index=%d size=%d\n",
table_index, table_size);
#endif
if (table_index < 0) if (table_index < 0)
return -1; return -1;
table = &vlc->table[table_index]; table = &vlc->table[table_index];
...@@ -180,9 +175,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, ...@@ -180,9 +175,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
n = codes[i].bits; n = codes[i].bits;
code = codes[i].code; code = codes[i].code;
symbol = codes[i].symbol; symbol = codes[i].symbol;
#if defined(DEBUG_VLC) && 0 av_dlog(NULL, "i=%d n=%d code=0x%x\n", i, n, code);
av_log(NULL,AV_LOG_DEBUG,"i=%d n=%d code=0x%x\n", i, n, code);
#endif
if (n <= table_nb_bits) { if (n <= table_nb_bits) {
/* no need to add another table */ /* no need to add another table */
j = code >> (32 - table_nb_bits); j = code >> (32 - table_nb_bits);
...@@ -193,10 +186,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, ...@@ -193,10 +186,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
inc = 1 << n; inc = 1 << n;
} }
for (k = 0; k < nb; k++) { for (k = 0; k < nb; k++) {
#ifdef DEBUG_VLC av_dlog(NULL, "%4x: code=%d n=%d\n", j, i, n);
av_log(NULL, AV_LOG_DEBUG, "%4x: code=%d n=%d\n",
j, i, n);
#endif
if (table[j][1] /*bits*/ != 0) { if (table[j][1] /*bits*/ != 0) {
av_log(NULL, AV_LOG_ERROR, "incorrect codes\n"); av_log(NULL, AV_LOG_ERROR, "incorrect codes\n");
return -1; return -1;
...@@ -226,10 +216,8 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, ...@@ -226,10 +216,8 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
subtable_bits = FFMIN(subtable_bits, table_nb_bits); subtable_bits = FFMIN(subtable_bits, table_nb_bits);
j = (flags & INIT_VLC_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix; j = (flags & INIT_VLC_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix;
table[j][1] = -subtable_bits; table[j][1] = -subtable_bits;
#ifdef DEBUG_VLC av_dlog(NULL, "%4x: n=%d (subtable)\n",
av_log(NULL,AV_LOG_DEBUG,"%4x: n=%d (subtable)\n", j, codes[i].bits + table_nb_bits);
j, codes[i].bits + table_nb_bits);
#endif
index = build_table(vlc, subtable_bits, k-i, codes+i, flags); index = build_table(vlc, subtable_bits, k-i, codes+i, flags);
if (index < 0) if (index < 0)
return -1; return -1;
...@@ -291,9 +279,7 @@ int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, ...@@ -291,9 +279,7 @@ int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
vlc->table_size = 0; vlc->table_size = 0;
} }
#ifdef DEBUG_VLC av_dlog(NULL, "build table nb_codes=%d\n", nb_codes);
av_log(NULL,AV_LOG_DEBUG,"build table nb_codes=%d\n", nb_codes);
#endif
buf = av_malloc((nb_codes+1)*sizeof(VLCcode)); buf = av_malloc((nb_codes+1)*sizeof(VLCcode));
......
...@@ -358,9 +358,6 @@ static av_cold int dvvideo_init_encoder(AVCodecContext *avctx) ...@@ -358,9 +358,6 @@ static av_cold int dvvideo_init_encoder(AVCodecContext *avctx)
return dvvideo_init(avctx); return dvvideo_init(avctx);
} }
// #define VLC_DEBUG
// #define printf(...) av_log(NULL, AV_LOG_ERROR, __VA_ARGS__)
typedef struct BlockInfo { typedef struct BlockInfo {
const uint32_t *factor_table; const uint32_t *factor_table;
const uint8_t *scan_table; const uint8_t *scan_table;
...@@ -404,9 +401,8 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block) ...@@ -404,9 +401,8 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block)
/* get the AC coefficients until last_index is reached */ /* get the AC coefficients until last_index is reached */
for (;;) { for (;;) {
#ifdef VLC_DEBUG av_dlog(NULL, "%2d: bits=%04x index=%d\n", pos, SHOW_UBITS(re, gb, 16),
printf("%2d: bits=%04x index=%d\n", pos, SHOW_UBITS(re, gb, 16), re_index); re_index);
#endif
/* our own optimized GET_RL_VLC */ /* our own optimized GET_RL_VLC */
index = NEG_USR32(re_cache, TEX_VLC_BITS); index = NEG_USR32(re_cache, TEX_VLC_BITS);
vlc_len = dv_rl_vlc[index].len; vlc_len = dv_rl_vlc[index].len;
...@@ -427,9 +423,7 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block) ...@@ -427,9 +423,7 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block)
} }
re_index += vlc_len; re_index += vlc_len;
#ifdef VLC_DEBUG av_dlog(NULL, "run=%d level=%d\n", run, level);
printf("run=%d level=%d\n", run, level);
#endif
pos += run; pos += run;
if (pos >= 64) if (pos >= 64)
break; break;
...@@ -533,9 +527,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg) ...@@ -533,9 +527,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
mb->pos = 0; mb->pos = 0;
mb->partial_bit_count = 0; mb->partial_bit_count = 0;
#ifdef VLC_DEBUG av_dlog(avctx, "MB block: %d, %d ", mb_index, j);
printf("MB block: %d, %d ", mb_index, j);
#endif
dv_decode_ac(&gb, mb, block); dv_decode_ac(&gb, mb, block);
/* write the remaining bits in a new buffer only if the /* write the remaining bits in a new buffer only if the
...@@ -548,9 +540,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg) ...@@ -548,9 +540,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
} }
/* pass 2 : we can do it just after */ /* pass 2 : we can do it just after */
#ifdef VLC_DEBUG av_dlog(avctx, "***pass 2 size=%d MB#=%d\n", put_bits_count(&pb), mb_index);
printf("***pass 2 size=%d MB#=%d\n", put_bits_count(&pb), mb_index);
#endif
block = block1; block = block1;
mb = mb1; mb = mb1;
init_get_bits(&gb, mb_bit_buffer, put_bits_count(&pb)); init_get_bits(&gb, mb_bit_buffer, put_bits_count(&pb));
...@@ -570,9 +560,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg) ...@@ -570,9 +560,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
} }
/* we need a pass other the whole video segment */ /* we need a pass other the whole video segment */
#ifdef VLC_DEBUG av_dlog(avctx, "***pass 3 size=%d\n", put_bits_count(&vs_pb));
printf("***pass 3 size=%d\n", put_bits_count(&vs_pb));
#endif
block = &sblock[0][0]; block = &sblock[0][0];
mb = mb_data; mb = mb_data;
init_get_bits(&gb, vs_bit_buffer, put_bits_count(&vs_pb)); init_get_bits(&gb, vs_bit_buffer, put_bits_count(&vs_pb));
...@@ -580,9 +568,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg) ...@@ -580,9 +568,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
for (mb_index = 0; mb_index < 5; mb_index++) { for (mb_index = 0; mb_index < 5; mb_index++) {
for (j = 0; j < s->sys->bpm; j++) { for (j = 0; j < s->sys->bpm; j++) {
if (mb->pos < 64) { if (mb->pos < 64) {
#ifdef VLC_DEBUG av_dlog(avctx, "start %d:%d\n", mb_index, j);
printf("start %d:%d\n", mb_index, j);
#endif
dv_decode_ac(&gb, mb, block); dv_decode_ac(&gb, mb, block);
} }
if (mb->pos >= 64 && mb->pos < 127) if (mb->pos >= 64 && mb->pos < 127)
......
...@@ -22,9 +22,6 @@ ...@@ -22,9 +22,6 @@
#include "dsputil.h" #include "dsputil.h"
#include "get_bits.h" #include "get_bits.h"
//#define DEBUG
//#define DEBUG_PACKET_CONTENTS
/* Parser (mostly) copied from dvdsub.c */ /* Parser (mostly) copied from dvdsub.c */
#define PARSE_BUF_SIZE (65536) #define PARSE_BUF_SIZE (65536)
...@@ -53,25 +50,20 @@ static int dvbsub_parse(AVCodecParserContext *s, ...@@ -53,25 +50,20 @@ static int dvbsub_parse(AVCodecParserContext *s,
{ {
DVBSubParseContext *pc = s->priv_data; DVBSubParseContext *pc = s->priv_data;
uint8_t *p, *p_end; uint8_t *p, *p_end;
int len, buf_pos = 0; int i, len, buf_pos = 0;
av_dlog(avctx, "DVB parse packet pts=%"PRIx64", lpts=%"PRIx64", cpts=%"PRIx64":\n", av_dlog(avctx, "DVB parse packet pts=%"PRIx64", lpts=%"PRIx64", cpts=%"PRIx64":\n",
s->pts, s->last_pts, s->cur_frame_pts[s->cur_frame_start_index]); s->pts, s->last_pts, s->cur_frame_pts[s->cur_frame_start_index]);
#ifdef DEBUG_PACKET_CONTENTS
int i;
for (i=0; i < buf_size; i++) for (i=0; i < buf_size; i++)
{ {
av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]); av_dlog(avctx, "%02x ", buf[i]);
if (i % 16 == 15) if (i % 16 == 15)
av_log(avctx, AV_LOG_INFO, "\n"); av_dlog(avctx, "\n");
} }
if (i % 16 != 0) if (i % 16 != 0)
av_log(avctx, AV_LOG_INFO, "\n"); av_dlog(avctx, "\n");
#endif
*poutbuf = NULL; *poutbuf = NULL;
*poutbuf_size = 0; *poutbuf_size = 0;
......
...@@ -24,9 +24,6 @@ ...@@ -24,9 +24,6 @@
#include "bytestream.h" #include "bytestream.h"
#include "libavutil/colorspace.h" #include "libavutil/colorspace.h"
//#define DEBUG
//#define DEBUG_PACKET_CONTENTS
#define DVBSUB_PAGE_SEGMENT 0x10 #define DVBSUB_PAGE_SEGMENT 0x10
#define DVBSUB_REGION_SEGMENT 0x11 #define DVBSUB_REGION_SEGMENT 0x11
#define DVBSUB_CLUT_SEGMENT 0x12 #define DVBSUB_CLUT_SEGMENT 0x12
...@@ -749,20 +746,17 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis ...@@ -749,20 +746,17 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis
av_dlog(avctx, "DVB pixel block size %d, %s field:\n", buf_size, av_dlog(avctx, "DVB pixel block size %d, %s field:\n", buf_size,
top_bottom ? "bottom" : "top"); top_bottom ? "bottom" : "top");
#ifdef DEBUG_PACKET_CONTENTS
for (i = 0; i < buf_size; i++) { for (i = 0; i < buf_size; i++) {
if (i % 16 == 0) if (i % 16 == 0)
av_log(avctx, AV_LOG_INFO, "0x%08p: ", buf+i); av_dlog(avctx, "0x%8p: ", buf+i);
av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]); av_dlog(avctx, "%02x ", buf[i]);
if (i % 16 == 15) if (i % 16 == 15)
av_log(avctx, AV_LOG_INFO, "\n"); av_dlog(avctx, "\n");
} }
if (i % 16) if (i % 16)
av_log(avctx, AV_LOG_INFO, "\n"); av_dlog(avctx, "\n");
#endif
if (region == 0) if (region == 0)
return; return;
...@@ -911,27 +905,22 @@ static void dvbsub_parse_clut_segment(AVCodecContext *avctx, ...@@ -911,27 +905,22 @@ static void dvbsub_parse_clut_segment(AVCodecContext *avctx,
DVBSubContext *ctx = avctx->priv_data; DVBSubContext *ctx = avctx->priv_data;
const uint8_t *buf_end = buf + buf_size; const uint8_t *buf_end = buf + buf_size;
int clut_id; int i, clut_id;
DVBSubCLUT *clut; DVBSubCLUT *clut;
int entry_id, depth , full_range; int entry_id, depth , full_range;
int y, cr, cb, alpha; int y, cr, cb, alpha;
int r, g, b, r_add, g_add, b_add; int r, g, b, r_add, g_add, b_add;
#ifdef DEBUG_PACKET_CONTENTS av_dlog(avctx, "DVB clut packet:\n");
int i;
av_log(avctx, AV_LOG_INFO, "DVB clut packet:\n");
for (i=0; i < buf_size; i++) { for (i=0; i < buf_size; i++) {
av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]); av_dlog(avctx, "%02x ", buf[i]);
if (i % 16 == 15) if (i % 16 == 15)
av_log(avctx, AV_LOG_INFO, "\n"); av_dlog(avctx, "\n");
} }
if (i % 16) if (i % 16)
av_log(avctx, AV_LOG_INFO, "\n"); av_dlog(avctx, "\n");
#endif
clut_id = *buf++; clut_id = *buf++;
buf += 1; buf += 1;
...@@ -1405,22 +1394,18 @@ static int dvbsub_decode(AVCodecContext *avctx, ...@@ -1405,22 +1394,18 @@ static int dvbsub_decode(AVCodecContext *avctx,
int segment_type; int segment_type;
int page_id; int page_id;
int segment_length; int segment_length;
#ifdef DEBUG_PACKET_CONTENTS
int i; int i;
av_log(avctx, AV_LOG_INFO, "DVB sub packet:\n"); av_dlog(avctx, "DVB sub packet:\n");
for (i=0; i < buf_size; i++) { for (i=0; i < buf_size; i++) {
av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]); av_dlog(avctx, "%02x ", buf[i]);
if (i % 16 == 15) if (i % 16 == 15)
av_log(avctx, AV_LOG_INFO, "\n"); av_dlog(avctx, "\n");
} }
if (i % 16) if (i % 16)
av_log(avctx, AV_LOG_INFO, "\n"); av_dlog(avctx, "\n");
#endif
if (buf_size <= 6 || *buf != 0x0f) { if (buf_size <= 6 || *buf != 0x0f) {
av_dlog(avctx, "incomplete or broken packet"); av_dlog(avctx, "incomplete or broken packet");
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#include "libavutil/colorspace.h" #include "libavutil/colorspace.h"
#include "libavutil/imgutils.h" #include "libavutil/imgutils.h"
//#define DEBUG_PACKET_CONTENTS
#define RGBA(r,g,b,a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) #define RGBA(r,g,b,a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
enum SegmentType { enum SegmentType {
...@@ -404,21 +402,18 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, ...@@ -404,21 +402,18 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
const uint8_t *buf_end; const uint8_t *buf_end;
uint8_t segment_type; uint8_t segment_type;
int segment_length; int segment_length;
#ifdef DEBUG_PACKET_CONTENTS
int i; int i;
av_log(avctx, AV_LOG_INFO, "PGS sub packet:\n"); av_dlog(avctx, "PGS sub packet:\n");
for (i = 0; i < buf_size; i++) { for (i = 0; i < buf_size; i++) {
av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]); av_dlog(avctx, "%02x ", buf[i]);
if (i % 16 == 15) if (i % 16 == 15)
av_log(avctx, AV_LOG_INFO, "\n"); av_dlog(avctx, "\n");
} }
if (i & 15) if (i & 15)
av_log(avctx, AV_LOG_INFO, "\n"); av_dlog(avctx, "\n");
#endif
*data_size = 0; *data_size = 0;
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <limits.h> #include <limits.h>
//#define DEBUG //#define DEBUG
//#define DEBUG_METADATA
//#define MOV_EXPORT_ALL_METADATA //#define MOV_EXPORT_ALL_METADATA
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
...@@ -210,11 +209,9 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -210,11 +209,9 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
av_metadata_set2(&c->fc->metadata, key2, str, 0); av_metadata_set2(&c->fc->metadata, key2, str, 0);
} }
} }
#ifdef DEBUG_METADATA av_dlog(c->fc, "lang \"%3s\" ", language);
av_log(c->fc, AV_LOG_DEBUG, "lang \"%3s\" ", language); av_dlog(c->fc, "tag \"%s\" value \"%s\" atom \"%.4s\" %d %"PRId64"\n",
av_log(c->fc, AV_LOG_DEBUG, "tag \"%s\" value \"%s\" atom \"%.4s\" %d %lld\n", key, str, (char*)&atom.type, str_size, atom.size);
key, str, (char*)&atom.type, str_size, atom.size);
#endif
return 0; return 0;
} }
......
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