#ifdef TRACE printf() -> tprintf()

Originally committed as revision 1735 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Michael Niedermayer 22 years ago
parent 1924f3ce36
commit 95c2634838
  1. 6
      libavcodec/common.h
  2. 78
      libavcodec/h264.c

@ -825,7 +825,11 @@ static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], int bits
#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__)
#endif //TRACE #define tprintf printf
#else //TRACE
#define tprintf(...) {}
#endif
/* define it to include statistics code (useful only for optimizing /* define it to include statistics code (useful only for optimizing
codec efficiency */ codec efficiency */

@ -685,9 +685,7 @@ static inline int pred_intra_mode(H264Context *h, int n){
const int top = h->intra4x4_pred_mode_cache[index8 - 8]; const int top = h->intra4x4_pred_mode_cache[index8 - 8];
const int min= FFMIN(left, top); const int min= FFMIN(left, top);
#ifdef TRACE tprintf("mode:%d %d min:%d\n", left ,top, min);
printf("mode:%d %d min:%d\n", left ,top, min);
#endif
if(min<0) return DC_PRED; if(min<0) return DC_PRED;
else return min; else return min;
@ -726,9 +724,7 @@ static inline int pred_non_zero_count(H264Context *h, int n){
if(i<64) i= (i+1)>>1; if(i<64) i= (i+1)>>1;
#ifdef TRACE tprintf("pred_nnz L%X T%X n%d s%d P%X\n", left, top, n, scan8[n], i&31);
printf("pred_nnz L%X T%X n%d s%d P%X\n", left, top, n, scan8[n], i&31);
#endif
return i&31; return i&31;
} }
@ -740,9 +736,8 @@ static inline int fetch_diagonal_mv(H264Context *h, const int16_t **C, int i, in
*C= h->mv_cache[list][ i - 8 + part_width ]; *C= h->mv_cache[list][ i - 8 + part_width ];
return topright_ref; return topright_ref;
}else{ }else{
#ifdef TRACE tprintf("topright MV not available\n");
printf("topright MV not available\n");
#endif
*C= h->mv_cache[list][ i - 8 - 1 ]; *C= h->mv_cache[list][ i - 8 - 1 ];
return h->ref_cache[list][ i - 8 - 1 ]; return h->ref_cache[list][ i - 8 - 1 ];
} }
@ -802,9 +797,7 @@ static inline void pred_motion(H264Context * const h, int n, int part_width, int
} }
} }
#ifdef TRACE tprintf("pred_motion (%2d %2d %2d) (%2d %2d %2d) (%2d %2d %2d) -> (%2d %2d %2d) at %2d %2d %d list %d\n", top_ref, B[0], B[1], diagonal_ref, C[0], C[1], left_ref, A[0], A[1], ref, *mx, *my, s->mb_x, s->mb_y, n, list);
printf("pred_motion (%2d %2d %2d) (%2d %2d %2d) (%2d %2d %2d) -> (%2d %2d %2d) at %2d %2d %d list %d\n", top_ref, B[0], B[1], diagonal_ref, C[0], C[1], left_ref, A[0], A[1], ref, *mx, *my, s->mb_x, s->mb_y, n, list);
#endif
} }
/** /**
@ -819,9 +812,7 @@ static inline void pred_16x8_motion(H264Context * const h, int n, int list, int
const int top_ref= h->ref_cache[list][ scan8[0] - 8 ]; const int top_ref= h->ref_cache[list][ scan8[0] - 8 ];
const int16_t * const B= h->mv_cache[list][ scan8[0] - 8 ]; const int16_t * const B= h->mv_cache[list][ scan8[0] - 8 ];
#ifdef TRACE tprintf("pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d", top_ref, B[0], B[1], s->mb_x, s->mb_y, n, list);
printf("pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d", top_ref, B[0], B[1], s->mb_x, s->mb_y, n, list);
#endif
if(top_ref == ref){ if(top_ref == ref){
*mx= B[0]; *mx= B[0];
@ -832,9 +823,7 @@ printf("pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d", top_ref, B[0], B[1], s-
const int left_ref= h->ref_cache[list][ scan8[8] - 1 ]; const int left_ref= h->ref_cache[list][ scan8[8] - 1 ];
const int16_t * const A= h->mv_cache[list][ scan8[8] - 1 ]; const int16_t * const A= h->mv_cache[list][ scan8[8] - 1 ];
#ifdef TRACE tprintf("pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d", left_ref, A[0], A[1], s->mb_x, s->mb_y, n, list);
printf("pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d", left_ref, A[0], A[1], s->mb_x, s->mb_y, n, list);
#endif
if(left_ref == ref){ if(left_ref == ref){
*mx= A[0]; *mx= A[0];
@ -859,9 +848,7 @@ static inline void pred_8x16_motion(H264Context * const h, int n, int list, int
const int left_ref= h->ref_cache[list][ scan8[0] - 1 ]; const int left_ref= h->ref_cache[list][ scan8[0] - 1 ];
const int16_t * const A= h->mv_cache[list][ scan8[0] - 1 ]; const int16_t * const A= h->mv_cache[list][ scan8[0] - 1 ];
#ifdef TRACE tprintf("pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d", left_ref, A[0], A[1], s->mb_x, s->mb_y, n, list);
printf("pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d", left_ref, A[0], A[1], s->mb_x, s->mb_y, n, list);
#endif
if(left_ref == ref){ if(left_ref == ref){
*mx= A[0]; *mx= A[0];
@ -874,9 +861,7 @@ printf("pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d", left_ref, A[0], A[1], s
diagonal_ref= fetch_diagonal_mv(h, &C, scan8[4], list, 2); diagonal_ref= fetch_diagonal_mv(h, &C, scan8[4], list, 2);
#ifdef TRACE tprintf("pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d", diagonal_ref, C[0], C[1], s->mb_x, s->mb_y, n, list);
printf("pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d", diagonal_ref, C[0], C[1], s->mb_x, s->mb_y, n, list);
#endif
if(diagonal_ref == ref){ if(diagonal_ref == ref){
*mx= C[0]; *mx= C[0];
@ -894,9 +879,7 @@ static inline void pred_pskip_motion(H264Context * const h, int * const mx, int
const int top_ref = h->ref_cache[0][ scan8[0] - 8 ]; const int top_ref = h->ref_cache[0][ scan8[0] - 8 ];
const int left_ref= h->ref_cache[0][ scan8[0] - 1 ]; const int left_ref= h->ref_cache[0][ scan8[0] - 1 ];
#ifdef TRACE tprintf("pred_pskip: (%d) (%d) at %2d %2d", top_ref, left_ref, s->mb_x, s->mb_y);
printf("pred_pskip: (%d) (%d) at %2d %2d", top_ref, left_ref, s->mb_x, s->mb_y);
#endif
if(top_ref == PART_NOT_AVAILABLE || left_ref == PART_NOT_AVAILABLE if(top_ref == PART_NOT_AVAILABLE || left_ref == PART_NOT_AVAILABLE
|| (top_ref == 0 && *(uint32_t*)h->mv_cache[0][ scan8[0] - 8 ] == 0) || (top_ref == 0 && *(uint32_t*)h->mv_cache[0][ scan8[0] - 8 ] == 0)
@ -1088,9 +1071,7 @@ static int decode_rbsp_trailing(uint8_t *src){
int v= *src; int v= *src;
int r; int r;
#ifdef TRACE tprintf("rbsp trailing %X\n", v);
printf("rbsp trailing %X\n", v);
#endif
for(r=1; r<9; r++){ for(r=1; r<9; r++){
if(v&1) return r; if(v&1) return r;
@ -3073,9 +3054,7 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in
return 0; return 0;
trailing_ones= coeff_token&3; trailing_ones= coeff_token&3;
#ifdef TRACE tprintf("trailing:%d, total:%d\n", trailing_ones, total_coeff);
printf("trailing:%d, total:%d\n", trailing_ones, total_coeff);
#endif
assert(total_coeff<=16); assert(total_coeff<=16);
for(i=0; i<trailing_ones; i++){ for(i=0; i<trailing_ones; i++){
@ -3119,9 +3098,7 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in
if((2+level_code)>>1) > (3<<(suffix_length-1)) && suffix_length<6) suffix_length++; if((2+level_code)>>1) > (3<<(suffix_length-1)) && suffix_length<6) suffix_length++;
? == prefix > 2 or sth ? == prefix > 2 or sth
#endif #endif
#ifdef TRACE tprintf("level: %d suffix_length:%d\n", level[i], suffix_length);
printf("level: %d suffix_length:%d\n", level[i], suffix_length);
#endif
} }
if(total_coeff == max_coeff) if(total_coeff == max_coeff)
@ -3190,9 +3167,7 @@ static int decode_mb(H264Context *h){
memset(h->mb, 0, sizeof(int16_t)*24*16); //FIXME avoid if allready clear (move after skip handlong? memset(h->mb, 0, sizeof(int16_t)*24*16); //FIXME avoid if allready clear (move after skip handlong?
#ifdef TRACE tprintf("pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y);
printf("pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y);
#endif
if(h->slice_type != I_TYPE && h->slice_type != SI_TYPE){ if(h->slice_type != I_TYPE && h->slice_type != SI_TYPE){
if(s->mb_skip_run==-1) if(s->mb_skip_run==-1)
@ -3410,9 +3385,8 @@ decode_intra_mb:
pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my); pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my);
mx += get_se_golomb(&s->gb); mx += get_se_golomb(&s->gb);
my += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb);
#ifdef TRACE tprintf("final mv:%d %d\n", mx, my);
printf("final mv:%d %d\n", mx, my);
#endif
if(IS_SUB_8X8(sub_mb_type)){ if(IS_SUB_8X8(sub_mb_type)){
mv_cache[ 0 ][0]= mv_cache[ 1 ][0]= mv_cache[ 0 ][0]= mv_cache[ 1 ][0]=
mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx; mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx;
@ -3454,9 +3428,8 @@ printf("final mv:%d %d\n", mx, my);
pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my); pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my);
mx += get_se_golomb(&s->gb); mx += get_se_golomb(&s->gb);
my += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb);
#ifdef TRACE tprintf("final mv:%d %d\n", mx, my);
printf("final mv:%d %d\n", mx, my);
#endif
fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, (mx&0xFFFF) + (my<<16), 4); fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, (mx&0xFFFF) + (my<<16), 4);
} }
} }
@ -3478,9 +3451,8 @@ printf("final mv:%d %d\n", mx, my);
pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my); pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my);
mx += get_se_golomb(&s->gb); mx += get_se_golomb(&s->gb);
my += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb);
#ifdef TRACE tprintf("final mv:%d %d\n", mx, my);
printf("final mv:%d %d\n", mx, my);
#endif
fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (mx&0xFFFF) + (my<<16), 4); fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (mx&0xFFFF) + (my<<16), 4);
} }
} }
@ -3503,9 +3475,8 @@ printf("final mv:%d %d\n", mx, my);
pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my); pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my);
mx += get_se_golomb(&s->gb); mx += get_se_golomb(&s->gb);
my += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb);
#ifdef TRACE tprintf("final mv:%d %d\n", mx, my);
printf("final mv:%d %d\n", mx, my);
#endif
fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (mx&0xFFFF) + (my<<16), 4); fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (mx&0xFFFF) + (my<<16), 4);
} }
} }
@ -3655,9 +3626,8 @@ static int decode_slice(H264Context *h){
s->mb_x=0; s->mb_x=0;
ff_draw_horiz_band(s, 16*s->mb_y, 16); ff_draw_horiz_band(s, 16*s->mb_y, 16);
if(++s->mb_y >= s->mb_height){ if(++s->mb_y >= s->mb_height){
#ifdef TRACE tprintf("slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
printf("slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
#endif
if(get_bits_count(&s->gb) == s->gb.size_in_bits){ if(get_bits_count(&s->gb) == s->gb.size_in_bits){
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);

Loading…
Cancel
Save