Mercurial > libavcodec.hg
comparison bitstream.h @ 2438:e98b5e0de86b libavcodec
compile with TRACE define patch by (Loic <lll+ffmpeg m4x org>)
author | michael |
---|---|
date | Wed, 19 Jan 2005 12:58:34 +0000 |
parents | 582e635cfa08 |
children | ab390f13c7f5 |
comparison
equal
deleted
inserted
replaced
2437:8a30df830ad6 | 2438:e98b5e0de86b |
---|---|
771 } | 771 } |
772 | 772 |
773 //#define TRACE | 773 //#define TRACE |
774 | 774 |
775 #ifdef TRACE | 775 #ifdef TRACE |
776 | 776 #include "avcodec.h" |
777 static inline void print_bin(int bits, int n){ | 777 static inline void print_bin(int bits, int n){ |
778 int i; | 778 int i; |
779 | 779 |
780 for(i=n-1; i>=0; i--){ | 780 for(i=n-1; i>=0; i--){ |
781 printf("%d", (bits>>i)&1); | 781 av_log(NULL, AV_LOG_DEBUG, "%d", (bits>>i)&1); |
782 } | 782 } |
783 for(i=n; i<24; i++) | 783 for(i=n; i<24; i++) |
784 printf(" "); | 784 av_log(NULL, AV_LOG_DEBUG, " "); |
785 } | 785 } |
786 | 786 |
787 static inline int get_bits_trace(GetBitContext *s, int n, char *file, char *func, int line){ | 787 static inline int get_bits_trace(GetBitContext *s, int n, char *file, const char *func, int line){ |
788 int r= get_bits(s, n); | 788 int r= get_bits(s, n); |
789 | 789 |
790 print_bin(r, n); | 790 print_bin(r, n); |
791 printf("%5d %2d %3d bit @%5d in %s %s:%d\n", r, n, r, get_bits_count(s)-n, file, func, line); | 791 av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d bit @%5d in %s %s:%d\n", r, n, r, get_bits_count(s)-n, file, func, line); |
792 return r; | 792 return r; |
793 } | 793 } |
794 static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], int bits, int max_depth, char *file, char *func, int line){ | 794 static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], int bits, int max_depth, char *file, const char *func, int line){ |
795 int show= show_bits(s, 24); | 795 int show= show_bits(s, 24); |
796 int pos= get_bits_count(s); | 796 int pos= get_bits_count(s); |
797 int r= get_vlc2(s, table, bits, max_depth); | 797 int r= get_vlc2(s, table, bits, max_depth); |
798 int len= get_bits_count(s) - pos; | 798 int len= get_bits_count(s) - pos; |
799 int bits2= show>>(24-len); | 799 int bits2= show>>(24-len); |
800 | 800 |
801 print_bin(bits2, len); | 801 print_bin(bits2, len); |
802 | 802 |
803 printf("%5d %2d %3d vlc @%5d in %s %s:%d\n", bits2, len, r, pos, file, func, line); | 803 av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d vlc @%5d in %s %s:%d\n", bits2, len, r, pos, file, func, line); |
804 return r; | 804 return r; |
805 } | 805 } |
806 static inline int get_xbits_trace(GetBitContext *s, int n, char *file, char *func, int line){ | 806 static inline int get_xbits_trace(GetBitContext *s, int n, char *file, const char *func, int line){ |
807 int show= show_bits(s, n); | 807 int show= show_bits(s, n); |
808 int r= get_xbits(s, n); | 808 int r= get_xbits(s, n); |
809 | 809 |
810 print_bin(show, n); | 810 print_bin(show, n); |
811 printf("%5d %2d %3d xbt @%5d in %s %s:%d\n", show, n, r, get_bits_count(s)-n, file, func, line); | 811 av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d xbt @%5d in %s %s:%d\n", show, n, r, get_bits_count(s)-n, file, func, line); |
812 return r; | 812 return r; |
813 } | 813 } |
814 | 814 |
815 #define get_bits(s, n) get_bits_trace(s, n, __FILE__, __PRETTY_FUNCTION__, __LINE__) | 815 #define get_bits(s, n) get_bits_trace(s, n, __FILE__, __PRETTY_FUNCTION__, __LINE__) |
816 #define get_bits1(s) get_bits_trace(s, 1, __FILE__, __PRETTY_FUNCTION__, __LINE__) | 816 #define get_bits1(s) get_bits_trace(s, 1, __FILE__, __PRETTY_FUNCTION__, __LINE__) |