Commit 59b571c1 authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

more debug output

Originally committed as revision 1338 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent a8140ad5
......@@ -123,6 +123,7 @@ static int dct_algo = 0;
static int idct_algo = 0;
static int use_part = 0;
static int packet_size = 0;
static int debug = 0;
static int gop_size = 12;
static int intra_only = 0;
......@@ -1597,6 +1598,10 @@ void opt_error_concealment(const char *arg)
error_concealment = atoi(arg);
}
void opt_debug(const char *arg)
{
debug = atoi(arg);
}
void opt_frame_rate(const char *arg)
{
......@@ -1987,6 +1992,7 @@ void opt_input_file(const char *filename)
enc->error_resilience = error_resilience;
enc->error_concealment = error_concealment;
enc->idct_algo= idct_algo;
enc->debug= debug;
/* if(enc->codec->capabilities & CODEC_CAP_TRUNCATED)
enc->flags|= CODEC_FLAG_TRUNCATED; */
if(/*enc->codec_id==CODEC_ID_MPEG4 || */enc->codec_id==CODEC_ID_MPEG1VIDEO)
......@@ -2163,6 +2169,7 @@ void opt_output_file(const char *filename)
video_enc->qblur = video_qblur;
video_enc->qcompress = video_qcomp;
video_enc->rc_eq = video_rc_eq;
video_enc->debug= debug;
p= video_rc_override_string;
for(i=0; p; i++){
......@@ -2581,6 +2588,7 @@ const OptionDef options[] = {
{ "i_qfactor", HAS_ARG | OPT_EXPERT, {(void*)opt_i_qfactor}, "qp factor between p and i frames", "factor" },
{ "b_qoffset", HAS_ARG | OPT_EXPERT, {(void*)opt_b_qoffset}, "qp offset between p and b frames", "offset" },
{ "i_qoffset", HAS_ARG | OPT_EXPERT, {(void*)opt_i_qoffset}, "qp offset between p and i frames", "offset" },
// { "b_strategy", HAS_ARG | OPT_EXPERT, {(void*)opt_b_strategy}, "dynamic b frame selection strategy", "strategy" },
{ "rc_eq", HAS_ARG | OPT_EXPERT, {(void*)opt_video_rc_eq}, "", "equation" },
{ "rc_override", HAS_ARG | OPT_EXPERT, {(void*)opt_video_rc_override_string}, "Rate control override", "qualities for specific intervals" },
{ "bt", HAS_ARG, {(void*)opt_video_bitrate_tolerance}, "set video bitrate tolerance (in kbit/s)", "tolerance" },
......@@ -2594,7 +2602,7 @@ const OptionDef options[] = {
{ "dct_algo", HAS_ARG | OPT_EXPERT, {(void*)opt_dct_algo}, "set dct algo", "algo" },
{ "idct_algo", HAS_ARG | OPT_EXPERT, {(void*)opt_idct_algo}, "set idct algo", "algo" },
{ "er", HAS_ARG | OPT_EXPERT, {(void*)opt_error_resilience}, "set error resilience", "" },
{ "ec", HAS_ARG | OPT_EXPERT, {(void*)opt_error_resilience}, "set error concealment", "" },
{ "ec", HAS_ARG | OPT_EXPERT, {(void*)opt_error_concealment}, "set error concealment", "" },
{ "bf", HAS_ARG | OPT_EXPERT, {(void*)opt_b_frames}, "use 'frames' B frames (only MPEG-4)", "frames" },
{ "hq", OPT_BOOL | OPT_EXPERT, {(void*)&use_hq}, "activate high quality settings" },
{ "4mv", OPT_BOOL | OPT_EXPERT, {(void*)&use_4mv}, "use four motion vector by macroblock (only MPEG-4)" },
......@@ -2603,6 +2611,7 @@ const OptionDef options[] = {
{ "ps", HAS_ARG | OPT_EXPERT, {(void*)opt_packet_size}, "packet size", "size in bits" },
{ "sameq", OPT_BOOL, {(void*)&same_quality},
"use same video quality as source (implies VBR)" },
{ "debug", HAS_ARG | OPT_EXPERT, {(void*)opt_debug}, "print specific debug info" },
/* audio options */
{ "ab", HAS_ARG, {(void*)opt_audio_bitrate}, "set audio bitrate (in kbit/s)", "bitrate", },
{ "ar", HAS_ARG, {(void*)opt_audio_rate}, "set audio sampling rate (in Hz)", "rate" },
......
......@@ -4552,11 +4552,11 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
s->b_code=1;
if(s->avctx->debug&FF_DEBUG_PICT_INFO){
printf("qp:%d fc:%d bc:%d type:%s size:%d pro:%d alt:%d top:%d qpel:%d part:%d resync:%d w:%d a:%d\n",
printf("qp:%d fc:%d,%d %s size:%d pro:%d alt:%d top:%d %spel part:%d resync:%d w:%d a:%d\n",
s->qscale, s->f_code, s->b_code,
s->pict_type == I_TYPE ? "I" : (s->pict_type == P_TYPE ? "P" : (s->pict_type == B_TYPE ? "B" : "S")),
gb->size,s->progressive_sequence, s->alternate_scan, s->top_field_first,
s->quarter_sample, s->data_partitioning, s->resync_marker, s->num_sprite_warping_points,
s->quarter_sample ? "q" : "h", s->data_partitioning, s->resync_marker, s->num_sprite_warping_points,
s->sprite_warping_accuracy);
}
......
......@@ -736,6 +736,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
s->mv[1][0][0] = s->last_mv[1][0][0];
s->mv[1][0][1] = s->last_mv[1][0][1];
}
s->mb_skiped = 1;
return 0;
}
......@@ -1617,6 +1618,15 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
s->first_slice = 0;
if(MPV_frame_start(s, avctx) < 0)
return DECODE_SLICE_FATAL_ERROR;
if(s->avctx->debug&FF_DEBUG_PICT_INFO){
printf("qp:%d fc:%d%d%d%d %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\n",
s->qscale, s->mpeg_f_code[0][0],s->mpeg_f_code[0][1],s->mpeg_f_code[1][0],s->mpeg_f_code[1][1],
s->pict_type == I_TYPE ? "I" : (s->pict_type == P_TYPE ? "P" : (s->pict_type == B_TYPE ? "B" : "S")),
s->progressive_sequence ? "pro" :"", s->alternate_scan ? "alt" :"", s->top_field_first ? "top" :"",
s->intra_dc_precision, s->picture_structure, s->frame_pred_frame_dct, s->concealment_motion_vectors,
s->q_scale_type, s->intra_vlc_format, s->repeat_first_field, s->chroma_420_type ? "420" :"");
}
}
init_get_bits(&s->gb, buf, buf_size);
......
......@@ -914,7 +914,6 @@ alloc:
void MPV_frame_end(MpegEncContext *s)
{
int i;
/* draw edge for correct motion prediction if outside */
if(s->codec_id!=CODEC_ID_SVQ1){
if (s->pict_type != B_TYPE && !s->intra_only && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
......@@ -3466,6 +3465,15 @@ static void dct_unquantize_h263_c(MpegEncContext *s,
}
}
char ff_get_pict_type_char(int pict_type){
switch(pict_type){
case I_TYPE: return 'I';
case P_TYPE: return 'P';
case B_TYPE: return 'B';
case S_TYPE: return 'S';
}
}
AVCodec mpeg1video_encoder = {
"mpeg1video",
CODEC_TYPE_VIDEO,
......
......@@ -553,6 +553,8 @@ void ff_clean_intra_table_entries(MpegEncContext *s);
void ff_init_scantable(MpegEncContext *s, ScanTable *st, const UINT8 *src_scantable);
void ff_error_resilience(MpegEncContext *s);
void ff_draw_horiz_band(MpegEncContext *s);
char ff_get_pict_type_char(int pict_type);
extern int ff_bit_exact;
......
......@@ -330,7 +330,7 @@ static double get_diff_limited_q(MpegEncContext *s, RateControlEntry *rce, doubl
const int pict_type= rce->new_pict_type;
const double last_p_q = rcc->last_qscale_for[P_TYPE];
const double last_non_b_q= rcc->last_qscale_for[rcc->last_non_b_pict_type];
if (pict_type==I_TYPE && (a->i_quant_factor>0.0 || rcc->last_non_b_pict_type==P_TYPE))
q= last_p_q *ABS(a->i_quant_factor) + a->i_quant_offset;
else if(pict_type==B_TYPE && a->b_quant_factor>0.0)
......@@ -339,6 +339,7 @@ static double get_diff_limited_q(MpegEncContext *s, RateControlEntry *rce, doubl
/* last qscale / qdiff stuff */
if(rcc->last_non_b_pict_type==pict_type || pict_type!=I_TYPE){
double last_q= rcc->last_qscale_for[pict_type];
if (q > last_q + a->max_qdiff) q= last_q + a->max_qdiff;
else if(q < last_q - a->max_qdiff) q= last_q - a->max_qdiff;
}
......@@ -658,17 +659,16 @@ float ff_rate_estimate_qscale(MpegEncContext *s)
assert(q>0.0);
}
//printf("qmin:%d, qmax:%d, q:%f\n", qmin, qmax, q);
if(s->avctx->debug&FF_DEBUG_RC){
printf("%c qp:%d<%2.1f<%d %d want:%d total:%d comp:%f st_q:%2.2f size:%d var:%d/%d br:%d fps:%d\n",
ff_get_pict_type_char(pict_type), qmin, q, qmax, picture_number, (int)wanted_bits/1000, (int)s->total_bits/1000,
br_compensation, short_term_q, s->frame_bits, pic->mb_var_sum, pic->mc_mb_var_sum, s->bit_rate/1000, (int)fps
);
}
if (q<qmin) q=qmin;
else if(q>qmax) q=qmax;
// printf("%f %d %d %d\n", q, picture_number, (int)wanted_bits, (int)s->total_bits);
//printf("diff:%d comp:%f st_q:%f last_size:%d type:%d\n", (int)diff, br_compensation,
// short_term_q, s->frame_bits, pict_type);
//printf("%d %d\n", s->bit_rate, (int)fps);
if(s->adaptive_quant)
adaptive_quantization(s, q);
......
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