mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-24 03:59:43 +00:00
Replace some av_log/printf + #ifdef combinations by av_dlog.
This commit is contained in:
parent
1f6b9cc31d
commit
02a8d43adf
@ -81,8 +81,6 @@ void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
|
||||
|
||||
/* VLC decoding */
|
||||
|
||||
//#define DEBUG_VLC
|
||||
|
||||
#define GET_DATA(v, table, i, wrap, size) \
|
||||
{\
|
||||
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,
|
||||
|
||||
table_size = 1 << table_nb_bits;
|
||||
table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC);
|
||||
#ifdef DEBUG_VLC
|
||||
av_log(NULL,AV_LOG_DEBUG,"new table index=%d size=%d\n",
|
||||
table_index, table_size);
|
||||
#endif
|
||||
av_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size);
|
||||
if (table_index < 0)
|
||||
return -1;
|
||||
table = &vlc->table[table_index];
|
||||
@ -180,9 +175,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
||||
n = codes[i].bits;
|
||||
code = codes[i].code;
|
||||
symbol = codes[i].symbol;
|
||||
#if defined(DEBUG_VLC) && 0
|
||||
av_log(NULL,AV_LOG_DEBUG,"i=%d n=%d code=0x%x\n", i, n, code);
|
||||
#endif
|
||||
av_dlog(NULL, "i=%d n=%d code=0x%x\n", i, n, code);
|
||||
if (n <= table_nb_bits) {
|
||||
/* no need to add another table */
|
||||
j = code >> (32 - table_nb_bits);
|
||||
@ -193,10 +186,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
||||
inc = 1 << n;
|
||||
}
|
||||
for (k = 0; k < nb; k++) {
|
||||
#ifdef DEBUG_VLC
|
||||
av_log(NULL, AV_LOG_DEBUG, "%4x: code=%d n=%d\n",
|
||||
j, i, n);
|
||||
#endif
|
||||
av_dlog(NULL, "%4x: code=%d n=%d\n", j, i, n);
|
||||
if (table[j][1] /*bits*/ != 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "incorrect codes\n");
|
||||
return -1;
|
||||
@ -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);
|
||||
j = (flags & INIT_VLC_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix;
|
||||
table[j][1] = -subtable_bits;
|
||||
#ifdef DEBUG_VLC
|
||||
av_log(NULL,AV_LOG_DEBUG,"%4x: n=%d (subtable)\n",
|
||||
j, codes[i].bits + table_nb_bits);
|
||||
#endif
|
||||
av_dlog(NULL, "%4x: n=%d (subtable)\n",
|
||||
j, codes[i].bits + table_nb_bits);
|
||||
index = build_table(vlc, subtable_bits, k-i, codes+i, flags);
|
||||
if (index < 0)
|
||||
return -1;
|
||||
@ -291,9 +279,7 @@ int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
|
||||
vlc->table_size = 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_VLC
|
||||
av_log(NULL,AV_LOG_DEBUG,"build table nb_codes=%d\n", nb_codes);
|
||||
#endif
|
||||
av_dlog(NULL, "build table nb_codes=%d\n", nb_codes);
|
||||
|
||||
buf = av_malloc((nb_codes+1)*sizeof(VLCcode));
|
||||
|
||||
|
@ -358,9 +358,6 @@ static av_cold int dvvideo_init_encoder(AVCodecContext *avctx)
|
||||
return dvvideo_init(avctx);
|
||||
}
|
||||
|
||||
// #define VLC_DEBUG
|
||||
// #define printf(...) av_log(NULL, AV_LOG_ERROR, __VA_ARGS__)
|
||||
|
||||
typedef struct BlockInfo {
|
||||
const uint32_t *factor_table;
|
||||
const uint8_t *scan_table;
|
||||
@ -404,9 +401,8 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block)
|
||||
|
||||
/* get the AC coefficients until last_index is reached */
|
||||
for (;;) {
|
||||
#ifdef VLC_DEBUG
|
||||
printf("%2d: bits=%04x index=%d\n", pos, SHOW_UBITS(re, gb, 16), re_index);
|
||||
#endif
|
||||
av_dlog(NULL, "%2d: bits=%04x index=%d\n", pos, SHOW_UBITS(re, gb, 16),
|
||||
re_index);
|
||||
/* our own optimized GET_RL_VLC */
|
||||
index = NEG_USR32(re_cache, TEX_VLC_BITS);
|
||||
vlc_len = dv_rl_vlc[index].len;
|
||||
@ -427,9 +423,7 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block)
|
||||
}
|
||||
re_index += vlc_len;
|
||||
|
||||
#ifdef VLC_DEBUG
|
||||
printf("run=%d level=%d\n", run, level);
|
||||
#endif
|
||||
av_dlog(NULL, "run=%d level=%d\n", run, level);
|
||||
pos += run;
|
||||
if (pos >= 64)
|
||||
break;
|
||||
@ -533,9 +527,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
|
||||
mb->pos = 0;
|
||||
mb->partial_bit_count = 0;
|
||||
|
||||
#ifdef VLC_DEBUG
|
||||
printf("MB block: %d, %d ", mb_index, j);
|
||||
#endif
|
||||
av_dlog(avctx, "MB block: %d, %d ", mb_index, j);
|
||||
dv_decode_ac(&gb, mb, block);
|
||||
|
||||
/* 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)
|
||||
}
|
||||
|
||||
/* pass 2 : we can do it just after */
|
||||
#ifdef VLC_DEBUG
|
||||
printf("***pass 2 size=%d MB#=%d\n", put_bits_count(&pb), mb_index);
|
||||
#endif
|
||||
av_dlog(avctx, "***pass 2 size=%d MB#=%d\n", put_bits_count(&pb), mb_index);
|
||||
block = block1;
|
||||
mb = mb1;
|
||||
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)
|
||||
}
|
||||
|
||||
/* we need a pass other the whole video segment */
|
||||
#ifdef VLC_DEBUG
|
||||
printf("***pass 3 size=%d\n", put_bits_count(&vs_pb));
|
||||
#endif
|
||||
av_dlog(avctx, "***pass 3 size=%d\n", put_bits_count(&vs_pb));
|
||||
block = &sblock[0][0];
|
||||
mb = mb_data;
|
||||
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)
|
||||
for (mb_index = 0; mb_index < 5; mb_index++) {
|
||||
for (j = 0; j < s->sys->bpm; j++) {
|
||||
if (mb->pos < 64) {
|
||||
#ifdef VLC_DEBUG
|
||||
printf("start %d:%d\n", mb_index, j);
|
||||
#endif
|
||||
av_dlog(avctx, "start %d:%d\n", mb_index, j);
|
||||
dv_decode_ac(&gb, mb, block);
|
||||
}
|
||||
if (mb->pos >= 64 && mb->pos < 127)
|
||||
|
@ -22,9 +22,6 @@
|
||||
#include "dsputil.h"
|
||||
#include "get_bits.h"
|
||||
|
||||
//#define DEBUG
|
||||
//#define DEBUG_PACKET_CONTENTS
|
||||
|
||||
/* Parser (mostly) copied from dvdsub.c */
|
||||
|
||||
#define PARSE_BUF_SIZE (65536)
|
||||
@ -53,25 +50,20 @@ static int dvbsub_parse(AVCodecParserContext *s,
|
||||
{
|
||||
DVBSubParseContext *pc = s->priv_data;
|
||||
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",
|
||||
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++)
|
||||
{
|
||||
av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]);
|
||||
av_dlog(avctx, "%02x ", buf[i]);
|
||||
if (i % 16 == 15)
|
||||
av_log(avctx, AV_LOG_INFO, "\n");
|
||||
av_dlog(avctx, "\n");
|
||||
}
|
||||
|
||||
if (i % 16 != 0)
|
||||
av_log(avctx, AV_LOG_INFO, "\n");
|
||||
|
||||
#endif
|
||||
av_dlog(avctx, "\n");
|
||||
|
||||
*poutbuf = NULL;
|
||||
*poutbuf_size = 0;
|
||||
|
@ -24,9 +24,6 @@
|
||||
#include "bytestream.h"
|
||||
#include "libavutil/colorspace.h"
|
||||
|
||||
//#define DEBUG
|
||||
//#define DEBUG_PACKET_CONTENTS
|
||||
|
||||
#define DVBSUB_PAGE_SEGMENT 0x10
|
||||
#define DVBSUB_REGION_SEGMENT 0x11
|
||||
#define DVBSUB_CLUT_SEGMENT 0x12
|
||||
@ -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,
|
||||
top_bottom ? "bottom" : "top");
|
||||
|
||||
#ifdef DEBUG_PACKET_CONTENTS
|
||||
for (i = 0; i < buf_size; i++) {
|
||||
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)
|
||||
av_log(avctx, AV_LOG_INFO, "\n");
|
||||
av_dlog(avctx, "\n");
|
||||
}
|
||||
|
||||
if (i % 16)
|
||||
av_log(avctx, AV_LOG_INFO, "\n");
|
||||
|
||||
#endif
|
||||
av_dlog(avctx, "\n");
|
||||
|
||||
if (region == 0)
|
||||
return;
|
||||
@ -911,27 +905,22 @@ static void dvbsub_parse_clut_segment(AVCodecContext *avctx,
|
||||
DVBSubContext *ctx = avctx->priv_data;
|
||||
|
||||
const uint8_t *buf_end = buf + buf_size;
|
||||
int clut_id;
|
||||
int i, clut_id;
|
||||
DVBSubCLUT *clut;
|
||||
int entry_id, depth , full_range;
|
||||
int y, cr, cb, alpha;
|
||||
int r, g, b, r_add, g_add, b_add;
|
||||
|
||||
#ifdef DEBUG_PACKET_CONTENTS
|
||||
int i;
|
||||
|
||||
av_log(avctx, AV_LOG_INFO, "DVB clut packet:\n");
|
||||
av_dlog(avctx, "DVB clut packet:\n");
|
||||
|
||||
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)
|
||||
av_log(avctx, AV_LOG_INFO, "\n");
|
||||
av_dlog(avctx, "\n");
|
||||
}
|
||||
|
||||
if (i % 16)
|
||||
av_log(avctx, AV_LOG_INFO, "\n");
|
||||
|
||||
#endif
|
||||
av_dlog(avctx, "\n");
|
||||
|
||||
clut_id = *buf++;
|
||||
buf += 1;
|
||||
@ -1405,22 +1394,18 @@ static int dvbsub_decode(AVCodecContext *avctx,
|
||||
int segment_type;
|
||||
int page_id;
|
||||
int segment_length;
|
||||
|
||||
#ifdef DEBUG_PACKET_CONTENTS
|
||||
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++) {
|
||||
av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]);
|
||||
av_dlog(avctx, "%02x ", buf[i]);
|
||||
if (i % 16 == 15)
|
||||
av_log(avctx, AV_LOG_INFO, "\n");
|
||||
av_dlog(avctx, "\n");
|
||||
}
|
||||
|
||||
if (i % 16)
|
||||
av_log(avctx, AV_LOG_INFO, "\n");
|
||||
|
||||
#endif
|
||||
av_dlog(avctx, "\n");
|
||||
|
||||
if (buf_size <= 6 || *buf != 0x0f) {
|
||||
av_dlog(avctx, "incomplete or broken packet");
|
||||
|
@ -30,8 +30,6 @@
|
||||
#include "libavutil/colorspace.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
|
||||
//#define DEBUG_PACKET_CONTENTS
|
||||
|
||||
#define RGBA(r,g,b,a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
|
||||
|
||||
enum SegmentType {
|
||||
@ -404,21 +402,18 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
|
||||
const uint8_t *buf_end;
|
||||
uint8_t segment_type;
|
||||
int segment_length;
|
||||
|
||||
#ifdef DEBUG_PACKET_CONTENTS
|
||||
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++) {
|
||||
av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]);
|
||||
av_dlog(avctx, "%02x ", buf[i]);
|
||||
if (i % 16 == 15)
|
||||
av_log(avctx, AV_LOG_INFO, "\n");
|
||||
av_dlog(avctx, "\n");
|
||||
}
|
||||
|
||||
if (i & 15)
|
||||
av_log(avctx, AV_LOG_INFO, "\n");
|
||||
#endif
|
||||
av_dlog(avctx, "\n");
|
||||
|
||||
*data_size = 0;
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <limits.h>
|
||||
|
||||
//#define DEBUG
|
||||
//#define DEBUG_METADATA
|
||||
//#define MOV_EXPORT_ALL_METADATA
|
||||
|
||||
#include "libavutil/intreadwrite.h"
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_METADATA
|
||||
av_log(c->fc, AV_LOG_DEBUG, "lang \"%3s\" ", language);
|
||||
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);
|
||||
#endif
|
||||
av_dlog(c->fc, "lang \"%3s\" ", language);
|
||||
av_dlog(c->fc, "tag \"%s\" value \"%s\" atom \"%.4s\" %d %"PRId64"\n",
|
||||
key, str, (char*)&atom.type, str_size, atom.size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user