av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)

Originally committed as revision 2469 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Michel Bardiaux 21 years ago committed by Michael Niedermayer
parent 8bae9ddc91
commit 9b87956678
  1. 26
      libavcodec/4xm.c
  2. 12
      libavcodec/ac3enc.c
  3. 8
      libavcodec/adpcm.c
  4. 10
      libavcodec/adx.c
  5. 6
      libavcodec/asv1.c
  6. 22
      libavcodec/avcodec.h
  7. 2
      libavcodec/cinepak.c
  8. 2
      libavcodec/cljr.c
  9. 7
      libavcodec/common.c
  10. 2
      libavcodec/common.h
  11. 4
      libavcodec/cyuv.c
  12. 2
      libavcodec/dsputil.c
  13. 4
      libavcodec/dv.c
  14. 8
      libavcodec/error_resilience.c
  15. 12
      libavcodec/eval.c
  16. 20
      libavcodec/ffv1.c
  17. 236
      libavcodec/h263.c
  18. 16
      libavcodec/h263dec.c
  19. 76
      libavcodec/h264.c
  20. 16
      libavcodec/huffyuv.c
  21. 6
      libavcodec/idcinvideo.c
  22. 10
      libavcodec/indeo3.c
  23. 24
      libavcodec/interplayvideo.c
  24. 4
      libavcodec/mdec.c
  25. 34
      libavcodec/mjpeg.c
  26. 2
      libavcodec/motion_est.c
  27. 44
      libavcodec/mpeg12.c
  28. 2
      libavcodec/mpegaudio.c
  29. 84
      libavcodec/mpegvideo.c
  30. 44
      libavcodec/msmpeg4.c
  31. 14
      libavcodec/msrle.c
  32. 6
      libavcodec/msvideo1.c
  33. 6
      libavcodec/oggvorbis.c
  34. 6
      libavcodec/opts.c
  35. 4
      libavcodec/ra288.c
  36. 16
      libavcodec/ratecontrol.c
  37. 4
      libavcodec/resample.c
  38. 4
      libavcodec/roqvideo.c
  39. 10
      libavcodec/rpza.c
  40. 18
      libavcodec/rv10.c
  41. 2
      libavcodec/svq1.c
  42. 8
      libavcodec/svq3.c
  43. 51
      libavcodec/utils.c
  44. 2
      libavcodec/vcr1.c
  45. 30
      libavcodec/vp3.c
  46. 26
      libavcodec/vqavideo.c
  47. 18
      libavcodec/wmv2.c
  48. 10
      libavcodec/xan.c

@ -333,7 +333,7 @@ static int decode_p_frame(FourXContext *f, uint8_t *buf, int length){
const int wordstream_size= get32(buf+12); const int wordstream_size= get32(buf+12);
if(bitstream_size+ bytestream_size+ wordstream_size + 20 != length) if(bitstream_size+ bytestream_size+ wordstream_size + 20 != length)
printf("lengths %d %d %d %d\n", bitstream_size, bytestream_size, wordstream_size, av_log(f->avctx, AV_LOG_ERROR, "lengths %d %d %d %d\n", bitstream_size, bytestream_size, wordstream_size,
bitstream_size+ bytestream_size+ wordstream_size - length); bitstream_size+ bytestream_size+ wordstream_size - length);
f->bitstream_buffer= av_fast_realloc(f->bitstream_buffer, &f->bitstream_buffer_size, bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE); f->bitstream_buffer= av_fast_realloc(f->bitstream_buffer, &f->bitstream_buffer_size, bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE);
@ -354,7 +354,7 @@ static int decode_p_frame(FourXContext *f, uint8_t *buf, int length){
} }
if(bitstream_size != (get_bits_count(&f->gb)+31)/32*4) if(bitstream_size != (get_bits_count(&f->gb)+31)/32*4)
printf(" %d %d %d bytes left\n", av_log(f->avctx, AV_LOG_ERROR, " %d %d %d bytes left\n",
bitstream_size - (get_bits_count(&f->gb)+31)/32*4, bitstream_size - (get_bits_count(&f->gb)+31)/32*4,
bytestream_size - (f->bytestream - (buf + 20 + bitstream_size + wordstream_size)), bytestream_size - (f->bytestream - (buf + 20 + bitstream_size + wordstream_size)),
wordstream_size - (((uint8_t*)f->wordstream) - (buf + 20 + bitstream_size)) wordstream_size - (((uint8_t*)f->wordstream) - (buf + 20 + bitstream_size))
@ -373,7 +373,7 @@ static int decode_i_block(FourXContext *f, DCTELEM *block){
/* DC coef */ /* DC coef */
val = get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3); val = get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3);
if (val>>4){ if (val>>4){
printf("error dc run != 0\n"); av_log(f->avctx, AV_LOG_ERROR, "error dc run != 0\n");
} }
if(val) if(val)
@ -396,7 +396,7 @@ static int decode_i_block(FourXContext *f, DCTELEM *block){
level = get_xbits(&f->gb, code & 0xf); level = get_xbits(&f->gb, code & 0xf);
i += code >> 4; i += code >> 4;
if (i >= 64) { if (i >= 64) {
printf("run %d oveflow\n", i); av_log(f->avctx, AV_LOG_ERROR, "run %d oveflow\n", i);
return 0; return 0;
} }
@ -535,7 +535,7 @@ static uint8_t *read_huffman_tables(FourXContext *f, uint8_t * const buf){
for(node= j; up[node] != -1; node= up[node]){ for(node= j; up[node] != -1; node= up[node]){
bits += flag[node]<<len; bits += flag[node]<<len;
len++; len++;
if(len > 31) printf("vlc length overflow\n"); //can this happen at all ? if(len > 31) av_log(f->avctx, AV_LOG_ERROR, "vlc length overflow\n"); //can this happen at all ?
} }
bits_tab[j]= bits; bits_tab[j]= bits;
@ -561,7 +561,7 @@ static int decode_i_frame(FourXContext *f, uint8_t *buf, int length){
uint8_t *prestream= buf + bitstream_size + 12; uint8_t *prestream= buf + bitstream_size + 12;
if(prestream_size + bitstream_size + 12 != length) if(prestream_size + bitstream_size + 12 != length)
fprintf(stderr, "size missmatch %d %d %d\n", prestream_size, bitstream_size, length); av_log(f->avctx, AV_LOG_ERROR, "size missmatch %d %d %d\n", prestream_size, bitstream_size, length);
prestream= read_huffman_tables(f, prestream); prestream= read_huffman_tables(f, prestream);
@ -586,7 +586,7 @@ static int decode_i_frame(FourXContext *f, uint8_t *buf, int length){
} }
if(get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3) != 256) if(get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3) != 256)
printf("end missmatch\n"); av_log(f->avctx, AV_LOG_ERROR, "end missmatch\n");
return 0; return 0;
} }
@ -609,7 +609,7 @@ static int decode_frame(AVCodecContext *avctx,
frame_4cc= get32(buf); frame_4cc= get32(buf);
if(buf_size != get32(buf+4)+8){ if(buf_size != get32(buf+4)+8){
fprintf(stderr, "size missmatch %d %d\n", buf_size, get32(buf+4)); av_log(f->avctx, AV_LOG_ERROR, "size missmatch %d %d\n", buf_size, get32(buf+4));
} }
if(frame_4cc == ff_get_fourcc("cfrm")){ if(frame_4cc == ff_get_fourcc("cfrm")){
@ -621,7 +621,7 @@ static int decode_frame(AVCodecContext *avctx,
for(i=0; i<CFRAME_BUFFER_COUNT; i++){ for(i=0; i<CFRAME_BUFFER_COUNT; i++){
if(f->cfrm[i].id && f->cfrm[i].id < avctx->frame_number) if(f->cfrm[i].id && f->cfrm[i].id < avctx->frame_number)
printf("lost c frame %d\n", f->cfrm[i].id); av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n", f->cfrm[i].id);
} }
for(i=0; i<CFRAME_BUFFER_COUNT; i++){ for(i=0; i<CFRAME_BUFFER_COUNT; i++){
@ -645,7 +645,7 @@ static int decode_frame(AVCodecContext *avctx,
frame_size= cfrm->size; frame_size= cfrm->size;
if(id != avctx->frame_number){ if(id != avctx->frame_number){
printf("cframe id missmatch %d %d\n", id, avctx->frame_number); av_log(f->avctx, AV_LOG_ERROR, "cframe id missmatch %d %d\n", id, avctx->frame_number);
} }
cfrm->size= cfrm->id= 0; cfrm->size= cfrm->id= 0;
@ -671,7 +671,7 @@ static int decode_frame(AVCodecContext *avctx,
p->reference= 1; p->reference= 1;
if(avctx->get_buffer(avctx, p) < 0){ if(avctx->get_buffer(avctx, p) < 0){
fprintf(stderr, "get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1; return -1;
} }
@ -684,9 +684,9 @@ static int decode_frame(AVCodecContext *avctx,
if(decode_p_frame(f, buf, frame_size) < 0) if(decode_p_frame(f, buf, frame_size) < 0)
return -1; return -1;
}else if(frame_4cc == ff_get_fourcc("snd_")){ }else if(frame_4cc == ff_get_fourcc("snd_")){
printf("ignoring snd_ chunk length:%d\n", buf_size); av_log(avctx, AV_LOG_ERROR, "ignoring snd_ chunk length:%d\n", buf_size);
}else{ }else{
printf("ignoring unknown chunk length:%d\n", buf_size); av_log(avctx, AV_LOG_ERROR, "ignoring unknown chunk length:%d\n", buf_size);
} }
#if 0 #if 0

@ -464,7 +464,7 @@ static void compute_exp_strategy(uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNEL
for(i=1;i<NB_BLOCKS;i++) { for(i=1;i<NB_BLOCKS;i++) {
exp_diff = calc_exp_diff(exp[i][ch], exp[i-1][ch], N/2); exp_diff = calc_exp_diff(exp[i][ch], exp[i-1][ch], N/2);
#ifdef DEBUG #ifdef DEBUG
printf("exp_diff=%d\n", exp_diff); av_log(AV_LOG_DEBUG, "exp_diff=%d\n", exp_diff);
#endif #endif
if (exp_diff > EXP_DIFF_THRESHOLD) if (exp_diff > EXP_DIFF_THRESHOLD)
exp_strategy[i][ch] = EXP_NEW; exp_strategy[i][ch] = EXP_NEW;
@ -580,11 +580,11 @@ static int encode_exp(uint8_t encoded_exp[N/2],
} }
#if defined(DEBUG) #if defined(DEBUG)
printf("exponents: strategy=%d\n", exp_strategy); av_log(AV_LOG_DEBUG, "exponents: strategy=%d\n", exp_strategy);
for(i=0;i<=nb_groups * group_size;i++) { for(i=0;i<=nb_groups * group_size;i++) {
printf("%d ", encoded_exp[i]); av_log(AV_LOG_DEBUG, "%d ", encoded_exp[i]);
} }
printf("\n"); av_log(AV_LOG_DEBUG, "\n");
#endif #endif
return 4 + (nb_groups / 3) * 7; return 4 + (nb_groups / 3) * 7;
@ -746,7 +746,7 @@ static int compute_bit_allocation(AC3EncodeContext *s,
bit_alloc(s, bap, encoded_exp, exp_strategy, frame_bits, csnroffst, 0) < 0) bit_alloc(s, bap, encoded_exp, exp_strategy, frame_bits, csnroffst, 0) < 0)
csnroffst -= SNR_INC1; csnroffst -= SNR_INC1;
if (csnroffst < 0) { if (csnroffst < 0) {
fprintf(stderr, "Yack, Error !!!\n"); av_log(NULL, AV_LOG_ERROR, "Yack, Error !!!\n");
return -1; return -1;
} }
while ((csnroffst + SNR_INC1) <= 63 && while ((csnroffst + SNR_INC1) <= 63 &&
@ -1021,7 +1021,7 @@ static void output_audio_block(AC3EncodeContext *s,
#if defined(DEBUG) #if defined(DEBUG)
{ {
static int count = 0; static int count = 0;
printf("Block #%d (%d)\n", block_num, count++); av_log(AV_LOG_DEBUG, "Block #%d (%d)\n", block_num, count++);
} }
#endif #endif
/* exponent strategy */ /* exponent strategy */

@ -129,7 +129,7 @@ static int adpcm_encode_init(AVCodecContext *avctx)
return -1; /* only stereo or mono =) */ return -1; /* only stereo or mono =) */
switch(avctx->codec->id) { switch(avctx->codec->id) {
case CODEC_ID_ADPCM_IMA_QT: case CODEC_ID_ADPCM_IMA_QT:
fprintf(stderr, "ADPCM: codec admcp_ima_qt unsupported for encoding !\n"); av_log(avctx, AV_LOG_ERROR, "ADPCM: codec admcp_ima_qt unsupported for encoding !\n");
avctx->frame_size = 64; /* XXX: can multiple of avctx->channels * 64 (left and right blocks are interleaved) */ avctx->frame_size = 64; /* XXX: can multiple of avctx->channels * 64 (left and right blocks are interleaved) */
return -1; return -1;
break; break;
@ -140,7 +140,7 @@ static int adpcm_encode_init(AVCodecContext *avctx)
/* seems frame_size isn't taken into account... have to buffer the samples :-( */ /* seems frame_size isn't taken into account... have to buffer the samples :-( */
break; break;
case CODEC_ID_ADPCM_MS: case CODEC_ID_ADPCM_MS:
fprintf(stderr, "ADPCM: codec admcp_ms unsupported for encoding !\n"); av_log(avctx, AV_LOG_ERROR, "ADPCM: codec admcp_ms unsupported for encoding !\n");
return -1; return -1;
break; break;
default: default:
@ -496,7 +496,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
cs->step_index = (*src++) & 0x7F; cs->step_index = (*src++) & 0x7F;
if (cs->step_index > 88) fprintf(stderr, "ERROR: step_index = %i\n", cs->step_index); if (cs->step_index > 88) av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
if (cs->step_index > 88) cs->step_index = 88; if (cs->step_index > 88) cs->step_index = 88;
cs->step = step_table[cs->step_index]; cs->step = step_table[cs->step_index];
@ -540,7 +540,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
cs->step_index = *src++; cs->step_index = *src++;
if (cs->step_index < 0) cs->step_index = 0; if (cs->step_index < 0) cs->step_index = 0;
if (cs->step_index > 88) cs->step_index = 88; if (cs->step_index > 88) cs->step_index = 88;
if (*src++) fprintf(stderr, "unused byte should be null !!\n"); /* unused */ if (*src++) av_log(avctx, AV_LOG_ERROR, "unused byte should be null !!\n"); /* unused */
if (st) { if (st) {
cs = &(c->status[1]); cs = &(c->status[1]);

@ -199,7 +199,7 @@ static int adx_encode_init(AVCodecContext *avctx)
// avctx->bit_rate = avctx->sample_rate*avctx->channels*18*8/32; // avctx->bit_rate = avctx->sample_rate*avctx->channels*18*8/32;
printf("adx encode init\n"); fflush(stdout); av_log(avctx, AV_LOG_DEBUG, "adx encode init\n");
adx_decode_init(avctx); adx_decode_init(avctx);
return 0; return 0;
@ -318,11 +318,11 @@ static void dump(unsigned char *buf,size_t len)
{ {
int i; int i;
for(i=0;i<len;i++) { for(i=0;i<len;i++) {
if ((i&15)==0) printf("%04x ",i); if ((i&15)==0) av_log(NULL, AV_LOG_DEBUG, "%04x ",i);
printf("%02x ",buf[i]); av_log(NULL, AV_LOG_DEBUG, "%02x ",buf[i]);
if ((i&15)==15) printf("\n"); if ((i&15)==15) av_log(NULL, AV_LOG_DEBUG, "\n");
} }
printf("\n"); av_log(NULL, AV_LOG_ERROR, "\n");
} }
static int adx_decode_frame(AVCodecContext *avctx, static int adx_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,

@ -207,7 +207,7 @@ static inline int asv1_decode_block(ASV1Context *a, DCTELEM block[64]){
if(ccp){ if(ccp){
if(ccp == 16) break; if(ccp == 16) break;
if(ccp < 0 || i>=10){ if(ccp < 0 || i>=10){
printf("coded coeff pattern damaged\n"); av_log(a->avctx, AV_LOG_ERROR, "coded coeff pattern damaged\n");
return -1; return -1;
} }
@ -415,7 +415,7 @@ static int decode_frame(AVCodecContext *avctx,
p->reference= 0; p->reference= 0;
if(avctx->get_buffer(avctx, p) < 0){ if(avctx->get_buffer(avctx, p) < 0){
fprintf(stderr, "get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1; return -1;
} }
p->pict_type= I_TYPE; p->pict_type= I_TYPE;
@ -561,7 +561,7 @@ static int decode_init(AVCodecContext *avctx){
a->inv_qscale= ((uint8_t*)avctx->extradata)[0]; a->inv_qscale= ((uint8_t*)avctx->extradata)[0];
if(a->inv_qscale == 0){ if(a->inv_qscale == 0){
printf("illegal qscale 0\n"); av_log(avctx, AV_LOG_ERROR, "illegal qscale 0\n");
if(avctx->codec_id == CODEC_ID_ASV1) if(avctx->codec_id == CODEC_ID_ASV1)
a->inv_qscale= 6; a->inv_qscale= 6;
else else

@ -1830,6 +1830,28 @@ void *__av_mallocz_static(void** location, unsigned int size);
/* add by bero : in adx.c */ /* add by bero : in adx.c */
int is_adx(const unsigned char *buf,size_t bufsize); int is_adx(const unsigned char *buf,size_t bufsize);
/* av_log API */
#include <stdarg.h>
#define AV_LOG_ERROR 0
#define AV_LOG_INFO 1
#define AV_LOG_DEBUG 2
extern void av_log(AVCodecContext*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4)));
extern void av_vlog(AVCodecContext*, int level, const char *fmt, va_list);
extern int av_log_get_level(void);
extern void av_log_set_level(int);
extern void av_log_set_callback(void (*)(AVCodecContext*, int, const char*, va_list));
#undef AV_LOG_TRAP_PRINTF
#ifdef AV_LOG_TRAP_PRINTF
#define printf DO NOT USE
#define fprintf DO NOT USE
#undef stderr
#define stderr DO NOT USE
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

@ -418,7 +418,7 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
s->size = buf_size; s->size = buf_size;
if (avctx->get_buffer(avctx, &s->frame)) { if (avctx->get_buffer(avctx, &s->frame)) {
printf (" Cinepak: get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, " Cinepak: get_buffer() failed\n");
return -1; return -1;
} }

@ -55,7 +55,7 @@ static int decode_frame(AVCodecContext *avctx,
p->reference= 0; p->reference= 0;
if(avctx->get_buffer(avctx, p) < 0){ if(avctx->get_buffer(avctx, p) < 0){
fprintf(stderr, "get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1; return -1;
} }
p->pict_type= I_TYPE; p->pict_type= I_TYPE;

@ -196,7 +196,8 @@ void align_get_bits(GetBitContext *s)
int check_marker(GetBitContext *s, const char *msg) int check_marker(GetBitContext *s, const char *msg)
{ {
int bit= get_bits1(s); int bit= get_bits1(s);
if(!bit) printf("Marker bit missing %s\n", msg); if(!bit)
av_log(NULL, AV_LOG_INFO, "Marker bit missing %s\n", msg);
return bit; return bit;
} }
@ -281,11 +282,11 @@ static int build_table(VLC *vlc, int table_nb_bits,
nb = 1 << (table_nb_bits - n); nb = 1 << (table_nb_bits - n);
for(k=0;k<nb;k++) { for(k=0;k<nb;k++) {
#ifdef DEBUG_VLC #ifdef DEBUG_VLC
printf("%4x: code=%d n=%d\n", av_log(AV_LOG_DEBUG, "%4x: code=%d n=%d\n",
j, i, n); j, i, n);
#endif #endif
if (table[j][1] /*bits*/ != 0) { if (table[j][1] /*bits*/ != 0) {
fprintf(stderr, "incorrect codes\n"); av_log(NULL, AV_LOG_ERROR, "incorrect codes\n");
av_abort(); av_abort();
} }
table[j][1] = n; //bits table[j][1] = n; //bits

@ -192,7 +192,7 @@ inline void dprintf(const char* fmt,...) {}
# endif /* !CONFIG_WIN32 */ # endif /* !CONFIG_WIN32 */
# define av_abort() do { fprintf(stderr, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0) # define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0)
//rounded divison & shift //rounded divison & shift
#define RSHIFT(a,b) ((a) > 0 ? ((a) + (1<<((b)-1)))>>(b) : ((a) + (1<<((b)-1))-1)>>(b)) #define RSHIFT(a,b) ((a) > 0 ? ((a) + (1<<((b)-1)))>>(b) : ((a) + (1<<((b)-1))-1)>>(b))

@ -88,7 +88,7 @@ static int cyuv_decode_frame(AVCodecContext *avctx,
* of 4 pixels. Thus, the total size of the buffer ought to be: * of 4 pixels. Thus, the total size of the buffer ought to be:
* (3 * 16) + height * (width * 3 / 4) */ * (3 * 16) + height * (width * 3 / 4) */
if (buf_size != 48 + s->height * (s->width * 3 / 4)) { if (buf_size != 48 + s->height * (s->width * 3 / 4)) {
printf ("ffmpeg: cyuv: got a buffer with %d bytes when %d were expected\n", av_log(avctx, AV_LOG_ERROR, "ffmpeg: cyuv: got a buffer with %d bytes when %d were expected\n",
buf_size, buf_size,
48 + s->height * (s->width * 3 / 4)); 48 + s->height * (s->width * 3 / 4));
return -1; return -1;
@ -102,7 +102,7 @@ static int cyuv_decode_frame(AVCodecContext *avctx,
s->frame.reference = 0; s->frame.reference = 0;
if(avctx->get_buffer(avctx, &s->frame) < 0) { if(avctx->get_buffer(avctx, &s->frame) < 0) {
fprintf(stderr, "get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1; return -1;
} }

@ -3089,7 +3089,7 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->idct_permutation[i]= ((i&7)<<3) | (i>>3); c->idct_permutation[i]= ((i&7)<<3) | (i>>3);
break; break;
default: default:
fprintf(stderr, "Internal error, IDCT permutation not set\n"); av_log(avctx, AV_LOG_ERROR, "Internal error, IDCT permutation not set\n");
} }
} }

@ -297,7 +297,7 @@ static void dv_decode_ac(DVVideoDecodeContext *s,
if (pos >= 64) { if (pos >= 64) {
read_error: read_error:
#if defined(VLC_DEBUG) || 1 #if defined(VLC_DEBUG) || 1
fprintf(stderr, "error pos=%d\n", pos); av_log(NULL, AV_LOG_ERROR, "error pos=%d\n", pos);
#endif #endif
/* for errors, we consider the eob is reached */ /* for errors, we consider the eob is reached */
mb->eob_reached = 1; mb->eob_reached = 1;
@ -868,7 +868,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
avctx->width = s->sys->width; avctx->width = s->sys->width;
avctx->height = s->sys->height; avctx->height = s->sys->height;
if(avctx->get_buffer(avctx, &s->picture) < 0) { if(avctx->get_buffer(avctx, &s->picture) < 0) {
fprintf(stderr, "get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1; return -1;
} }
s->picture.interlaced_frame = 1; s->picture.interlaced_frame = 1;

@ -669,12 +669,12 @@ void ff_er_frame_end(MpegEncContext *s){
if(!s->error_resilience || s->error_count==0) return; if(!s->error_resilience || s->error_count==0) return;
fprintf(stderr, "concealing errors\n"); av_log(s->avctx, AV_LOG_INFO, "concealing errors\n");
if(s->motion_val == NULL){ if(s->motion_val == NULL){
int size = (2 * s->mb_width + 2) * (2 * s->mb_height + 2); int size = (2 * s->mb_width + 2) * (2 * s->mb_height + 2);
fprintf(stderr, "Warning MVs not available\n"); av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n");
s->motion_val= av_mallocz(size * 2 * sizeof(int16_t)); s->motion_val= av_mallocz(size * 2 * sizeof(int16_t));
} }
@ -684,9 +684,9 @@ void ff_er_frame_end(MpegEncContext *s){
for(mb_x=0; mb_x<s->mb_width; mb_x++){ for(mb_x=0; mb_x<s->mb_width; mb_x++){
int status= s->error_status_table[mb_x + mb_y*s->mb_stride]; int status= s->error_status_table[mb_x + mb_y*s->mb_stride];
printf("%2X ", status); av_log(s->avctx, AV_LOG_DEBUG, "%2X ", status);
} }
printf("\n"); av_log(s->avctx, AV_LOG_DEBUG, "\n");
} }
} }

@ -61,7 +61,7 @@ static void evalExpression(Parser *p);
static void push(Parser *p, double d){ static void push(Parser *p, double d){
if(p->stack_index+1>= STACK_SIZE){ if(p->stack_index+1>= STACK_SIZE){
fprintf(stderr, "stack overflow in the parser\n"); av_log(NULL, AV_LOG_ERROR, "stack overflow in the parser\n");
return; return;
} }
p->stack[ p->stack_index++ ]= d; p->stack[ p->stack_index++ ]= d;
@ -70,7 +70,7 @@ static void push(Parser *p, double d){
static double pop(Parser *p){ static double pop(Parser *p){
if(p->stack_index<=0){ if(p->stack_index<=0){
fprintf(stderr, "stack underflow in the parser\n"); av_log(NULL, AV_LOG_ERROR, "stack underflow in the parser\n");
return NAN; return NAN;
} }
//printf("pop\n"); fflush(stdout); //printf("pop\n"); fflush(stdout);
@ -109,7 +109,7 @@ static void evalPrimary(Parser *p){
p->s= strchr(p->s, '('); p->s= strchr(p->s, '(');
if(p->s==NULL){ if(p->s==NULL){
fprintf(stderr, "Parser: missing ( in \"%s\"\n", next); av_log(NULL, AV_LOG_ERROR, "Parser: missing ( in \"%s\"\n", next);
return; return;
} }
p->s++; // "(" p->s++; // "("
@ -159,13 +159,13 @@ static void evalPrimary(Parser *p){
} }
if(error){ if(error){
fprintf(stderr, "Parser: unknown function in \"%s\"\n", next); av_log(NULL, AV_LOG_ERROR, "Parser: unknown function in \"%s\"\n", next);
return; return;
} }
} }
if(p->s[-1]!= ')'){ if(p->s[-1]!= ')'){
fprintf(stderr, "Parser: missing ) in \"%s\"\n", next); av_log(NULL, AV_LOG_ERROR, "Parser: missing ) in \"%s\"\n", next);
return; return;
} }
push(p, d); push(p, d);
@ -185,7 +185,7 @@ static void evalPow(Parser *p){
evalExpression(p); evalExpression(p);
if(p->s[0]!=')') if(p->s[0]!=')')
fprintf(stderr, "Parser: missing )\n"); av_log(NULL, AV_LOG_ERROR, "Parser: missing )\n");
p->s++; p->s++;
}else{ }else{
evalPrimary(p); evalPrimary(p);

@ -598,7 +598,7 @@ static int encode_init(AVCodecContext *avctx)
s->colorspace= 1; s->colorspace= 1;
break; break;
default: default:
fprintf(stderr, "format not supported\n"); av_log(avctx, AV_LOG_ERROR, "format not supported\n");
return -1; return -1;
} }
avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_h_shift, &s->chroma_v_shift); avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_h_shift, &s->chroma_v_shift);
@ -642,7 +642,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
int used_count= 0; int used_count= 0;
if(avctx->strict_std_compliance >= 0){ if(avctx->strict_std_compliance >= 0){
printf("this codec is under development, files encoded with it wont be decodeable with future versions!!!\n" av_log(avctx, AV_LOG_ERROR, "this codec is under development, files encoded with it wont be decodeable with future versions!!!\n"
"use vstrict=-1 to use it anyway\n"); "use vstrict=-1 to use it anyway\n");
return -1; return -1;
} }
@ -885,17 +885,17 @@ static int read_header(FFV1Context *f){
case 0x20: f->avctx->pix_fmt= PIX_FMT_YUV411P; break; case 0x20: f->avctx->pix_fmt= PIX_FMT_YUV411P; break;
case 0x33: f->avctx->pix_fmt= PIX_FMT_YUV410P; break; case 0x33: f->avctx->pix_fmt= PIX_FMT_YUV410P; break;
default: default:
fprintf(stderr, "format not supported\n"); av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
return -1; return -1;
} }
}else if(f->colorspace==1){ }else if(f->colorspace==1){
if(f->chroma_h_shift || f->chroma_v_shift){ if(f->chroma_h_shift || f->chroma_v_shift){
fprintf(stderr, "chroma subsampling not supported in this colorspace\n"); av_log(f->avctx, AV_LOG_ERROR, "chroma subsampling not supported in this colorspace\n");
return -1; return -1;
} }
f->avctx->pix_fmt= PIX_FMT_RGBA32; f->avctx->pix_fmt= PIX_FMT_RGBA32;
}else{ }else{
fprintf(stderr, "colorspace not supported\n"); av_log(f->avctx, AV_LOG_ERROR, "colorspace not supported\n");
return -1; return -1;
} }
@ -905,7 +905,7 @@ static int read_header(FFV1Context *f){
for(i=0; i<5; i++){ for(i=0; i<5; i++){
context_count*= read_quant_table(c, f->quant_table[i], context_count); context_count*= read_quant_table(c, f->quant_table[i], context_count);
if(context_count < 0){ if(context_count < 0){
printf("read_quant_table error\n"); av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n");
return -1; return -1;
} }
} }
@ -965,16 +965,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8
p->reference= 0; p->reference= 0;
if(avctx->get_buffer(avctx, p) < 0){ if(avctx->get_buffer(avctx, p) < 0){
fprintf(stderr, "get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1; return -1;
} }
if(avctx->debug&FF_DEBUG_PICT_INFO) if(avctx->debug&FF_DEBUG_PICT_INFO)
printf("keyframe:%d coder:%d\n", p->key_frame, f->ac); av_log(avctx, AV_LOG_ERROR, "keyframe:%d coder:%d\n", p->key_frame, f->ac);
if(!f->ac){ if(!f->ac){
bytes_read = get_cabac_terminate(c); bytes_read = get_cabac_terminate(c);
if(bytes_read ==0) printf("error at end of AC stream\n"); if(bytes_read ==0) av_log(avctx, AV_LOG_ERROR, "error at end of AC stream\n");
//printf("pos=%d\n", bytes_read); //printf("pos=%d\n", bytes_read);
init_get_bits(&f->gb, buf + bytes_read, buf_size - bytes_read); init_get_bits(&f->gb, buf + bytes_read, buf_size - bytes_read);
} else { } else {
@ -1004,7 +1004,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8
if(f->ac){ if(f->ac){
bytes_read= get_cabac_terminate(c); bytes_read= get_cabac_terminate(c);
if(bytes_read ==0) printf("error at end of frame\n"); if(bytes_read ==0) av_log(f->avctx, AV_LOG_ERROR, "error at end of frame\n");
}else{ }else{
bytes_read+= (get_bits_count(&f->gb)+7)/8; bytes_read+= (get_bits_count(&f->gb)+7)/8;
} }

@ -617,7 +617,7 @@ static inline int get_p_cbp(MpegEncContext * s,
if(s->flags & CODEC_FLAG_CBP_RD){ if(s->flags & CODEC_FLAG_CBP_RD){
int best_cbpy_score= INT_MAX; int best_cbpy_score= INT_MAX;
int best_cbpc_score= INT_MAX; int best_cbpc_score= INT_MAX;
int cbpc, cbpy; int cbpc = (-1), cbpy= (-1);
const int offset= (s->mv_type==MV_TYPE_16X16 ? 0 : 16) + (s->dquant ? 8 : 0); const int offset= (s->mv_type==MV_TYPE_16X16 ? 0 : 16) + (s->dquant ? 8 : 0);
const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6); const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
@ -828,7 +828,7 @@ void mpeg4_encode_mb(MpegEncContext * s,
s->f_count++; s->f_count++;
break; break;
default: default:
printf("unknown mb type\n"); av_log(s->avctx, AV_LOG_ERROR, "unknown mb type\n");
return; return;
} }
@ -2721,7 +2721,7 @@ static int mpeg4_decode_video_packet_header(MpegEncContext *s)
} }
if(len!=ff_mpeg4_get_video_packet_prefix_length(s)){ if(len!=ff_mpeg4_get_video_packet_prefix_length(s)){
printf("marker does not match f_code\n"); av_log(s->avctx, AV_LOG_ERROR, "marker does not match f_code\n");
return -1; return -1;
} }
@ -2732,7 +2732,7 @@ static int mpeg4_decode_video_packet_header(MpegEncContext *s)
mb_num= get_bits(&s->gb, mb_num_bits); mb_num= get_bits(&s->gb, mb_num_bits);
if(mb_num>=s->mb_num){ if(mb_num>=s->mb_num){
fprintf(stderr, "illegal mb_num in video packet (%d %d) \n", mb_num, s->mb_num); av_log(s->avctx, AV_LOG_ERROR, "illegal mb_num in video packet (%d %d) \n", mb_num, s->mb_num);
return -1; return -1;
} }
if(s->pict_type == B_TYPE){ if(s->pict_type == B_TYPE){
@ -2771,7 +2771,7 @@ static int mpeg4_decode_video_packet_header(MpegEncContext *s)
//FIXME dont just ignore everything //FIXME dont just ignore everything
if(s->pict_type == S_TYPE && s->vol_sprite_usage==GMC_SPRITE){ if(s->pict_type == S_TYPE && s->vol_sprite_usage==GMC_SPRITE){
mpeg4_decode_sprite_trajectory(s); mpeg4_decode_sprite_trajectory(s);
fprintf(stderr, "untested\n"); av_log(s->avctx, AV_LOG_ERROR, "untested\n");
} }
//FIXME reduced res stuff here //FIXME reduced res stuff here
@ -2779,13 +2779,13 @@ static int mpeg4_decode_video_packet_header(MpegEncContext *s)
if (s->pict_type != I_TYPE) { if (s->pict_type != I_TYPE) {
int f_code = get_bits(&s->gb, 3); /* fcode_for */ int f_code = get_bits(&s->gb, 3); /* fcode_for */
if(f_code==0){ if(f_code==0){
printf("Error, video packet header damaged (f_code=0)\n"); av_log(s->avctx, AV_LOG_ERROR, "Error, video packet header damaged (f_code=0)\n");
} }
} }
if (s->pict_type == B_TYPE) { if (s->pict_type == B_TYPE) {
int b_code = get_bits(&s->gb, 3); int b_code = get_bits(&s->gb, 3);
if(b_code==0){ if(b_code==0){
printf("Error, video packet header damaged (b_code=0)\n"); av_log(s->avctx, AV_LOG_ERROR, "Error, video packet header damaged (b_code=0)\n");
} }
} }
} }
@ -2948,7 +2948,7 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){
do{ do{
cbpc = get_vlc2(&s->gb, intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2); cbpc = get_vlc2(&s->gb, intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2);
if (cbpc < 0){ if (cbpc < 0){
fprintf(stderr, "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
}while(cbpc == 8); }while(cbpc == 8);
@ -2967,7 +2967,7 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){
int dc_pred_dir; int dc_pred_dir;
int dc= mpeg4_decode_dc(s, i, &dc_pred_dir); int dc= mpeg4_decode_dc(s, i, &dc_pred_dir);
if(dc < 0){ if(dc < 0){
fprintf(stderr, "DC corrupted at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "DC corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
dir<<=1; dir<<=1;
@ -3007,7 +3007,7 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){
cbpc = get_vlc2(&s->gb, inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2); cbpc = get_vlc2(&s->gb, inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
if (cbpc < 0){ if (cbpc < 0){
fprintf(stderr, "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
// }while(cbpc == 20); // }while(cbpc == 20);
@ -3103,7 +3103,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count){
int ac_pred= get_bits1(&s->gb); int ac_pred= get_bits1(&s->gb);
int cbpy = get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1); int cbpy = get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1);
if(cbpy<0){ if(cbpy<0){
fprintf(stderr, "cbpy corrupted at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "cbpy corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
@ -3116,7 +3116,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count){
int cbpy = get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1); int cbpy = get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1);
if(cbpy<0){ if(cbpy<0){
fprintf(stderr, "I cbpy corrupted at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "I cbpy corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
@ -3129,7 +3129,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count){
int dc_pred_dir; int dc_pred_dir;
int dc= mpeg4_decode_dc(s, i, &dc_pred_dir); int dc= mpeg4_decode_dc(s, i, &dc_pred_dir);
if(dc < 0){ if(dc < 0){
fprintf(stderr, "DC corrupted at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "DC corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
dir<<=1; dir<<=1;
@ -3146,7 +3146,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count){
int cbpy = get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1); int cbpy = get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1);
if(cbpy<0){ if(cbpy<0){
fprintf(stderr, "P cbpy corrupted at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "P cbpy corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
@ -3183,7 +3183,7 @@ int ff_mpeg4_decode_partitions(MpegEncContext *s)
} }
if(s->resync_mb_x + s->resync_mb_y*s->mb_width + mb_num > s->mb_num){ if(s->resync_mb_x + s->resync_mb_y*s->mb_width + mb_num > s->mb_num){
fprintf(stderr, "slice below monitor ...\n"); av_log(s->avctx, AV_LOG_ERROR, "slice below monitor ...\n");
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, part_a_error); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, part_a_error);
return -1; return -1;
} }
@ -3192,12 +3192,12 @@ int ff_mpeg4_decode_partitions(MpegEncContext *s)
if(s->pict_type==I_TYPE){ if(s->pict_type==I_TYPE){
if(get_bits_long(&s->gb, 19)!=DC_MARKER){ if(get_bits_long(&s->gb, 19)!=DC_MARKER){
fprintf(stderr, "marker missing after first I partition at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "marker missing after first I partition at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
}else{ }else{
if(get_bits(&s->gb, 17)!=MOTION_MARKER){ if(get_bits(&s->gb, 17)!=MOTION_MARKER){
fprintf(stderr, "marker missing after first P partition at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "marker missing after first P partition at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
} }
@ -3276,7 +3276,7 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, DCTELEM block[6][64])
/* decode each block */ /* decode each block */
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if(mpeg4_decode_block(s, block[i], i, cbp&32, s->mb_intra, s->rvlc) < 0){ if(mpeg4_decode_block(s, block[i], i, cbp&32, s->mb_intra, s->rvlc) < 0){
fprintf(stderr, "texture corrupted at %d %d %d\n", s->mb_x, s->mb_y, s->mb_intra); av_log(s->avctx, AV_LOG_ERROR, "texture corrupted at %d %d %d\n", s->mb_x, s->mb_y, s->mb_intra);
return -1; return -1;
} }
cbp+=cbp; cbp+=cbp;
@ -3337,7 +3337,7 @@ int ff_h263_decode_mb(MpegEncContext *s,
cbpc = get_vlc2(&s->gb, inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2); cbpc = get_vlc2(&s->gb, inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
//fprintf(stderr, "\tCBPC: %d", cbpc); //fprintf(stderr, "\tCBPC: %d", cbpc);
if (cbpc < 0){ if (cbpc < 0){
fprintf(stderr, "cbpc damaged at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
}while(cbpc == 20); }while(cbpc == 20);
@ -3484,7 +3484,7 @@ int ff_h263_decode_mb(MpegEncContext *s,
modb2= get_bits1(&s->gb); modb2= get_bits1(&s->gb);
mb_type= get_vlc2(&s->gb, mb_type_b_vlc.table, MB_TYPE_B_VLC_BITS, 1); mb_type= get_vlc2(&s->gb, mb_type_b_vlc.table, MB_TYPE_B_VLC_BITS, 1);
if(mb_type<0){ if(mb_type<0){
printf("illegal MB_type\n"); av_log(s->avctx, AV_LOG_ERROR, "illegal MB_type\n");
return -1; return -1;
} }
mb_type= mb_type_b_map[ mb_type ]; mb_type= mb_type_b_map[ mb_type ];
@ -3580,7 +3580,7 @@ int ff_h263_decode_mb(MpegEncContext *s,
do{ do{
cbpc = get_vlc2(&s->gb, intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2); cbpc = get_vlc2(&s->gb, intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2);
if (cbpc < 0){ if (cbpc < 0){
fprintf(stderr, "I cbpc damaged at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "I cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
}while(cbpc == 8); }while(cbpc == 8);
@ -3602,7 +3602,7 @@ intra:
cbpy = get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1); cbpy = get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1);
if(cbpy<0){ if(cbpy<0){
fprintf(stderr, "I cbpy damaged at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
cbp = (cbpc & 3) | (cbpy << 2); cbp = (cbpc & 3) | (cbpy << 2);
@ -3771,7 +3771,7 @@ static int h263_decode_block(MpegEncContext * s, DCTELEM * block,
}else{ }else{
level = get_bits(&s->gb, 8); level = get_bits(&s->gb, 8);
if((level&0x7F) == 0){ if((level&0x7F) == 0){
fprintf(stderr, "illegal dc %d at %d %d\n", level, s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "illegal dc %d at %d %d\n", level, s->mb_x, s->mb_y);
return -1; return -1;
} }
if (level == 255) if (level == 255)
@ -3792,7 +3792,7 @@ static int h263_decode_block(MpegEncContext * s, DCTELEM * block,
for(;;) { for(;;) {
code = get_vlc2(&s->gb, rl->vlc.table, TEX_VLC_BITS, 2); code = get_vlc2(&s->gb, rl->vlc.table, TEX_VLC_BITS, 2);
if (code < 0){ if (code < 0){
fprintf(stderr, "illegal ac vlc code at %dx%d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
if (code == rl->n) { if (code == rl->n) {
@ -3829,7 +3829,7 @@ static int h263_decode_block(MpegEncContext * s, DCTELEM * block,
} }
i += run; i += run;
if (i >= 64){ if (i >= 64){
fprintf(stderr, "run overflow at %dx%d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "run overflow at %dx%d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
j = scan_table[i]; j = scan_table[i];
@ -3863,7 +3863,7 @@ static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
else else
code = get_vlc2(&s->gb, dc_chrom.table, DC_VLC_BITS, 1); code = get_vlc2(&s->gb, dc_chrom.table, DC_VLC_BITS, 1);
if (code < 0 || code > 9 /* && s->nbit<9 */){ if (code < 0 || code > 9 /* && s->nbit<9 */){
fprintf(stderr, "illegal dc vlc\n"); av_log(s->avctx, AV_LOG_ERROR, "illegal dc vlc\n");
return -1; return -1;
} }
if (code == 0) { if (code == 0) {
@ -3885,7 +3885,7 @@ static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
if (code > 8){ if (code > 8){
if(get_bits1(&s->gb)==0){ /* marker */ if(get_bits1(&s->gb)==0){ /* marker */
if(s->error_resilience>=2){ if(s->error_resilience>=2){
fprintf(stderr, "dc marker bit missing\n"); av_log(s->avctx, AV_LOG_ERROR, "dc marker bit missing\n");
return -1; return -1;
} }
} }
@ -3895,7 +3895,7 @@ static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
level += pred; level += pred;
if (level < 0){ if (level < 0){
if(s->error_resilience>=3){ if(s->error_resilience>=3){
fprintf(stderr, "dc<0 at %dx%d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "dc<0 at %dx%d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
level = 0; level = 0;
@ -3910,7 +3910,7 @@ static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
if(s->error_resilience>=3){ if(s->error_resilience>=3){
if(*dc_val > 2048 + s->y_dc_scale + s->c_dc_scale){ if(*dc_val > 2048 + s->y_dc_scale + s->c_dc_scale){
fprintf(stderr, "dc overflow at %dx%d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "dc overflow at %dx%d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
} }
@ -4009,7 +4009,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
/* escape */ /* escape */
if(rvlc){ if(rvlc){
if(SHOW_UBITS(re, &s->gb, 1)==0){ if(SHOW_UBITS(re, &s->gb, 1)==0){
fprintf(stderr, "1. marker bit missing in rvlc esc\n"); av_log(s->avctx, AV_LOG_ERROR, "1. marker bit missing in rvlc esc\n");
return -1; return -1;
}; SKIP_CACHE(re, &s->gb, 1); }; SKIP_CACHE(re, &s->gb, 1);
@ -4019,14 +4019,14 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
UPDATE_CACHE(re, &s->gb); UPDATE_CACHE(re, &s->gb);
if(SHOW_UBITS(re, &s->gb, 1)==0){ if(SHOW_UBITS(re, &s->gb, 1)==0){
fprintf(stderr, "2. marker bit missing in rvlc esc\n"); av_log(s->avctx, AV_LOG_ERROR, "2. marker bit missing in rvlc esc\n");
return -1; return -1;
}; SKIP_CACHE(re, &s->gb, 1); }; SKIP_CACHE(re, &s->gb, 1);
level= SHOW_UBITS(re, &s->gb, 11); SKIP_CACHE(re, &s->gb, 11); level= SHOW_UBITS(re, &s->gb, 11); SKIP_CACHE(re, &s->gb, 11);
if(SHOW_UBITS(re, &s->gb, 5)!=0x10){ if(SHOW_UBITS(re, &s->gb, 5)!=0x10){
fprintf(stderr, "reverse esc missing\n"); av_log(s->avctx, AV_LOG_ERROR, "reverse esc missing\n");
return -1; return -1;
}; SKIP_CACHE(re, &s->gb, 5); }; SKIP_CACHE(re, &s->gb, 5);
@ -4056,14 +4056,14 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
level= SHOW_SBITS(re, &s->gb, 12); LAST_SKIP_BITS(re, &s->gb, 12); level= SHOW_SBITS(re, &s->gb, 12); LAST_SKIP_BITS(re, &s->gb, 12);
}else{ }else{
if(SHOW_UBITS(re, &s->gb, 1)==0){ if(SHOW_UBITS(re, &s->gb, 1)==0){
fprintf(stderr, "1. marker bit missing in 3. esc\n"); av_log(s->avctx, AV_LOG_ERROR, "1. marker bit missing in 3. esc\n");
return -1; return -1;
}; SKIP_CACHE(re, &s->gb, 1); }; SKIP_CACHE(re, &s->gb, 1);
level= SHOW_SBITS(re, &s->gb, 12); SKIP_CACHE(re, &s->gb, 12); level= SHOW_SBITS(re, &s->gb, 12); SKIP_CACHE(re, &s->gb, 12);
if(SHOW_UBITS(re, &s->gb, 1)==0){ if(SHOW_UBITS(re, &s->gb, 1)==0){
fprintf(stderr, "2. marker bit missing in 3. esc\n"); av_log(s->avctx, AV_LOG_ERROR, "2. marker bit missing in 3. esc\n");
return -1; return -1;
}; LAST_SKIP_CACHE(re, &s->gb, 1); }; LAST_SKIP_CACHE(re, &s->gb, 1);
@ -4071,7 +4071,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
} }
if(level*s->qscale>1024 || level*s->qscale<-1024){ if(level*s->qscale>1024 || level*s->qscale<-1024){
fprintf(stderr, "|level| overflow in 3. esc, qp=%d\n", s->qscale); av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc, qp=%d\n", s->qscale);
return -1; return -1;
} }
#if 0 #if 0
@ -4080,7 +4080,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
if(abs_level<=MAX_LEVEL && run<=MAX_RUN){ if(abs_level<=MAX_LEVEL && run<=MAX_RUN){
const int run1= run - rl->max_run[last][abs_level] - 1; const int run1= run - rl->max_run[last][abs_level] - 1;
if(abs_level <= rl->max_level[last][run]){ if(abs_level <= rl->max_level[last][run]){
fprintf(stderr, "illegal 3. esc, vlc encoding possible\n"); av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n");
return -1; return -1;
} }
if(s->error_resilience > FF_ER_COMPLIANT){ if(s->error_resilience > FF_ER_COMPLIANT){
@ -4137,7 +4137,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
if (i > 62){ if (i > 62){
i-= 192; i-= 192;
if(i&(~63)){ if(i&(~63)){
fprintf(stderr, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
@ -4190,7 +4190,7 @@ int h263_decode_picture_header(MpegEncContext *s)
} }
if (startcode != 0x20) { if (startcode != 0x20) {
fprintf(stderr, "Bad picture start code\n"); av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
return -1; return -1;
} }
/* temporal reference */ /* temporal reference */
@ -4199,11 +4199,11 @@ int h263_decode_picture_header(MpegEncContext *s)
/* PTYPE starts here */ /* PTYPE starts here */
if (get_bits1(&s->gb) != 1) { if (get_bits1(&s->gb) != 1) {
/* marker */ /* marker */
fprintf(stderr, "Bad marker\n"); av_log(s->avctx, AV_LOG_ERROR, "Bad marker\n");
return -1; return -1;
} }
if (get_bits1(&s->gb) != 0) { if (get_bits1(&s->gb) != 0) {
fprintf(stderr, "Bad H263 id\n"); av_log(s->avctx, AV_LOG_ERROR, "Bad H263 id\n");
return -1; /* h263 id */ return -1; /* h263 id */
} }
skip_bits1(&s->gb); /* split screen off */ skip_bits1(&s->gb); /* split screen off */
@ -4235,7 +4235,7 @@ int h263_decode_picture_header(MpegEncContext *s)
s->h263_long_vectors = s->unrestricted_mv; s->h263_long_vectors = s->unrestricted_mv;
if (get_bits1(&s->gb) != 0) { if (get_bits1(&s->gb) != 0) {
fprintf(stderr, "H263 SAC not supported\n"); av_log(s->avctx, AV_LOG_ERROR, "H263 SAC not supported\n");
return -1; /* SAC: off */ return -1; /* SAC: off */
} }
if (get_bits1(&s->gb) != 0) { if (get_bits1(&s->gb) != 0) {
@ -4243,7 +4243,7 @@ int h263_decode_picture_header(MpegEncContext *s)
} }
if (get_bits1(&s->gb) != 0) { if (get_bits1(&s->gb) != 0) {
fprintf(stderr, "H263 PB frame not supported\n"); av_log(s->avctx, AV_LOG_ERROR, "H263 PB frame not supported\n");
return -1; /* not PB frame */ return -1; /* not PB frame */
} }
s->qscale = get_bits(&s->gb, 5); s->qscale = get_bits(&s->gb, 5);
@ -4275,29 +4275,29 @@ int h263_decode_picture_header(MpegEncContext *s)
} }
if (get_bits1(&s->gb) != 0) { if (get_bits1(&s->gb) != 0) {
fprintf(stderr, "Deblocking Filter not supported\n"); av_log(s->avctx, AV_LOG_ERROR, "Deblocking Filter not supported\n");
} }
if (get_bits1(&s->gb) != 0) { if (get_bits1(&s->gb) != 0) {
fprintf(stderr, "Slice Structured not supported\n"); av_log(s->avctx, AV_LOG_ERROR, "Slice Structured not supported\n");
} }
if (get_bits1(&s->gb) != 0) { if (get_bits1(&s->gb) != 0) {
fprintf(stderr, "Reference Picture Selection not supported\n"); av_log(s->avctx, AV_LOG_ERROR, "Reference Picture Selection not supported\n");
} }
if (get_bits1(&s->gb) != 0) { if (get_bits1(&s->gb) != 0) {
fprintf(stderr, "Independent Segment Decoding not supported\n"); av_log(s->avctx, AV_LOG_ERROR, "Independent Segment Decoding not supported\n");
} }
if (get_bits1(&s->gb) != 0) { if (get_bits1(&s->gb) != 0) {
fprintf(stderr, "Alternative Inter VLC not supported\n"); av_log(s->avctx, AV_LOG_ERROR, "Alternative Inter VLC not supported\n");
} }
if (get_bits1(&s->gb) != 0) { if (get_bits1(&s->gb) != 0) {
fprintf(stderr, "Modified Quantization not supported\n"); av_log(s->avctx, AV_LOG_ERROR, "Modified Quantization not supported\n");
} }
skip_bits(&s->gb, 1); /* Prevent start code emulation */ skip_bits(&s->gb, 1); /* Prevent start code emulation */
skip_bits(&s->gb, 3); /* Reserved */ skip_bits(&s->gb, 3); /* Reserved */
} else if (ufep != 0) { } else if (ufep != 0) {
fprintf(stderr, "Bad UFEP type (%d)\n", ufep); av_log(s->avctx, AV_LOG_ERROR, "Bad UFEP type (%d)\n", ufep);
return -1; return -1;
} }
@ -4371,7 +4371,7 @@ int h263_decode_picture_header(MpegEncContext *s)
} }
if(s->avctx->debug&FF_DEBUG_PICT_INFO){ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
printf("qp:%d %c size:%d rnd:%d %s %s %s %s\n", av_log(s->avctx, AV_LOG_DEBUG, "qp:%d %c size:%d rnd:%d %s %s %s %s\n",
s->qscale, av_get_pict_type_char(s->pict_type), s->qscale, av_get_pict_type_char(s->pict_type),
s->gb.size_in_bits, 1-s->no_rounding, s->gb.size_in_bits, 1-s->no_rounding,
s->mv_type == MV_TYPE_8X8 ? "ADV" : "", s->mv_type == MV_TYPE_8X8 ? "ADV" : "",
@ -4383,17 +4383,17 @@ int h263_decode_picture_header(MpegEncContext *s)
#if 1 #if 1
if (s->pict_type == I_TYPE && s->avctx->codec_tag == ff_get_fourcc("ZYGO")){ if (s->pict_type == I_TYPE && s->avctx->codec_tag == ff_get_fourcc("ZYGO")){
int i,j; int i,j;
for(i=0; i<85; i++) printf("%d", get_bits1(&s->gb)); for(i=0; i<85; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
printf("\n"); av_log(s->avctx, AV_LOG_DEBUG, "\n");
for(i=0; i<13; i++){ for(i=0; i<13; i++){
for(j=0; j<3; j++){ for(j=0; j<3; j++){
int v= get_bits(&s->gb, 8); int v= get_bits(&s->gb, 8);
v |= get_sbits(&s->gb, 8)<<8; v |= get_sbits(&s->gb, 8)<<8;
printf(" %5d", v); av_log(s->avctx, AV_LOG_DEBUG, " %5d", v);
} }
printf("\n"); av_log(s->avctx, AV_LOG_DEBUG, "\n");
} }
for(i=0; i<50; i++) printf("%d", get_bits1(&s->gb)); for(i=0; i<50; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
} }
#endif #endif
@ -4649,7 +4649,7 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
if ((s->vol_control_parameters=get_bits1(gb))) { /* vol control parameter */ if ((s->vol_control_parameters=get_bits1(gb))) { /* vol control parameter */
int chroma_format= get_bits(gb, 2); int chroma_format= get_bits(gb, 2);
if(chroma_format!=1){ if(chroma_format!=1){
printf("illegal chroma format\n"); av_log(s->avctx, AV_LOG_ERROR, "illegal chroma format\n");
} }
s->low_delay= get_bits1(gb); s->low_delay= get_bits1(gb);
if(get_bits1(gb)){ /* vbv parameters */ if(get_bits1(gb)){ /* vbv parameters */
@ -4672,9 +4672,9 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
} }
s->shape = get_bits(gb, 2); /* vol shape */ s->shape = get_bits(gb, 2); /* vol shape */
if(s->shape != RECT_SHAPE) printf("only rectangular vol supported\n"); if(s->shape != RECT_SHAPE) av_log(s->avctx, AV_LOG_ERROR, "only rectangular vol supported\n");
if(s->shape == GRAY_SHAPE && vo_ver_id != 1){ if(s->shape == GRAY_SHAPE && vo_ver_id != 1){
printf("Gray shape not supported\n"); av_log(s->avctx, AV_LOG_ERROR, "Gray shape not supported\n");
skip_bits(gb, 4); //video_object_layer_shape_extension skip_bits(gb, 4); //video_object_layer_shape_extension
} }
@ -4708,13 +4708,13 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
s->progressive_sequence= get_bits1(gb)^1; s->progressive_sequence= get_bits1(gb)^1;
if(!get_bits1(gb) && (s->avctx->debug & FF_DEBUG_PICT_INFO)) if(!get_bits1(gb) && (s->avctx->debug & FF_DEBUG_PICT_INFO))
printf("OBMC not supported (very likely buggy encoder)\n"); /* OBMC Disable */ av_log(s->avctx, AV_LOG_ERROR, "OBMC not supported (very likely buggy encoder)\n"); /* OBMC Disable */
if (vo_ver_id == 1) { if (vo_ver_id == 1) {
s->vol_sprite_usage = get_bits1(gb); /* vol_sprite_usage */ s->vol_sprite_usage = get_bits1(gb); /* vol_sprite_usage */
} else { } else {
s->vol_sprite_usage = get_bits(gb, 2); /* vol_sprite_usage */ s->vol_sprite_usage = get_bits(gb, 2); /* vol_sprite_usage */
} }
if(s->vol_sprite_usage==STATIC_SPRITE) printf("Static Sprites not supported\n"); if(s->vol_sprite_usage==STATIC_SPRITE) av_log(s->avctx, AV_LOG_ERROR, "Static Sprites not supported\n");
if(s->vol_sprite_usage==STATIC_SPRITE || s->vol_sprite_usage==GMC_SPRITE){ if(s->vol_sprite_usage==STATIC_SPRITE || s->vol_sprite_usage==GMC_SPRITE){
if(s->vol_sprite_usage==STATIC_SPRITE){ if(s->vol_sprite_usage==STATIC_SPRITE){
s->sprite_width = get_bits(gb, 13); s->sprite_width = get_bits(gb, 13);
@ -4736,8 +4736,8 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
if (get_bits1(gb) == 1) { /* not_8_bit */ if (get_bits1(gb) == 1) { /* not_8_bit */
s->quant_precision = get_bits(gb, 4); /* quant_precision */ s->quant_precision = get_bits(gb, 4); /* quant_precision */
if(get_bits(gb, 4)!=8) printf("N-bit not supported\n"); /* bits_per_pixel */ if(get_bits(gb, 4)!=8) av_log(s->avctx, AV_LOG_ERROR, "N-bit not supported\n"); /* bits_per_pixel */
if(s->quant_precision!=5) printf("quant precission %d\n", s->quant_precision); if(s->quant_precision!=5) av_log(s->avctx, AV_LOG_ERROR, "quant precission %d\n", s->quant_precision);
} else { } else {
s->quant_precision = 5; s->quant_precision = 5;
} }
@ -4810,7 +4810,7 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
s->quarter_sample= get_bits1(gb); s->quarter_sample= get_bits1(gb);
else s->quarter_sample=0; else s->quarter_sample=0;
if(!get_bits1(gb)) printf("Complexity estimation not supported\n"); if(!get_bits1(gb)) av_log(s->avctx, AV_LOG_ERROR, "Complexity estimation not supported\n");
s->resync_marker= !get_bits1(gb); /* resync_marker_disabled */ s->resync_marker= !get_bits1(gb); /* resync_marker_disabled */
@ -4822,12 +4822,12 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
if(vo_ver_id != 1) { if(vo_ver_id != 1) {
s->new_pred= get_bits1(gb); s->new_pred= get_bits1(gb);
if(s->new_pred){ if(s->new_pred){
printf("new pred not supported\n"); av_log(s->avctx, AV_LOG_ERROR, "new pred not supported\n");
skip_bits(gb, 2); /* requested upstream message type */ skip_bits(gb, 2); /* requested upstream message type */
skip_bits1(gb); /* newpred segment type */ skip_bits1(gb); /* newpred segment type */
} }
s->reduced_res_vop= get_bits1(gb); s->reduced_res_vop= get_bits1(gb);
if(s->reduced_res_vop) printf("reduced resolution VOP not supported\n"); if(s->reduced_res_vop) av_log(s->avctx, AV_LOG_ERROR, "reduced resolution VOP not supported\n");
} }
else{ else{
s->new_pred=0; s->new_pred=0;
@ -4862,7 +4862,7 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
*gb= bak; *gb= bak;
}else }else
printf("scalability not supported\n"); av_log(s->avctx, AV_LOG_ERROR, "scalability not supported\n");
// bin shape stuff FIXME // bin shape stuff FIXME
} }
@ -4929,7 +4929,7 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
s->pict_type = get_bits(gb, 2) + I_TYPE; /* pict type: I = 0 , P = 1 */ s->pict_type = get_bits(gb, 2) + I_TYPE; /* pict type: I = 0 , P = 1 */
if(s->pict_type==B_TYPE && s->low_delay && s->vol_control_parameters==0 && !(s->flags & CODEC_FLAG_LOW_DELAY)){ if(s->pict_type==B_TYPE && s->low_delay && s->vol_control_parameters==0 && !(s->flags & CODEC_FLAG_LOW_DELAY)){
printf("low_delay flag set, but shouldnt, clearing it\n"); av_log(s->avctx, AV_LOG_ERROR, "low_delay flag set, but shouldnt, clearing it\n");
s->low_delay=0; s->low_delay=0;
} }
@ -4950,13 +4950,13 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
check_marker(gb, "before time_increment"); check_marker(gb, "before time_increment");
if(s->time_increment_bits==0){ if(s->time_increment_bits==0){
printf("hmm, seems the headers arnt complete, trying to guess time_increment_bits\n"); av_log(s->avctx, AV_LOG_ERROR, "hmm, seems the headers arnt complete, trying to guess time_increment_bits\n");
for(s->time_increment_bits=1 ;s->time_increment_bits<16; s->time_increment_bits++){ for(s->time_increment_bits=1 ;s->time_increment_bits<16; s->time_increment_bits++){
if(show_bits(gb, s->time_increment_bits+1)&1) break; if(show_bits(gb, s->time_increment_bits+1)&1) break;
} }
printf("my guess is %d bits ;)\n",s->time_increment_bits); av_log(s->avctx, AV_LOG_ERROR, "my guess is %d bits ;)\n",s->time_increment_bits);
} }
if(IS_3IV1) time_increment= get_bits1(gb); //FIXME investigate further if(IS_3IV1) time_increment= get_bits1(gb); //FIXME investigate further
@ -4996,13 +4996,13 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
s->current_picture_ptr->pts= s->time*1000LL*1000LL / s->time_increment_resolution; s->current_picture_ptr->pts= s->time*1000LL*1000LL / s->time_increment_resolution;
if(s->avctx->debug&FF_DEBUG_PTS) if(s->avctx->debug&FF_DEBUG_PTS)
printf("MPEG4 PTS: %f\n", s->current_picture_ptr->pts/(1000.0*1000.0)); av_log(s->avctx, AV_LOG_DEBUG, "MPEG4 PTS: %f\n", s->current_picture_ptr->pts/(1000.0*1000.0));
check_marker(gb, "before vop_coded"); check_marker(gb, "before vop_coded");
/* vop coded */ /* vop coded */
if (get_bits1(gb) != 1){ if (get_bits1(gb) != 1){
printf("vop not coded\n"); av_log(s->avctx, AV_LOG_ERROR, "vop not coded\n");
return FRAME_SKIPED; return FRAME_SKIPED;
} }
//printf("time %d %d %d || %Ld %Ld %Ld\n", s->time_increment_bits, s->time_increment_resolution, s->time_base, //printf("time %d %d %d || %Ld %Ld %Ld\n", s->time_increment_bits, s->time_increment_resolution, s->time_base,
@ -5059,21 +5059,21 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
if(s->pict_type == S_TYPE && (s->vol_sprite_usage==STATIC_SPRITE || s->vol_sprite_usage==GMC_SPRITE)){ if(s->pict_type == S_TYPE && (s->vol_sprite_usage==STATIC_SPRITE || s->vol_sprite_usage==GMC_SPRITE)){
mpeg4_decode_sprite_trajectory(s); mpeg4_decode_sprite_trajectory(s);
if(s->sprite_brightness_change) printf("sprite_brightness_change not supported\n"); if(s->sprite_brightness_change) av_log(s->avctx, AV_LOG_ERROR, "sprite_brightness_change not supported\n");
if(s->vol_sprite_usage==STATIC_SPRITE) printf("static sprite not supported\n"); if(s->vol_sprite_usage==STATIC_SPRITE) av_log(s->avctx, AV_LOG_ERROR, "static sprite not supported\n");
} }
if (s->shape != BIN_ONLY_SHAPE) { if (s->shape != BIN_ONLY_SHAPE) {
s->qscale = get_bits(gb, s->quant_precision); s->qscale = get_bits(gb, s->quant_precision);
if(s->qscale==0){ if(s->qscale==0){
printf("Error, header damaged or not MPEG4 header (qscale=0)\n"); av_log(s->avctx, AV_LOG_ERROR, "Error, header damaged or not MPEG4 header (qscale=0)\n");
return -1; // makes no sense to continue, as there is nothing left from the image then return -1; // makes no sense to continue, as there is nothing left from the image then
} }
if (s->pict_type != I_TYPE) { if (s->pict_type != I_TYPE) {
s->f_code = get_bits(gb, 3); /* fcode_for */ s->f_code = get_bits(gb, 3); /* fcode_for */
if(s->f_code==0){ if(s->f_code==0){
printf("Error, header damaged or not MPEG4 header (f_code=0)\n"); av_log(s->avctx, AV_LOG_ERROR, "Error, header damaged or not MPEG4 header (f_code=0)\n");
return -1; // makes no sense to continue, as the MV decoding will break very quickly return -1; // makes no sense to continue, as the MV decoding will break very quickly
} }
}else }else
@ -5085,7 +5085,7 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
s->b_code=1; s->b_code=1;
if(s->avctx->debug&FF_DEBUG_PICT_INFO){ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
printf("qp:%d fc:%d,%d %s size:%d pro:%d alt:%d top:%d %spel part:%d resync:%d w:%d a:%d rnd:%d vot:%d%s dc:%d\n", av_log(s->avctx, AV_LOG_DEBUG, "qp:%d fc:%d,%d %s size:%d pro:%d alt:%d top:%d %spel part:%d resync:%d w:%d a:%d rnd:%d vot:%d%s dc:%d\n",
s->qscale, s->f_code, s->b_code, 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")), s->pict_type == I_TYPE ? "I" : (s->pict_type == P_TYPE ? "P" : (s->pict_type == B_TYPE ? "B" : "S")),
gb->size_in_bits,s->progressive_sequence, s->alternate_scan, s->top_field_first, gb->size_in_bits,s->progressive_sequence, s->alternate_scan, s->top_field_first,
@ -5101,7 +5101,7 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
if(s->enhancement_type){ if(s->enhancement_type){
int load_backward_shape= get_bits1(gb); int load_backward_shape= get_bits1(gb);
if(load_backward_shape){ if(load_backward_shape){
printf("load backward shape isnt supported\n"); av_log(s->avctx, AV_LOG_ERROR, "load backward shape isnt supported\n");
} }
} }
skip_bits(gb, 2); //ref_select_code skip_bits(gb, 2); //ref_select_code
@ -5110,7 +5110,7 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
/* detect buggy encoders which dont set the low_delay flag (divx4/xvid/opendivx)*/ /* detect buggy encoders which dont set the low_delay flag (divx4/xvid/opendivx)*/
// note we cannot detect divx5 without b-frames easyly (allthough its buggy too) // note we cannot detect divx5 without b-frames easyly (allthough its buggy too)
if(s->vo_type==0 && s->vol_control_parameters==0 && s->divx_version==0 && s->picture_number==0){ if(s->vo_type==0 && s->vol_control_parameters==0 && s->divx_version==0 && s->picture_number==0){
printf("looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n"); av_log(s->avctx, AV_LOG_ERROR, "looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n");
s->low_delay=1; s->low_delay=1;
} }
@ -5145,7 +5145,7 @@ int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb)
if(get_bits_count(gb) >= gb->size_in_bits){ if(get_bits_count(gb) >= gb->size_in_bits){
if(gb->size_in_bits==8 && s->divx_version){ if(gb->size_in_bits==8 && s->divx_version){
printf("frame skip %d\n", gb->size_in_bits); av_log(s->avctx, AV_LOG_ERROR, "frame skip %d\n", gb->size_in_bits);
return FRAME_SKIPED; //divx bug return FRAME_SKIPED; //divx bug
}else }else
return -1; //end of stream return -1; //end of stream
@ -5155,35 +5155,35 @@ int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb)
continue; //no startcode continue; //no startcode
if(s->avctx->debug&FF_DEBUG_STARTCODE){ if(s->avctx->debug&FF_DEBUG_STARTCODE){
printf("startcode: %3X ", startcode); av_log(s->avctx, AV_LOG_DEBUG, "startcode: %3X ", startcode);
if (startcode<=0x11F) printf("Video Object Start"); if (startcode<=0x11F) av_log(s->avctx, AV_LOG_DEBUG, "Video Object Start");
else if(startcode<=0x12F) printf("Video Object Layer Start"); else if(startcode<=0x12F) av_log(s->avctx, AV_LOG_DEBUG, "Video Object Layer Start");
else if(startcode<=0x13F) printf("Reserved"); else if(startcode<=0x13F) av_log(s->avctx, AV_LOG_DEBUG, "Reserved");
else if(startcode<=0x15F) printf("FGS bp start"); else if(startcode<=0x15F) av_log(s->avctx, AV_LOG_DEBUG, "FGS bp start");
else if(startcode<=0x1AF) printf("Reserved"); else if(startcode<=0x1AF) av_log(s->avctx, AV_LOG_DEBUG, "Reserved");
else if(startcode==0x1B0) printf("Visual Object Seq Start"); else if(startcode==0x1B0) av_log(s->avctx, AV_LOG_DEBUG, "Visual Object Seq Start");
else if(startcode==0x1B1) printf("Visual Object Seq End"); else if(startcode==0x1B1) av_log(s->avctx, AV_LOG_DEBUG, "Visual Object Seq End");
else if(startcode==0x1B2) printf("User Data"); else if(startcode==0x1B2) av_log(s->avctx, AV_LOG_DEBUG, "User Data");
else if(startcode==0x1B3) printf("Group of VOP start"); else if(startcode==0x1B3) av_log(s->avctx, AV_LOG_DEBUG, "Group of VOP start");
else if(startcode==0x1B4) printf("Video Session Error"); else if(startcode==0x1B4) av_log(s->avctx, AV_LOG_DEBUG, "Video Session Error");
else if(startcode==0x1B5) printf("Visual Object Start"); else if(startcode==0x1B5) av_log(s->avctx, AV_LOG_DEBUG, "Visual Object Start");
else if(startcode==0x1B6) printf("Video Object Plane start"); else if(startcode==0x1B6) av_log(s->avctx, AV_LOG_DEBUG, "Video Object Plane start");
else if(startcode==0x1B7) printf("slice start"); else if(startcode==0x1B7) av_log(s->avctx, AV_LOG_DEBUG, "slice start");
else if(startcode==0x1B8) printf("extension start"); else if(startcode==0x1B8) av_log(s->avctx, AV_LOG_DEBUG, "extension start");
else if(startcode==0x1B9) printf("fgs start"); else if(startcode==0x1B9) av_log(s->avctx, AV_LOG_DEBUG, "fgs start");
else if(startcode==0x1BA) printf("FBA Object start"); else if(startcode==0x1BA) av_log(s->avctx, AV_LOG_DEBUG, "FBA Object start");
else if(startcode==0x1BB) printf("FBA Object Plane start"); else if(startcode==0x1BB) av_log(s->avctx, AV_LOG_DEBUG, "FBA Object Plane start");
else if(startcode==0x1BC) printf("Mesh Object start"); else if(startcode==0x1BC) av_log(s->avctx, AV_LOG_DEBUG, "Mesh Object start");
else if(startcode==0x1BD) printf("Mesh Object Plane start"); else if(startcode==0x1BD) av_log(s->avctx, AV_LOG_DEBUG, "Mesh Object Plane start");
else if(startcode==0x1BE) printf("Still Textutre Object start"); else if(startcode==0x1BE) av_log(s->avctx, AV_LOG_DEBUG, "Still Textutre Object start");
else if(startcode==0x1BF) printf("Textutre Spatial Layer start"); else if(startcode==0x1BF) av_log(s->avctx, AV_LOG_DEBUG, "Textutre Spatial Layer start");
else if(startcode==0x1C0) printf("Textutre SNR Layer start"); else if(startcode==0x1C0) av_log(s->avctx, AV_LOG_DEBUG, "Textutre SNR Layer start");
else if(startcode==0x1C1) printf("Textutre Tile start"); else if(startcode==0x1C1) av_log(s->avctx, AV_LOG_DEBUG, "Textutre Tile start");
else if(startcode==0x1C2) printf("Textutre Shape Layer start"); else if(startcode==0x1C2) av_log(s->avctx, AV_LOG_DEBUG, "Textutre Shape Layer start");
else if(startcode==0x1C3) printf("stuffing start"); else if(startcode==0x1C3) av_log(s->avctx, AV_LOG_DEBUG, "stuffing start");
else if(startcode<=0x1C5) printf("reserved"); else if(startcode<=0x1C5) av_log(s->avctx, AV_LOG_DEBUG, "reserved");
else if(startcode<=0x1FF) printf("System start"); else if(startcode<=0x1FF) av_log(s->avctx, AV_LOG_DEBUG, "System start");
printf(" at %d\n", get_bits_count(gb)); av_log(s->avctx, AV_LOG_DEBUG, " at %d\n", get_bits_count(gb));
} }
if(startcode >= 0x120 && startcode <= 0x12F){ if(startcode >= 0x120 && startcode <= 0x12F){
@ -5212,17 +5212,17 @@ int intel_h263_decode_picture_header(MpegEncContext *s)
/* picture header */ /* picture header */
if (get_bits_long(&s->gb, 22) != 0x20) { if (get_bits_long(&s->gb, 22) != 0x20) {
fprintf(stderr, "Bad picture start code\n"); av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
return -1; return -1;
} }
s->picture_number = get_bits(&s->gb, 8); /* picture timestamp */ s->picture_number = get_bits(&s->gb, 8); /* picture timestamp */
if (get_bits1(&s->gb) != 1) { if (get_bits1(&s->gb) != 1) {
fprintf(stderr, "Bad marker\n"); av_log(s->avctx, AV_LOG_ERROR, "Bad marker\n");
return -1; /* marker */ return -1; /* marker */
} }
if (get_bits1(&s->gb) != 0) { if (get_bits1(&s->gb) != 0) {
fprintf(stderr, "Bad H263 id\n"); av_log(s->avctx, AV_LOG_ERROR, "Bad H263 id\n");
return -1; /* h263 id */ return -1; /* h263 id */
} }
skip_bits1(&s->gb); /* split screen off */ skip_bits1(&s->gb); /* split screen off */
@ -5231,7 +5231,7 @@ int intel_h263_decode_picture_header(MpegEncContext *s)
format = get_bits(&s->gb, 3); format = get_bits(&s->gb, 3);
if (format != 7) { if (format != 7) {
fprintf(stderr, "Intel H263 free format not supported\n"); av_log(s->avctx, AV_LOG_ERROR, "Intel H263 free format not supported\n");
return -1; return -1;
} }
s->h263_plus = 0; s->h263_plus = 0;
@ -5242,15 +5242,15 @@ int intel_h263_decode_picture_header(MpegEncContext *s)
s->h263_long_vectors = s->unrestricted_mv; s->h263_long_vectors = s->unrestricted_mv;
if (get_bits1(&s->gb) != 0) { if (get_bits1(&s->gb) != 0) {
fprintf(stderr, "SAC not supported\n"); av_log(s->avctx, AV_LOG_ERROR, "SAC not supported\n");
return -1; /* SAC: off */ return -1; /* SAC: off */
} }
if (get_bits1(&s->gb) != 0) { if (get_bits1(&s->gb) != 0) {
fprintf(stderr, "Advanced Prediction Mode not supported\n"); av_log(s->avctx, AV_LOG_ERROR, "Advanced Prediction Mode not supported\n");
return -1; /* advanced prediction mode: off */ return -1; /* advanced prediction mode: off */
} }
if (get_bits1(&s->gb) != 0) { if (get_bits1(&s->gb) != 0) {
fprintf(stderr, "PB frame mode no supported\n"); av_log(s->avctx, AV_LOG_ERROR, "PB frame mode no supported\n");
return -1; /* PB frame mode */ return -1; /* PB frame mode */
} }
@ -5278,12 +5278,12 @@ int flv_h263_decode_picture_header(MpegEncContext *s)
/* picture header */ /* picture header */
if (get_bits_long(&s->gb, 17) != 1) { if (get_bits_long(&s->gb, 17) != 1) {
fprintf(stderr, "Bad picture start code\n"); av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
return -1; return -1;
} }
format = get_bits(&s->gb, 5); format = get_bits(&s->gb, 5);
if (format != 0 && format != 1) { if (format != 0 && format != 1) {
fprintf(stderr, "Bad picture format\n"); av_log(s->avctx, AV_LOG_ERROR, "Bad picture format\n");
return -1; return -1;
} }
s->h263_flv = format+1; s->h263_flv = format+1;
@ -5345,7 +5345,7 @@ int flv_h263_decode_picture_header(MpegEncContext *s)
s->f_code = 1; s->f_code = 1;
if(s->avctx->debug & FF_DEBUG_PICT_INFO){ if(s->avctx->debug & FF_DEBUG_PICT_INFO){
printf("%c esc_type:%d, qp:%d num:%d\n", av_log(s->avctx, AV_LOG_DEBUG, "%c esc_type:%d, qp:%d num:%d\n",
av_get_pict_type_char(s->pict_type), s->h263_flv-1, s->qscale, s->picture_number); av_get_pict_type_char(s->pict_type), s->h263_flv-1, s->qscale, s->picture_number);
} }

@ -219,11 +219,11 @@ static int decode_slice(MpegEncContext *s){
} }
return 0; return 0;
}else if(ret==SLICE_NOEND){ }else if(ret==SLICE_NOEND){
fprintf(stderr,"Slice mismatch at MB: %d\n", xy); av_log(s->avctx, AV_LOG_ERROR, "Slice mismatch at MB: %d\n", xy);
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);
return -1; return -1;
} }
fprintf(stderr,"Error at MB: %d\n", xy); av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", xy);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
return -1; return -1;
@ -281,17 +281,17 @@ static int decode_slice(MpegEncContext *s){
max_extra+= 256*256*256*64; max_extra+= 256*256*256*64;
if(left>max_extra){ if(left>max_extra){
fprintf(stderr, "discarding %d junk bits at end, next would be %X\n", left, show_bits(&s->gb, 24)); av_log(s->avctx, AV_LOG_ERROR, "discarding %d junk bits at end, next would be %X\n", left, show_bits(&s->gb, 24));
} }
else if(left<0){ else if(left<0){
fprintf(stderr, "overreading %d bits\n", -left); av_log(s->avctx, AV_LOG_ERROR, "overreading %d bits\n", -left);
}else }else
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); 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);
return 0; return 0;
} }
fprintf(stderr, "slice end not reached but screenspace end (%d left %06X, score= %d)\n", av_log(s->avctx, AV_LOG_ERROR, "slice end not reached but screenspace end (%d left %06X, score= %d)\n",
s->gb.size_in_bits - get_bits_count(&s->gb), s->gb.size_in_bits - get_bits_count(&s->gb),
show_bits(&s->gb, 24), s->padding_bug_score); show_bits(&s->gb, 24), s->padding_bug_score);
@ -415,7 +415,7 @@ uint64_t time= rdtsc();
}else if(s->codec_id==CODEC_ID_H263){ }else if(s->codec_id==CODEC_ID_H263){
next= h263_find_frame_end(s, buf, buf_size); next= h263_find_frame_end(s, buf, buf_size);
}else{ }else{
fprintf(stderr, "this codec doesnt support truncated bitstreams\n"); av_log(s->avctx, AV_LOG_ERROR, "this codec doesnt support truncated bitstreams\n");
return -1; return -1;
} }
@ -470,7 +470,7 @@ retry:
/* skip if the header was thrashed */ /* skip if the header was thrashed */
if (ret < 0){ if (ret < 0){
fprintf(stderr, "header damaged\n"); av_log(s->avctx, AV_LOG_ERROR, "header damaged\n");
return -1; return -1;
} }
@ -580,7 +580,7 @@ retry:
} }
if(avctx->debug & FF_DEBUG_BUGS) if(avctx->debug & FF_DEBUG_BUGS)
printf("bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n", av_log(s->avctx, AV_LOG_DEBUG, "bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n",
s->workaround_bugs, s->lavc_build, s->xvid_build, s->divx_version, s->divx_build, s->workaround_bugs, s->lavc_build, s->xvid_build, s->divx_version, s->divx_build,
s->divx_packed ? "p" : ""); s->divx_packed ? "p" : "");

@ -643,7 +643,7 @@ static inline int check_intra4x4_pred_mode(H264Context *h){
for(i=0; i<4; i++){ for(i=0; i<4; i++){
int status= top[ h->intra4x4_pred_mode_cache[scan8[0] + i] ]; int status= top[ h->intra4x4_pred_mode_cache[scan8[0] + i] ];
if(status<0){ if(status<0){
fprintf(stderr, "top block unavailable for requested intra4x4 mode %d at %d %d\n", status, s->mb_x, s->mb_y); av_log(h->s.avctx, AV_LOG_ERROR, "top block unavailable for requested intra4x4 mode %d at %d %d\n", status, s->mb_x, s->mb_y);
return -1; return -1;
} else if(status){ } else if(status){
h->intra4x4_pred_mode_cache[scan8[0] + i]= status; h->intra4x4_pred_mode_cache[scan8[0] + i]= status;
@ -655,7 +655,7 @@ static inline int check_intra4x4_pred_mode(H264Context *h){
for(i=0; i<4; i++){ for(i=0; i<4; i++){
int status= left[ h->intra4x4_pred_mode_cache[scan8[0] + 8*i] ]; int status= left[ h->intra4x4_pred_mode_cache[scan8[0] + 8*i] ];
if(status<0){ if(status<0){
fprintf(stderr, "left block unavailable for requested intra4x4 mode %d at %d %d\n", status, s->mb_x, s->mb_y); av_log(h->s.avctx, AV_LOG_ERROR, "left block unavailable for requested intra4x4 mode %d at %d %d\n", status, s->mb_x, s->mb_y);
return -1; return -1;
} else if(status){ } else if(status){
h->intra4x4_pred_mode_cache[scan8[0] + 8*i]= status; h->intra4x4_pred_mode_cache[scan8[0] + 8*i]= status;
@ -677,7 +677,7 @@ static inline int check_intra_pred_mode(H264Context *h, int mode){
if(!(h->top_samples_available&0x8000)){ if(!(h->top_samples_available&0x8000)){
mode= top[ mode ]; mode= top[ mode ];
if(mode<0){ if(mode<0){
fprintf(stderr, "top block unavailable for requested intra mode at %d %d\n", s->mb_x, s->mb_y); av_log(h->s.avctx, AV_LOG_ERROR, "top block unavailable for requested intra mode at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
} }
@ -685,7 +685,7 @@ static inline int check_intra_pred_mode(H264Context *h, int mode){
if(!(h->left_samples_available&0x8000)){ if(!(h->left_samples_available&0x8000)){
mode= left[ mode ]; mode= left[ mode ];
if(mode<0){ if(mode<0){
fprintf(stderr, "left block unavailable for requested intra mode at %d %d\n", s->mb_x, s->mb_y); av_log(h->s.avctx, AV_LOG_ERROR, "left block unavailable for requested intra mode at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
} }
@ -2447,7 +2447,7 @@ static int decode_ref_pic_list_reordering(H264Context *h){
if(index >= h->ref_count[list]){ if(index >= h->ref_count[list]){
fprintf(stderr, "reference count overflow\n"); av_log(h->s.avctx, AV_LOG_ERROR, "reference count overflow\n");
return -1; return -1;
} }
@ -2456,7 +2456,7 @@ static int decode_ref_pic_list_reordering(H264Context *h){
const int abs_diff_pic_num= get_ue_golomb(&s->gb) + 1; const int abs_diff_pic_num= get_ue_golomb(&s->gb) + 1;
if(abs_diff_pic_num >= h->max_pic_num){ if(abs_diff_pic_num >= h->max_pic_num){
fprintf(stderr, "abs_diff_pic_num overflow\n"); av_log(h->s.avctx, AV_LOG_ERROR, "abs_diff_pic_num overflow\n");
return -1; return -1;
} }
@ -2478,7 +2478,7 @@ static int decode_ref_pic_list_reordering(H264Context *h){
} }
if(i < index){ if(i < index){
fprintf(stderr, "reference picture missing during reorder\n"); av_log(h->s.avctx, AV_LOG_ERROR, "reference picture missing during reorder\n");
memset(&h->ref_list[list][index], 0, sizeof(Picture)); //FIXME memset(&h->ref_list[list][index], 0, sizeof(Picture)); //FIXME
}else if(i > index){ }else if(i > index){
Picture tmp= h->ref_list[list][i]; Picture tmp= h->ref_list[list][i];
@ -2490,7 +2490,7 @@ static int decode_ref_pic_list_reordering(H264Context *h){
}else if(reordering_of_pic_nums_idc==3) }else if(reordering_of_pic_nums_idc==3)
break; break;
else{ else{
fprintf(stderr, "illegal reordering_of_pic_nums_idc\n"); av_log(h->s.avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc\n");
return -1; return -1;
} }
} }
@ -2560,12 +2560,12 @@ static Picture * remove_short(H264Context *h, int frame_num){
int i; int i;
if(s->avctx->debug&FF_DEBUG_MMCO) if(s->avctx->debug&FF_DEBUG_MMCO)
printf("remove short %d count %d\n", frame_num, h->short_ref_count); av_log(h->s.avctx, AV_LOG_DEBUG, "remove short %d count %d\n", frame_num, h->short_ref_count);
for(i=0; i<h->short_ref_count; i++){ for(i=0; i<h->short_ref_count; i++){
Picture *pic= h->short_ref[i]; Picture *pic= h->short_ref[i];
if(s->avctx->debug&FF_DEBUG_MMCO) if(s->avctx->debug&FF_DEBUG_MMCO)
printf("%d %d %p\n", i, pic->frame_num, pic); av_log(h->s.avctx, AV_LOG_DEBUG, "%d %d %p\n", i, pic->frame_num, pic);
if(pic->frame_num == frame_num){ if(pic->frame_num == frame_num){
h->short_ref[i]= NULL; h->short_ref[i]= NULL;
memmove(&h->short_ref[i], &h->short_ref[i+1], (h->short_ref_count - i - 1)*sizeof(Picture*)); memmove(&h->short_ref[i], &h->short_ref[i+1], (h->short_ref_count - i - 1)*sizeof(Picture*));
@ -2604,11 +2604,11 @@ static int execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
Picture *pic; Picture *pic;
if((s->avctx->debug&FF_DEBUG_MMCO) && mmco_count==0) if((s->avctx->debug&FF_DEBUG_MMCO) && mmco_count==0)
printf("no mmco here\n"); av_log(h->s.avctx, AV_LOG_DEBUG, "no mmco here\n");
for(i=0; i<mmco_count; i++){ for(i=0; i<mmco_count; i++){
if(s->avctx->debug&FF_DEBUG_MMCO) if(s->avctx->debug&FF_DEBUG_MMCO)
printf("mmco:%d %d %d\n", h->mmco[i].opcode, h->mmco[i].short_frame_num, h->mmco[i].long_index); av_log(h->s.avctx, AV_LOG_DEBUG, "mmco:%d %d %d\n", h->mmco[i].opcode, h->mmco[i].short_frame_num, h->mmco[i].long_index);
switch(mmco[i].opcode){ switch(mmco[i].opcode){
case MMCO_SHORT2UNUSED: case MMCO_SHORT2UNUSED:
@ -2666,7 +2666,7 @@ static int execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
pic= remove_short(h, s->current_picture_ptr->frame_num); pic= remove_short(h, s->current_picture_ptr->frame_num);
if(pic){ if(pic){
pic->reference=0; pic->reference=0;
fprintf(stderr, "illegal short term buffer state detected\n"); av_log(h->s.avctx, AV_LOG_ERROR, "illegal short term buffer state detected\n");
} }
if(h->short_ref_count) if(h->short_ref_count)
@ -2709,13 +2709,13 @@ static int decode_ref_pic_marking(H264Context *h){
if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){ if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){
h->mmco[i].long_index= get_ue_golomb(&s->gb); h->mmco[i].long_index= get_ue_golomb(&s->gb);
if(/*h->mmco[i].long_index >= h->long_ref_count || h->long_ref[ h->mmco[i].long_index ] == NULL*/ h->mmco[i].long_index >= 16){ if(/*h->mmco[i].long_index >= h->long_ref_count || h->long_ref[ h->mmco[i].long_index ] == NULL*/ h->mmco[i].long_index >= 16){
fprintf(stderr, "illegal long ref in memory management control operation %d\n", opcode); av_log(h->s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\n", opcode);
return -1; return -1;
} }
} }
if(opcode > MMCO_LONG){ if(opcode > MMCO_LONG){
fprintf(stderr, "illegal memory management control operation %d\n", opcode); av_log(h->s.avctx, AV_LOG_ERROR, "illegal memory management control operation %d\n", opcode);
return -1; return -1;
} }
} }
@ -2835,7 +2835,7 @@ static int decode_slice_header(H264Context *h){
h->slice_type= get_ue_golomb(&s->gb); h->slice_type= get_ue_golomb(&s->gb);
if(h->slice_type > 9){ if(h->slice_type > 9){
fprintf(stderr, "slice type too large (%d) at %d %d\n", h->slice_type, s->mb_x, s->mb_y); av_log(h->s.avctx, AV_LOG_ERROR, "slice type too large (%d) at %d %d\n", h->slice_type, s->mb_x, s->mb_y);
} }
if(h->slice_type > 4){ if(h->slice_type > 4){
h->slice_type -= 5; h->slice_type -= 5;
@ -2849,18 +2849,18 @@ static int decode_slice_header(H264Context *h){
pps_id= get_ue_golomb(&s->gb); pps_id= get_ue_golomb(&s->gb);
if(pps_id>255){ if(pps_id>255){
fprintf(stderr, "pps_id out of range\n"); av_log(h->s.avctx, AV_LOG_ERROR, "pps_id out of range\n");
return -1; return -1;
} }
h->pps= h->pps_buffer[pps_id]; h->pps= h->pps_buffer[pps_id];
if(h->pps.slice_group_count == 0){ if(h->pps.slice_group_count == 0){
fprintf(stderr, "non existing PPS referenced\n"); av_log(h->s.avctx, AV_LOG_ERROR, "non existing PPS referenced\n");
return -1; return -1;
} }
h->sps= h->sps_buffer[ h->pps.sps_id ]; h->sps= h->sps_buffer[ h->pps.sps_id ];
if(h->sps.log2_max_frame_num == 0){ if(h->sps.log2_max_frame_num == 0){
fprintf(stderr, "non existing SPS referenced\n"); av_log(h->s.avctx, AV_LOG_ERROR, "non existing SPS referenced\n");
return -1; return -1;
} }
@ -2960,7 +2960,7 @@ static int decode_slice_header(H264Context *h){
h->ref_count[1]= get_ue_golomb(&s->gb) + 1; h->ref_count[1]= get_ue_golomb(&s->gb) + 1;
if(h->ref_count[0] > 32 || h->ref_count[1] > 32){ if(h->ref_count[0] > 32 || h->ref_count[1] > 32){
fprintf(stderr, "reference overflow\n"); av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow\n");
return -1; return -1;
} }
} }
@ -3004,7 +3004,7 @@ static int decode_slice_header(H264Context *h){
#endif #endif
if(s->avctx->debug&FF_DEBUG_PICT_INFO){ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
printf("mb:%d %c pps:%d frame:%d poc:%d/%d ref:%d/%d qp:%d loop:%d\n", av_log(h->s.avctx, AV_LOG_DEBUG, "mb:%d %c pps:%d frame:%d poc:%d/%d ref:%d/%d qp:%d loop:%d\n",
first_mb_in_slice, first_mb_in_slice,
av_get_pict_type_char(h->slice_type), av_get_pict_type_char(h->slice_type),
pps_id, h->frame_num, pps_id, h->frame_num,
@ -3106,7 +3106,7 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in
level_code= (prefix<<suffix_length) + get_bits(gb, 12); //part level_code= (prefix<<suffix_length) + get_bits(gb, 12); //part
if(suffix_length==0) level_code+=15; //FIXME doesnt make (much)sense if(suffix_length==0) level_code+=15; //FIXME doesnt make (much)sense
}else{ }else{
fprintf(stderr, "prefix too large at %d %d\n", s->mb_x, s->mb_y); av_log(h->s.avctx, AV_LOG_ERROR, "prefix too large at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
@ -3147,7 +3147,7 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in
} }
if(zeros_left<0){ if(zeros_left<0){
fprintf(stderr, "negative number of zero coeffs at %d %d\n", s->mb_x, s->mb_y); av_log(h->s.avctx, AV_LOG_ERROR, "negative number of zero coeffs at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
@ -3257,7 +3257,7 @@ static int decode_mb(H264Context *h){
assert(h->slice_type == I_TYPE); assert(h->slice_type == I_TYPE);
decode_intra_mb: decode_intra_mb:
if(mb_type > 25){ if(mb_type > 25){
fprintf(stderr, "mb_type %d in %c slice to large at %d %d\n", mb_type, av_get_pict_type_char(h->slice_type), s->mb_x, s->mb_y); av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice to large at %d %d\n", mb_type, av_get_pict_type_char(h->slice_type), s->mb_x, s->mb_y);
return -1; return -1;
} }
partition_count=0; partition_count=0;
@ -3353,7 +3353,7 @@ decode_intra_mb:
for(i=0; i<4; i++){ for(i=0; i<4; i++){
h->sub_mb_type[i]= get_ue_golomb(&s->gb); h->sub_mb_type[i]= get_ue_golomb(&s->gb);
if(h->sub_mb_type[i] >=13){ if(h->sub_mb_type[i] >=13){
fprintf(stderr, "B sub_mb_type %d out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %d out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y);
return -1; return -1;
} }
sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
@ -3364,7 +3364,7 @@ decode_intra_mb:
for(i=0; i<4; i++){ for(i=0; i<4; i++){
h->sub_mb_type[i]= get_ue_golomb(&s->gb); h->sub_mb_type[i]= get_ue_golomb(&s->gb);
if(h->sub_mb_type[i] >=4){ if(h->sub_mb_type[i] >=4){
fprintf(stderr, "P sub_mb_type %d out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); av_log(h->s.avctx, AV_LOG_ERROR, "P sub_mb_type %d out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y);
return -1; return -1;
} }
sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
@ -3508,7 +3508,7 @@ decode_intra_mb:
if(!IS_INTRA16x16(mb_type)){ if(!IS_INTRA16x16(mb_type)){
cbp= get_ue_golomb(&s->gb); cbp= get_ue_golomb(&s->gb);
if(cbp > 47){ if(cbp > 47){
fprintf(stderr, "cbp too large (%d) at %d %d\n", cbp, s->mb_x, s->mb_y); av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%d) at %d %d\n", cbp, s->mb_x, s->mb_y);
return -1; return -1;
} }
@ -3537,7 +3537,7 @@ decode_intra_mb:
dquant= get_se_golomb(&s->gb); dquant= get_se_golomb(&s->gb);
if( dquant > 25 || dquant < -26 ){ if( dquant > 25 || dquant < -26 ){
fprintf(stderr, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y); av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y);
return -1; return -1;
} }
@ -3634,7 +3634,7 @@ static int decode_slice(H264Context *h){
} }
if(ret<0){ if(ret<0){
fprintf(stderr, "error while decoding MB %d %d\n", s->mb_x, s->mb_y); av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
return -1; return -1;
@ -3733,7 +3733,7 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){
}else if(aspect_ratio_idc < 16){ }else if(aspect_ratio_idc < 16){
sps->sar= pixel_aspect[aspect_ratio_idc]; sps->sar= pixel_aspect[aspect_ratio_idc];
}else{ }else{
fprintf(stderr, "illegal aspect ratio\n"); av_log(h->s.avctx, AV_LOG_ERROR, "illegal aspect ratio\n");
return -1; return -1;
} }
}else{ }else{
@ -3825,7 +3825,7 @@ static inline int decode_seq_parameter_set(H264Context *h){
sps->offset_for_ref_frame[i]= get_se_golomb(&s->gb); sps->offset_for_ref_frame[i]= get_se_golomb(&s->gb);
} }
if(sps->poc_type > 2){ if(sps->poc_type > 2){
fprintf(stderr, "illegal POC type %d\n", sps->poc_type); av_log(h->s.avctx, AV_LOG_ERROR, "illegal POC type %d\n", sps->poc_type);
return -1; return -1;
} }
@ -3848,7 +3848,7 @@ static inline int decode_seq_parameter_set(H264Context *h){
sps->crop_top = get_ue_golomb(&s->gb); sps->crop_top = get_ue_golomb(&s->gb);
sps->crop_bottom= get_ue_golomb(&s->gb); sps->crop_bottom= get_ue_golomb(&s->gb);
if(sps->crop_left || sps->crop_top){ if(sps->crop_left || sps->crop_top){
fprintf(stderr, "insane croping not completly supported, this could look slightly wrong ...\n"); av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not completly supported, this could look slightly wrong ...\n");
} }
}else{ }else{
sps->crop_left = sps->crop_left =
@ -3862,7 +3862,7 @@ static inline int decode_seq_parameter_set(H264Context *h){
decode_vui_parameters(h, sps); decode_vui_parameters(h, sps);
if(s->avctx->debug&FF_DEBUG_PICT_INFO){ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
printf("sps:%d profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%d/%d/%d/%d %s\n", av_log(h->s.avctx, AV_LOG_DEBUG, "sps:%d profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%d/%d/%d/%d %s\n",
sps_id, sps->profile_idc, sps->level_idc, sps_id, sps->profile_idc, sps->level_idc,
sps->poc_type, sps->poc_type,
sps->ref_frame_count, sps->ref_frame_count,
@ -3888,7 +3888,7 @@ static inline int decode_picture_parameter_set(H264Context *h){
pps->slice_group_count= get_ue_golomb(&s->gb) + 1; pps->slice_group_count= get_ue_golomb(&s->gb) + 1;
if(pps->slice_group_count > 1 ){ if(pps->slice_group_count > 1 ){
pps->mb_slice_group_map_type= get_ue_golomb(&s->gb); pps->mb_slice_group_map_type= get_ue_golomb(&s->gb);
fprintf(stderr, "FMO not supported\n"); av_log(h->s.avctx, AV_LOG_ERROR, "FMO not supported\n");
switch(pps->mb_slice_group_map_type){ switch(pps->mb_slice_group_map_type){
case 0: case 0:
#if 0 #if 0
@ -3926,7 +3926,7 @@ fprintf(stderr, "FMO not supported\n");
pps->ref_count[0]= get_ue_golomb(&s->gb) + 1; pps->ref_count[0]= get_ue_golomb(&s->gb) + 1;
pps->ref_count[1]= get_ue_golomb(&s->gb) + 1; pps->ref_count[1]= get_ue_golomb(&s->gb) + 1;
if(pps->ref_count[0] > 32 || pps->ref_count[1] > 32){ if(pps->ref_count[0] > 32 || pps->ref_count[1] > 32){
fprintf(stderr, "reference overflow (pps)\n"); av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow (pps)\n");
return -1; return -1;
} }
@ -3940,7 +3940,7 @@ fprintf(stderr, "FMO not supported\n");
pps->redundant_pic_cnt_present = get_bits1(&s->gb); pps->redundant_pic_cnt_present = get_bits1(&s->gb);
if(s->avctx->debug&FF_DEBUG_PICT_INFO){ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
printf("pps:%d sps:%d %s slice_groups:%d ref:%d/%d %s qp:%d/%d/%d %s %s %s\n", av_log(h->s.avctx, AV_LOG_DEBUG, "pps:%d sps:%d %s slice_groups:%d ref:%d/%d %s qp:%d/%d/%d %s %s %s\n",
pps_id, pps->sps_id, pps_id, pps->sps_id,
pps->cabac ? "CABAC" : "CAVLC", pps->cabac ? "CABAC" : "CAVLC",
pps->slice_group_count, pps->slice_group_count,
@ -4016,7 +4016,7 @@ static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){
bit_length= 8*dst_length - decode_rbsp_trailing(ptr + dst_length - 1); bit_length= 8*dst_length - decode_rbsp_trailing(ptr + dst_length - 1);
if(s->avctx->debug&FF_DEBUG_STARTCODE){ if(s->avctx->debug&FF_DEBUG_STARTCODE){
printf("NAL %d at %d length %d\n", h->nal_unit_type, buf_index, dst_length); av_log(h->s.avctx, AV_LOG_DEBUG, "NAL %d at %d length %d\n", h->nal_unit_type, buf_index, dst_length);
} }
buf_index += consumed; buf_index += consumed;
@ -4166,7 +4166,7 @@ static int decode_frame(AVCodecContext *avctx,
} }
#endif #endif
if(!s->current_picture_ptr){ if(!s->current_picture_ptr){
fprintf(stderr, "error, NO frame\n"); av_log(h->s.avctx, AV_LOG_DEBUG, "error, NO frame\n");
return -1; return -1;
} }

@ -219,7 +219,7 @@ static int generate_bits_table(uint32_t *dst, uint8_t *len_table){
dst[index]= bits++; dst[index]= bits++;
} }
if(bits & 1){ if(bits & 1){
fprintf(stderr, "Error generating huffman table\n"); av_log(NULL, AV_LOG_ERROR, "Error generating huffman table\n");
return -1; return -1;
} }
bits >>= 1; bits >>= 1;
@ -480,7 +480,7 @@ static int encode_init(AVCodecContext *avctx)
switch(avctx->pix_fmt){ switch(avctx->pix_fmt){
case PIX_FMT_YUV420P: case PIX_FMT_YUV420P:
if(avctx->strict_std_compliance>=0){ if(avctx->strict_std_compliance>=0){
fprintf(stderr, "YV12-huffyuv is experimental, there WILL be no compatbility! (use (v)strict=-1)\n"); av_log(avctx, AV_LOG_ERROR, "YV12-huffyuv is experimental, there WILL be no compatbility! (use (v)strict=-1)\n");
return -1; return -1;
} }
s->bitstream_bpp= 12; s->bitstream_bpp= 12;
@ -489,7 +489,7 @@ static int encode_init(AVCodecContext *avctx)
s->bitstream_bpp= 16; s->bitstream_bpp= 16;
break; break;
default: default:
fprintf(stderr, "format not supported\n"); av_log(avctx, AV_LOG_ERROR, "format not supported\n");
return -1; return -1;
} }
avctx->bits_per_sample= s->bitstream_bpp; avctx->bits_per_sample= s->bitstream_bpp;
@ -703,7 +703,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8
p->reference= 0; p->reference= 0;
if(avctx->get_buffer(avctx, p) < 0){ if(avctx->get_buffer(avctx, p) < 0){
fprintf(stderr, "get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1; return -1;
} }
@ -724,7 +724,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8
p->data[0][1]= get_bits(&s->gb, 8); p->data[0][1]= get_bits(&s->gb, 8);
p->data[0][0]= get_bits(&s->gb, 8); p->data[0][0]= get_bits(&s->gb, 8);
fprintf(stderr, "YUY2 output isnt implemenetd yet\n"); av_log(avctx, AV_LOG_ERROR, "YUY2 output isnt implemenetd yet\n");
return -1; return -1;
}else{ }else{
@ -896,11 +896,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8
draw_slice(s, height); // just 1 large slice as this isnt possible in reverse order draw_slice(s, height); // just 1 large slice as this isnt possible in reverse order
break; break;
default: default:
fprintf(stderr, "prediction type not supported!\n"); av_log(avctx, AV_LOG_ERROR, "prediction type not supported!\n");
} }
}else{ }else{
fprintf(stderr, "BGR24 output isnt implemenetd yet\n"); av_log(avctx, AV_LOG_ERROR, "BGR24 output isnt implemenetd yet\n");
return -1; return -1;
} }
} }
@ -1049,7 +1049,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
} }
} }
}else{ }else{
fprintf(stderr, "Format not supported!\n"); av_log(avctx, AV_LOG_ERROR, "Format not supported!\n");
} }
emms_c(); emms_c();

@ -158,7 +158,7 @@ static int idcin_decode_init(AVCodecContext *avctx)
/* make sure the Huffman tables make it */ /* make sure the Huffman tables make it */
if (s->avctx->extradata_size != HUFFMAN_TABLE_SIZE) { if (s->avctx->extradata_size != HUFFMAN_TABLE_SIZE) {
printf(" Id CIN video: expected extradata size of %d\n", HUFFMAN_TABLE_SIZE); av_log(s->avctx, AV_LOG_ERROR, " Id CIN video: expected extradata size of %d\n", HUFFMAN_TABLE_SIZE);
return -1; return -1;
} }
@ -193,7 +193,7 @@ static void idcin_decode_vlcs(IdcinContext *s)
while(node_num >= HUF_TOKENS) { while(node_num >= HUF_TOKENS) {
if(!bit_pos) { if(!bit_pos) {
if(dat_pos > s->size) { if(dat_pos > s->size) {
printf("Huffman decode error.\n"); av_log(s->avctx, AV_LOG_ERROR, "Huffman decode error.\n");
return; return;
} }
bit_pos = 8; bit_pos = 8;
@ -225,7 +225,7 @@ static int idcin_decode_frame(AVCodecContext *avctx,
avctx->release_buffer(avctx, &s->frame); avctx->release_buffer(avctx, &s->frame);
if (avctx->get_buffer(avctx, &s->frame)) { if (avctx->get_buffer(avctx, &s->frame)) {
printf (" Id CIN Video: get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, " Id CIN Video: get_buffer() failed\n");
return -1; return -1;
} }

@ -622,7 +622,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
break; break;
case 9: case 9:
fprintf(stderr, "UNTESTED.\n"); av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1++; lv1 = *buf1++;
lv = (lv1 & 0x7F) << 1; lv = (lv1 & 0x7F) << 1;
lv += (lv << 8); lv += (lv << 8);
@ -791,7 +791,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
break; break;
case 9: case 9:
fprintf(stderr, "UNTESTED.\n"); av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1; lv1 = *buf1;
lv = (lv1 & 0x7F) << 1; lv = (lv1 & 0x7F) << 1;
lv += (lv << 8); lv += (lv << 8);
@ -887,7 +887,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
break; break;
case 9: case 9:
fprintf(stderr, "UNTESTED.\n"); av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1; lv1 = *buf1;
lv = (lv1 & 0x7F) << 1; lv = (lv1 & 0x7F) << 1;
lv += (lv << 8); lv += (lv << 8);
@ -980,7 +980,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
break; break;
case 9: case 9:
fprintf(stderr, "UNTESTED.\n"); av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1++; lv1 = *buf1++;
lv = (lv1 & 0x7F) << 1; lv = (lv1 & 0x7F) << 1;
lv += (lv << 8); lv += (lv << 8);
@ -1063,7 +1063,7 @@ static int indeo3_decode_frame(AVCodecContext *avctx,
s->frame.reference = 0; s->frame.reference = 0;
if(avctx->get_buffer(avctx, &s->frame) < 0) { if(avctx->get_buffer(avctx, &s->frame) < 0) {
fprintf(stderr, "get_buffer() failed\n"); av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1; return -1;
} }

@ -76,7 +76,7 @@ typedef struct IpvideoContext {
#define CHECK_STREAM_PTR(n) \ #define CHECK_STREAM_PTR(n) \
if ((s->stream_ptr + n) > s->stream_end) { \ if ((s->stream_ptr + n) > s->stream_end) { \
printf ("Interplay video warning: stream_ptr out of bounds (%p >= %p)\n", \ av_log(s->avctx, AV_LOG_ERROR, "Interplay video warning: stream_ptr out of bounds (%p >= %p)\n", \
s->stream_ptr + n, s->stream_end); \ s->stream_ptr + n, s->stream_end); \
return -1; \ return -1; \
} }
@ -86,10 +86,10 @@ typedef struct IpvideoContext {
motion_offset += y * s->stride; \ motion_offset += y * s->stride; \
motion_offset += x; \ motion_offset += x; \
if (motion_offset < 0) { \ if (motion_offset < 0) { \
printf (" Interplay video: motion offset < 0 (%d)\n", motion_offset); \ av_log(s->avctx, AV_LOG_ERROR, " Interplay video: motion offset < 0 (%d)\n", motion_offset); \
return -1; \ return -1; \
} else if (motion_offset > s->upper_motion_limit_offset) { \ } else if (motion_offset > s->upper_motion_limit_offset) { \
printf (" Interplay video: motion offset above limit (%d >= %d)\n", \ av_log(s->avctx, AV_LOG_ERROR, " Interplay video: motion offset above limit (%d >= %d)\n", \
motion_offset, s->upper_motion_limit_offset); \ motion_offset, s->upper_motion_limit_offset); \
return -1; \ return -1; \
} \ } \
@ -101,10 +101,10 @@ typedef struct IpvideoContext {
motion_offset += y * s->stride; \ motion_offset += y * s->stride; \
motion_offset += x; \ motion_offset += x; \
if (motion_offset < 0) { \ if (motion_offset < 0) { \
printf (" Interplay video: motion offset < 0 (%d)\n", motion_offset); \ av_log(s->avctx, AV_LOG_ERROR, " Interplay video: motion offset < 0 (%d)\n", motion_offset); \
return -1; \ return -1; \
} else if (motion_offset > s->upper_motion_limit_offset) { \ } else if (motion_offset > s->upper_motion_limit_offset) { \
printf (" Interplay video: motion offset above limit (%d >= %d)\n", \ av_log(s->avctx, AV_LOG_ERROR, " Interplay video: motion offset above limit (%d >= %d)\n", \
motion_offset, s->upper_motion_limit_offset); \ motion_offset, s->upper_motion_limit_offset); \
return -1; \ return -1; \
} \ } \
@ -116,10 +116,10 @@ typedef struct IpvideoContext {
motion_offset += y * s->stride; \ motion_offset += y * s->stride; \
motion_offset += x; \ motion_offset += x; \
if (motion_offset < 0) { \ if (motion_offset < 0) { \
printf (" Interplay video: motion offset < 0 (%d)\n", motion_offset); \ av_log(s->avctx, AV_LOG_ERROR, " Interplay video: motion offset < 0 (%d)\n", motion_offset); \
return -1; \ return -1; \
} else if (motion_offset > s->upper_motion_limit_offset) { \ } else if (motion_offset > s->upper_motion_limit_offset) { \
printf (" Interplay video: motion offset above limit (%d >= %d)\n", \ av_log(s->avctx, AV_LOG_ERROR, " Interplay video: motion offset above limit (%d >= %d)\n", \
motion_offset, s->upper_motion_limit_offset); \ motion_offset, s->upper_motion_limit_offset); \
return -1; \ return -1; \
} \ } \
@ -254,7 +254,7 @@ static int ipvideo_decode_block_opcode_0x5(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0x6(IpvideoContext *s) static int ipvideo_decode_block_opcode_0x6(IpvideoContext *s)
{ {
/* mystery opcode? skip multiple blocks? */ /* mystery opcode? skip multiple blocks? */
printf (" Interplay video: Help! Mystery opcode 0x6 seen\n"); av_log(s->avctx, AV_LOG_ERROR, " Interplay video: Help! Mystery opcode 0x6 seen\n");
/* report success */ /* report success */
return 0; return 0;
@ -838,7 +838,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s)
s->pixel_ptr = s->current_frame.data[0] + x; s->pixel_ptr = s->current_frame.data[0] + x;
ret = ipvideo_decode_block[opcode](s); ret = ipvideo_decode_block[opcode](s);
if (ret != 0) { if (ret != 0) {
printf(" Interplay video: decode problem on frame %d, @ block (%d, %d)\n", av_log(s->avctx, AV_LOG_ERROR, " Interplay video: decode problem on frame %d, @ block (%d, %d)\n",
frame, x - y, y / s->stride); frame, x - y, y / s->stride);
return; return;
} }
@ -846,7 +846,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s)
} }
if ((s->stream_ptr != s->stream_end) && if ((s->stream_ptr != s->stream_end) &&
(s->stream_ptr + 1 != s->stream_end)) { (s->stream_ptr + 1 != s->stream_end)) {
printf (" Interplay video: decode finished with %d bytes left over\n", av_log(s->avctx, AV_LOG_ERROR, " Interplay video: decode finished with %d bytes left over\n",
s->stream_end - s->stream_ptr); s->stream_end - s->stream_ptr);
} }
} }
@ -858,7 +858,7 @@ static int ipvideo_decode_init(AVCodecContext *avctx)
s->avctx = avctx; s->avctx = avctx;
if (s->avctx->palctrl == NULL) { if (s->avctx->palctrl == NULL) {
printf (" Interplay video: palette expected.\n"); av_log(avctx, AV_LOG_ERROR, " Interplay video: palette expected.\n");
return -1; return -1;
} }
@ -906,7 +906,7 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
s->current_frame.reference = 3; s->current_frame.reference = 3;
if (avctx->get_buffer(avctx, &s->current_frame)) { if (avctx->get_buffer(avctx, &s->current_frame)) {
printf (" Interplay Video: get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, " Interplay Video: get_buffer() failed\n");
return -1; return -1;
} }

@ -110,7 +110,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, DCTELEM *block, int n)
} }
} }
if (i > 63){ if (i > 63){
fprintf(stderr, "ac-tex damaged at %d %d\n", a->mb_x, a->mb_y); av_log(a->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", a->mb_x, a->mb_y);
return -1; return -1;
} }
@ -175,7 +175,7 @@ static int decode_frame(AVCodecContext *avctx,
p->reference= 0; p->reference= 0;
if(avctx->get_buffer(avctx, p) < 0){ if(avctx->get_buffer(avctx, p) < 0){
fprintf(stderr, "get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1; return -1;
} }
p->pict_type= I_TYPE; p->pict_type= I_TYPE;

@ -884,7 +884,7 @@ static int mjpeg_decode_init(AVCodecContext *avctx)
if (avctx->flags & CODEC_FLAG_EXTERN_HUFF) if (avctx->flags & CODEC_FLAG_EXTERN_HUFF)
{ {
printf("mjpeg: using external huffman table\n"); av_log(avctx, AV_LOG_INFO, "mjpeg: using external huffman table\n");
init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size*8); init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size*8);
mjpeg_decode_dht(s); mjpeg_decode_dht(s);
/* should check for error - but dunno */ /* should check for error - but dunno */
@ -987,7 +987,7 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
if(s->bits==9 && !s->pegasus_rct) s->rct=1; //FIXME ugly if(s->bits==9 && !s->pegasus_rct) s->rct=1; //FIXME ugly
if (s->bits != 8 && !s->lossless){ if (s->bits != 8 && !s->lossless){
printf("only 8 bits/component accepted\n"); av_log(s->avctx, AV_LOG_ERROR, "only 8 bits/component accepted\n");
return -1; return -1;
} }
height = get_bits(&s->gb, 16); height = get_bits(&s->gb, 16);
@ -1066,7 +1066,7 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
s->picture.reference= 0; s->picture.reference= 0;
if(s->avctx->get_buffer(s->avctx, &s->picture) < 0){ if(s->avctx->get_buffer(s->avctx, &s->picture) < 0){
fprintf(stderr, "get_buffer() failed\n"); av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1; return -1;
} }
s->picture.pict_type= I_TYPE; s->picture.pict_type= I_TYPE;
@ -1444,7 +1444,7 @@ static int mjpeg_decode_sos(MJpegDecodeContext *s)
} }
if(s->avctx->debug & FF_DEBUG_PICT_INFO) if(s->avctx->debug & FF_DEBUG_PICT_INFO)
printf("%s %s p:%d >>:%d\n", s->lossless ? "lossless" : "sequencial DCT", s->rgb ? "RGB" : "", predictor, point_transform); av_log(s->avctx, AV_LOG_DEBUG, "%s %s p:%d >>:%d\n", s->lossless ? "lossless" : "sequencial DCT", s->rgb ? "RGB" : "", predictor, point_transform);
if(s->lossless){ if(s->lossless){
if(s->rgb){ if(s->rgb){
@ -1489,7 +1489,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
len -= 6; len -= 6;
if(s->avctx->debug & FF_DEBUG_STARTCODE){ if(s->avctx->debug & FF_DEBUG_STARTCODE){
printf("APPx %8X\n", id); av_log(s->avctx, AV_LOG_DEBUG, "APPx %8X\n", id);
} }
/* buggy AVID, it puts EOI only at every 10th frame */ /* buggy AVID, it puts EOI only at every 10th frame */
@ -1525,7 +1525,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
{ {
int t_w, t_h; int t_w, t_h;
skip_bits(&s->gb, 8); /* the trailing zero-byte */ skip_bits(&s->gb, 8); /* the trailing zero-byte */
printf("mjpeg: JFIF header found (version: %x.%x)\n", av_log(s->avctx, AV_LOG_INFO, "mjpeg: JFIF header found (version: %x.%x)\n",
get_bits(&s->gb, 8), get_bits(&s->gb, 8)); get_bits(&s->gb, 8), get_bits(&s->gb, 8));
skip_bits(&s->gb, 8); skip_bits(&s->gb, 8);
@ -1546,7 +1546,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
if (id == ff_get_fourcc("Adob") && (get_bits(&s->gb, 8) == 'e')) if (id == ff_get_fourcc("Adob") && (get_bits(&s->gb, 8) == 'e'))
{ {
printf("mjpeg: Adobe header found\n"); av_log(s->avctx, AV_LOG_INFO, "mjpeg: Adobe header found\n");
skip_bits(&s->gb, 16); /* version */ skip_bits(&s->gb, 16); /* version */
skip_bits(&s->gb, 16); /* flags0 */ skip_bits(&s->gb, 16); /* flags0 */
skip_bits(&s->gb, 16); /* flags1 */ skip_bits(&s->gb, 16); /* flags1 */
@ -1556,7 +1556,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
} }
if (id == ff_get_fourcc("LJIF")){ if (id == ff_get_fourcc("LJIF")){
printf("Pegasus lossless jpeg header found\n"); av_log(s->avctx, AV_LOG_INFO, "Pegasus lossless jpeg header found\n");
skip_bits(&s->gb, 16); /* version ? */ skip_bits(&s->gb, 16); /* version ? */
skip_bits(&s->gb, 16); /* unknwon always 0? */ skip_bits(&s->gb, 16); /* unknwon always 0? */
skip_bits(&s->gb, 16); /* unknwon always 0? */ skip_bits(&s->gb, 16); /* unknwon always 0? */
@ -1571,7 +1571,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
s->pegasus_rct=1; s->pegasus_rct=1;
break; break;
default: default:
printf("unknown colorspace\n"); av_log(s->avctx, AV_LOG_ERROR, "unknown colorspace\n");
} }
len -= 9; len -= 9;
goto out; goto out;
@ -1596,14 +1596,14 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
skip_bits(&s->gb, 32); /* data off */ skip_bits(&s->gb, 32); /* data off */
#endif #endif
if (s->first_picture) if (s->first_picture)
printf("mjpeg: Apple MJPEG-A header found\n"); av_log(s->avctx, AV_LOG_INFO, "mjpeg: Apple MJPEG-A header found\n");
} }
} }
out: out:
/* slow but needed for extreme adobe jpegs */ /* slow but needed for extreme adobe jpegs */
if (len < 0) if (len < 0)
printf("mjpeg: error, decode_app parser read over the end\n"); av_log(s->avctx, AV_LOG_ERROR, "mjpeg: error, decode_app parser read over the end\n");
while(--len > 0) while(--len > 0)
skip_bits(&s->gb, 8); skip_bits(&s->gb, 8);
@ -1626,7 +1626,7 @@ static int mjpeg_decode_com(MJpegDecodeContext *s)
else else
cbuf[i] = 0; cbuf[i] = 0;
printf("mjpeg comment: '%s'\n", cbuf); av_log(s->avctx, AV_LOG_INFO, "mjpeg comment: '%s'\n", cbuf);
/* buggy avid, it puts EOI only at every 10th frame */ /* buggy avid, it puts EOI only at every 10th frame */
if (!strcmp(cbuf, "AVID")) if (!strcmp(cbuf, "AVID"))
@ -1766,7 +1766,7 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
s->start_code = start_code; s->start_code = start_code;
if(s->avctx->debug & FF_DEBUG_STARTCODE){ if(s->avctx->debug & FF_DEBUG_STARTCODE){
printf("startcode: %X\n", start_code); av_log(s->avctx, AV_LOG_DEBUG, "startcode: %X\n", start_code);
} }
/* process markers */ /* process markers */
@ -1791,7 +1791,7 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
break; break;
case DHT: case DHT:
if(mjpeg_decode_dht(s) < 0){ if(mjpeg_decode_dht(s) < 0){
fprintf(stderr, "huffman table decode error\n"); av_log(s->avctx, AV_LOG_ERROR, "huffman table decode error\n");
return -1; return -1;
} }
break; break;
@ -1829,7 +1829,7 @@ eoi_parser:
picture->qscale_table= s->qscale_table; picture->qscale_table= s->qscale_table;
memset(picture->qscale_table, picture->quality, (s->width+15)/16); memset(picture->qscale_table, picture->quality, (s->width+15)/16);
if(avctx->debug & FF_DEBUG_QP) if(avctx->debug & FF_DEBUG_QP)
printf("QP: %d\n", picture->quality); av_log(s->avctx, AV_LOG_DEBUG, "QP: %d\n", picture->quality);
picture->quality*= FF_QP2LAMBDA; picture->quality*= FF_QP2LAMBDA;
} }
@ -1858,7 +1858,7 @@ eoi_parser:
case SOF14: case SOF14:
case SOF15: case SOF15:
case JPG: case JPG:
printf("mjpeg: unsupported coding type (%x)\n", start_code); av_log(s->avctx, AV_LOG_ERROR, "mjpeg: unsupported coding type (%x)\n", start_code);
break; break;
// default: // default:
// printf("mjpeg: unsupported marker (%x)\n", start_code); // printf("mjpeg: unsupported marker (%x)\n", start_code);
@ -1987,7 +1987,7 @@ read_header:
picture->qscale_table= s->qscale_table; picture->qscale_table= s->qscale_table;
memset(picture->qscale_table, picture->quality, (s->width+15)/16); memset(picture->qscale_table, picture->quality, (s->width+15)/16);
if(avctx->debug & FF_DEBUG_QP) if(avctx->debug & FF_DEBUG_QP)
printf("QP: %d\n", picture->quality); av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", picture->quality);
picture->quality*= FF_QP2LAMBDA; picture->quality*= FF_QP2LAMBDA;
} }

@ -322,7 +322,7 @@ static void set_cmp(MpegEncContext *s, me_cmp_func *cmp, int type){
} }
break; break;
default: default:
fprintf(stderr,"internal error in cmp function selection\n"); av_log(s->avctx, AV_LOG_ERROR,"internal error in cmp function selection\n");
} }
} }

@ -994,7 +994,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
if (s->mb_skip_run-- != 0) { if (s->mb_skip_run-- != 0) {
if(s->pict_type == I_TYPE){ if(s->pict_type == I_TYPE){
fprintf(stderr, "skiped MB in I frame at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "skiped MB in I frame at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
@ -1034,7 +1034,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
case I_TYPE: case I_TYPE:
if (get_bits1(&s->gb) == 0) { if (get_bits1(&s->gb) == 0) {
if (get_bits1(&s->gb) == 0){ if (get_bits1(&s->gb) == 0){
fprintf(stderr, "invalid mb type in I Frame at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in I Frame at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
mb_type = MB_TYPE_QUANT | MB_TYPE_INTRA; mb_type = MB_TYPE_QUANT | MB_TYPE_INTRA;
@ -1045,7 +1045,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
case P_TYPE: case P_TYPE:
mb_type = get_vlc2(&s->gb, mb_ptype_vlc.table, MB_PTYPE_VLC_BITS, 1); mb_type = get_vlc2(&s->gb, mb_ptype_vlc.table, MB_PTYPE_VLC_BITS, 1);
if (mb_type < 0){ if (mb_type < 0){
fprintf(stderr, "invalid mb type in P Frame at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in P Frame at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
mb_type = ptype2mb_type[ mb_type ]; mb_type = ptype2mb_type[ mb_type ];
@ -1053,7 +1053,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
case B_TYPE: case B_TYPE:
mb_type = get_vlc2(&s->gb, mb_btype_vlc.table, MB_BTYPE_VLC_BITS, 1); mb_type = get_vlc2(&s->gb, mb_btype_vlc.table, MB_BTYPE_VLC_BITS, 1);
if (mb_type < 0){ if (mb_type < 0){
fprintf(stderr, "invalid mb type in B Frame at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in B Frame at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
mb_type = btype2mb_type[ mb_type ]; mb_type = btype2mb_type[ mb_type ];
@ -1268,7 +1268,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
if (IS_PAT(mb_type)) { if (IS_PAT(mb_type)) {
cbp = get_vlc2(&s->gb, mb_pat_vlc.table, MB_PAT_VLC_BITS, 1); cbp = get_vlc2(&s->gb, mb_pat_vlc.table, MB_PAT_VLC_BITS, 1);
if (cbp < 0){ if (cbp < 0){
fprintf(stderr, "invalid cbp at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "invalid cbp at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
cbp++; cbp++;
@ -1356,7 +1356,7 @@ static inline int decode_dc(GetBitContext *gb, int component)
code = get_vlc2(gb, dc_chroma_vlc.table, DC_VLC_BITS, 2); code = get_vlc2(gb, dc_chroma_vlc.table, DC_VLC_BITS, 2);
} }
if (code < 0){ if (code < 0){
fprintf(stderr, "invalid dc code at\n"); av_log(NULL, AV_LOG_ERROR, "invalid dc code at\n");
return 0xffff; return 0xffff;
} }
if (code == 0) { if (code == 0) {
@ -1428,7 +1428,7 @@ static inline int mpeg1_decode_block_intra(MpegEncContext *s,
} }
} }
if (i > 63){ if (i > 63){
fprintf(stderr, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
@ -1504,7 +1504,7 @@ static inline int mpeg1_decode_block_inter(MpegEncContext *s,
} }
} }
if (i > 63){ if (i > 63){
fprintf(stderr, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
@ -1582,7 +1582,7 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s,
} }
} }
if (i > 63){ if (i > 63){
fprintf(stderr, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
@ -1662,7 +1662,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s,
} }
} }
if (i > 63){ if (i > 63){
fprintf(stderr, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
@ -1810,7 +1810,7 @@ static void mpeg_decode_sequence_extension(MpegEncContext *s)
} }
if(s->avctx->debug & FF_DEBUG_PICT_INFO) if(s->avctx->debug & FF_DEBUG_PICT_INFO)
printf("profile: %d, level: %d \n", profile, level); av_log(s->avctx, AV_LOG_DEBUG, "profile: %d, level: %d \n", profile, level);
} }
static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1) static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1)
@ -1841,7 +1841,7 @@ static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1)
); );
if(s->avctx->debug & FF_DEBUG_PICT_INFO) if(s->avctx->debug & FF_DEBUG_PICT_INFO)
printf("sde w:%d, h:%d\n", w, h); av_log(s->avctx, AV_LOG_DEBUG, "sde w:%d, h:%d\n", w, h);
} }
static void mpeg_decode_picture_display_extension(Mpeg1Context *s1) static void mpeg_decode_picture_display_extension(Mpeg1Context *s1)
@ -1857,7 +1857,7 @@ static void mpeg_decode_picture_display_extension(Mpeg1Context *s1)
} }
if(s->avctx->debug & FF_DEBUG_PICT_INFO) if(s->avctx->debug & FF_DEBUG_PICT_INFO)
printf("pde (%d,%d) (%d,%d) (%d,%d)\n", av_log(s->avctx, AV_LOG_DEBUG, "pde (%d,%d) (%d,%d) (%d,%d)\n",
s1->pan_scan.position[0][0], s1->pan_scan.position[0][1], s1->pan_scan.position[0][0], s1->pan_scan.position[0][1],
s1->pan_scan.position[1][0], s1->pan_scan.position[1][1], s1->pan_scan.position[1][0], s1->pan_scan.position[1][1],
s1->pan_scan.position[2][0], s1->pan_scan.position[2][1] s1->pan_scan.position[2][0], s1->pan_scan.position[2][1]
@ -2014,7 +2014,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
start_code = (start_code - 1) & 0xff; start_code = (start_code - 1) & 0xff;
if (start_code >= s->mb_height){ if (start_code >= s->mb_height){
fprintf(stderr, "slice below image (%d >= %d)\n", start_code, s->mb_height); av_log(s->avctx, AV_LOG_ERROR, "slice below image (%d >= %d)\n", start_code, s->mb_height);
return -1; return -1;
} }
@ -2047,7 +2047,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
//printf("%d\n", s->current_picture_ptr->repeat_pict); //printf("%d\n", s->current_picture_ptr->repeat_pict);
if(s->avctx->debug&FF_DEBUG_PICT_INFO){ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
printf("qp:%d fc:%2d%2d%2d%2d %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\n", av_log(s->avctx, AV_LOG_DEBUG, "qp:%d fc:%2d%2d%2d%2d %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->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->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->progressive_sequence ? "pro" :"", s->alternate_scan ? "alt" :"", s->top_field_first ? "top" :"",
@ -2058,7 +2058,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
int i; int i;
if(!s->current_picture_ptr){ if(!s->current_picture_ptr){
fprintf(stderr, "first field missing\n"); av_log(s->avctx, AV_LOG_ERROR, "first field missing\n");
return -1; return -1;
} }
@ -2082,7 +2082,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
s->qscale = get_qscale(s); s->qscale = get_qscale(s);
if(s->qscale == 0){ if(s->qscale == 0){
fprintf(stderr, "qscale == 0\n"); av_log(s->avctx, AV_LOG_ERROR, "qscale == 0\n");
return -1; return -1;
} }
@ -2096,7 +2096,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
for(;;) { for(;;) {
int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2); int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2);
if (code < 0){ if (code < 0){
fprintf(stderr, "first mb_incr damaged\n"); av_log(s->avctx, AV_LOG_ERROR, "first mb_incr damaged\n");
return -1; return -1;
} }
if (code >= 33) { if (code >= 33) {
@ -2173,7 +2173,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
if(left < 0 || (left && show_bits(&s->gb, FFMIN(left, 23))) if(left < 0 || (left && show_bits(&s->gb, FFMIN(left, 23)))
|| (avctx->error_resilience >= FF_ER_AGGRESSIVE && left>8)){ || (avctx->error_resilience >= FF_ER_AGGRESSIVE && left>8)){
fprintf(stderr, "end missmatch left=%d\n", left); av_log(avctx, AV_LOG_ERROR, "end mismatch left=%d\n", left);
return -1; return -1;
}else }else
goto eos; goto eos;
@ -2189,7 +2189,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
for(;;) { for(;;) {
int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2); int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2);
if (code < 0){ if (code < 0){
fprintf(stderr, "mb incr damaged\n"); av_log(s->avctx, AV_LOG_ERROR, "mb incr damaged\n");
return -1; return -1;
} }
if (code >= 33) { if (code >= 33) {
@ -2197,7 +2197,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
s->mb_skip_run += 33; s->mb_skip_run += 33;
}else if(code == 35){ }else if(code == 35){
if(s->mb_skip_run != 0 || show_bits(&s->gb, 15) != 0){ if(s->mb_skip_run != 0 || show_bits(&s->gb, 15) != 0){
fprintf(stderr, "slice missmatch\n"); av_log(s->avctx, AV_LOG_ERROR, "slice mismatch\n");
return -1; return -1;
} }
goto eos; /* end of slice */ goto eos; /* end of slice */
@ -2564,7 +2564,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
input_size = buf_end - buf_ptr; input_size = buf_end - buf_ptr;
if(avctx->debug & FF_DEBUG_STARTCODE){ if(avctx->debug & FF_DEBUG_STARTCODE){
printf("%3X at %d left %d\n", start_code, buf_ptr-buf, input_size); av_log(avctx, AV_LOG_DEBUG, "%3X at %d left %d\n", start_code, buf_ptr-buf, input_size);
} }
/* prepare data for next start code */ /* prepare data for next start code */

@ -117,7 +117,7 @@ static int MPA_encode_init(AVCodecContext *avctx)
s->alloc_table = alloc_tables[table]; s->alloc_table = alloc_tables[table];
#ifdef DEBUG #ifdef DEBUG
printf("%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n", av_log(AV_LOG_DEBUG, "%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n",
bitrate, freq, s->frame_size, table, s->frame_frac_incr); bitrate, freq, s->frame_size, table, s->frame_frac_incr);
#endif #endif

@ -274,17 +274,17 @@ static int alloc_picture(MpegEncContext *s, Picture *pic, int shared){
r= s->avctx->get_buffer(s->avctx, (AVFrame*)pic); r= s->avctx->get_buffer(s->avctx, (AVFrame*)pic);
if(r<0 || !pic->age || !pic->type || !pic->data[0]){ if(r<0 || !pic->age || !pic->type || !pic->data[0]){
fprintf(stderr, "get_buffer() failed (%d %d %d %p)\n", r, pic->age, pic->type, pic->data[0]); av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %d %p)\n", r, pic->age, pic->type, pic->data[0]);
return -1; return -1;
} }
if(s->linesize && (s->linesize != pic->linesize[0] || s->uvlinesize != pic->linesize[1])){ if(s->linesize && (s->linesize != pic->linesize[0] || s->uvlinesize != pic->linesize[1])){
fprintf(stderr, "get_buffer() failed (stride changed)\n"); av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (stride changed)\n");
return -1; return -1;
} }
if(pic->linesize[1] != pic->linesize[2]){ if(pic->linesize[1] != pic->linesize[2]){
fprintf(stderr, "get_buffer() failed (uv stride missmatch)\n"); av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (uv stride missmatch)\n");
return -1; return -1;
} }
@ -625,7 +625,7 @@ int MPV_encode_init(AVCodecContext *avctx)
s->width = avctx->width; s->width = avctx->width;
s->height = avctx->height; s->height = avctx->height;
if(avctx->gop_size > 600){ if(avctx->gop_size > 600){
fprintf(stderr, "Warning keyframe interval too large! reducing it ...\n"); av_log(avctx, AV_LOG_ERROR, "Warning keyframe interval too large! reducing it ...\n");
avctx->gop_size=600; avctx->gop_size=600;
} }
s->gop_size = avctx->gop_size; s->gop_size = avctx->gop_size;
@ -670,32 +670,32 @@ int MPV_encode_init(AVCodecContext *avctx)
s->progressive_sequence= !(avctx->flags & CODEC_FLAG_INTERLACED_DCT); s->progressive_sequence= !(avctx->flags & CODEC_FLAG_INTERLACED_DCT);
if((s->flags & CODEC_FLAG_4MV) && s->codec_id != CODEC_ID_MPEG4){ if((s->flags & CODEC_FLAG_4MV) && s->codec_id != CODEC_ID_MPEG4){
fprintf(stderr, "4MV not supporetd by codec\n"); av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n");
return -1; return -1;
} }
if(s->quarter_sample && s->codec_id != CODEC_ID_MPEG4){ if(s->quarter_sample && s->codec_id != CODEC_ID_MPEG4){
fprintf(stderr, "qpel not supporetd by codec\n"); av_log(avctx, AV_LOG_ERROR, "qpel not supported by codec\n");
return -1; return -1;
} }
if(s->data_partitioning && s->codec_id != CODEC_ID_MPEG4){ if(s->data_partitioning && s->codec_id != CODEC_ID_MPEG4){
fprintf(stderr, "data partitioning not supporetd by codec\n"); av_log(avctx, AV_LOG_ERROR, "data partitioning not supported by codec\n");
return -1; return -1;
} }
if(s->max_b_frames && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO){ if(s->max_b_frames && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO){
fprintf(stderr, "b frames not supporetd by codec\n"); av_log(avctx, AV_LOG_ERROR, "b frames not supported by codec\n");
return -1; return -1;
} }
if(s->mpeg_quant && s->codec_id != CODEC_ID_MPEG4){ //FIXME mpeg2 uses that too if(s->mpeg_quant && s->codec_id != CODEC_ID_MPEG4){ //FIXME mpeg2 uses that too
fprintf(stderr, "mpeg2 style quantization not supporetd by codec\n"); av_log(avctx, AV_LOG_ERROR, "mpeg2 style quantization not supporetd by codec\n");
return -1; return -1;
} }
if((s->flags & CODEC_FLAG_CBP_RD) && !(s->flags & CODEC_FLAG_TRELLIS_QUANT)){ if((s->flags & CODEC_FLAG_CBP_RD) && !(s->flags & CODEC_FLAG_TRELLIS_QUANT)){
fprintf(stderr, "CBP RD needs trellis quant\n"); av_log(avctx, AV_LOG_ERROR, "CBP RD needs trellis quant\n");
return -1; return -1;
} }
@ -753,7 +753,7 @@ int MPV_encode_init(AVCodecContext *avctx)
#ifdef CONFIG_RISKY #ifdef CONFIG_RISKY
case CODEC_ID_H263: case CODEC_ID_H263:
if (h263_get_picture_format(s->width, s->height) == 7) { if (h263_get_picture_format(s->width, s->height) == 7) {
printf("Input picture size isn't suitable for h263 codec! try h263+\n"); av_log(avctx, AV_LOG_INFO, "Input picture size isn't suitable for h263 codec! try h263+\n");
return -1; return -1;
} }
s->out_format = FMT_H263; s->out_format = FMT_H263;
@ -1078,7 +1078,7 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
if(!s->encoding){ if(!s->encoding){
for(i=0; i<MAX_PICTURE_COUNT; i++){ for(i=0; i<MAX_PICTURE_COUNT; i++){
if(s->picture[i].data[0] && &s->picture[i] != s->next_picture_ptr && s->picture[i].reference){ if(s->picture[i].data[0] && &s->picture[i] != s->next_picture_ptr && s->picture[i].reference){
fprintf(stderr, "releasing zombie picture\n"); av_log(avctx, AV_LOG_ERROR, "releasing zombie picture\n");
avctx->release_buffer(avctx, (AVFrame*)&s->picture[i]); avctx->release_buffer(avctx, (AVFrame*)&s->picture[i]);
} }
} }
@ -1128,7 +1128,7 @@ alloc:
if(s->next_picture_ptr) copy_picture(&s->next_picture, s->next_picture_ptr); if(s->next_picture_ptr) copy_picture(&s->next_picture, s->next_picture_ptr);
if(s->pict_type != I_TYPE && (s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL)){ if(s->pict_type != I_TYPE && (s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL)){
fprintf(stderr, "warning: first frame is no keyframe\n"); av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n");
assert(s->pict_type != B_TYPE); //these should have been dropped if we dont have a reference assert(s->pict_type != B_TYPE); //these should have been dropped if we dont have a reference
goto alloc; goto alloc;
} }
@ -1315,63 +1315,63 @@ void ff_print_debug_info(MpegEncContext *s, Picture *pict){
if(s->avctx->debug&FF_DEBUG_SKIP){ if(s->avctx->debug&FF_DEBUG_SKIP){
int count= s->mbskip_table[x + y*s->mb_stride]; int count= s->mbskip_table[x + y*s->mb_stride];
if(count>9) count=9; if(count>9) count=9;
printf("%1d", count); av_log(s->avctx, AV_LOG_DEBUG, "%1d", count);
} }
if(s->avctx->debug&FF_DEBUG_QP){ if(s->avctx->debug&FF_DEBUG_QP){
printf("%2d", pict->qscale_table[x + y*s->mb_stride]); av_log(s->avctx, AV_LOG_DEBUG, "%2d", pict->qscale_table[x + y*s->mb_stride]);
} }
if(s->avctx->debug&FF_DEBUG_MB_TYPE){ if(s->avctx->debug&FF_DEBUG_MB_TYPE){
int mb_type= pict->mb_type[x + y*s->mb_stride]; int mb_type= pict->mb_type[x + y*s->mb_stride];
//Type & MV direction //Type & MV direction
if(IS_PCM(mb_type)) if(IS_PCM(mb_type))
printf("P"); av_log(s->avctx, AV_LOG_DEBUG, "P");
else if(IS_INTRA(mb_type) && IS_ACPRED(mb_type)) else if(IS_INTRA(mb_type) && IS_ACPRED(mb_type))
printf("A"); av_log(s->avctx, AV_LOG_DEBUG, "A");
else if(IS_INTRA4x4(mb_type)) else if(IS_INTRA4x4(mb_type))
printf("i"); av_log(s->avctx, AV_LOG_DEBUG, "i");
else if(IS_INTRA16x16(mb_type)) else if(IS_INTRA16x16(mb_type))
printf("I"); av_log(s->avctx, AV_LOG_DEBUG, "I");
else if(IS_DIRECT(mb_type) && IS_SKIP(mb_type)) else if(IS_DIRECT(mb_type) && IS_SKIP(mb_type))
printf("d"); av_log(s->avctx, AV_LOG_DEBUG, "d");
else if(IS_DIRECT(mb_type)) else if(IS_DIRECT(mb_type))
printf("D"); av_log(s->avctx, AV_LOG_DEBUG, "D");
else if(IS_GMC(mb_type) && IS_SKIP(mb_type)) else if(IS_GMC(mb_type) && IS_SKIP(mb_type))
printf("g"); av_log(s->avctx, AV_LOG_DEBUG, "g");
else if(IS_GMC(mb_type)) else if(IS_GMC(mb_type))
printf("G"); av_log(s->avctx, AV_LOG_DEBUG, "G");
else if(IS_SKIP(mb_type)) else if(IS_SKIP(mb_type))
printf("S"); av_log(s->avctx, AV_LOG_DEBUG, "S");
else if(!USES_LIST(mb_type, 1)) else if(!USES_LIST(mb_type, 1))
printf(">"); av_log(s->avctx, AV_LOG_DEBUG, ">");
else if(!USES_LIST(mb_type, 0)) else if(!USES_LIST(mb_type, 0))
printf("<"); av_log(s->avctx, AV_LOG_DEBUG, "<");
else{ else{
assert(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1)); assert(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1));
printf("X"); av_log(s->avctx, AV_LOG_DEBUG, "X");
} }
//segmentation //segmentation
if(IS_8X8(mb_type)) if(IS_8X8(mb_type))
printf("+"); av_log(s->avctx, AV_LOG_DEBUG, "+");
else if(IS_16X8(mb_type)) else if(IS_16X8(mb_type))
printf("-"); av_log(s->avctx, AV_LOG_DEBUG, "-");
else if(IS_8X16(mb_type)) else if(IS_8X16(mb_type))
printf("¦"); av_log(s->avctx, AV_LOG_DEBUG, "¦");
else if(IS_INTRA(mb_type) || IS_16X16(mb_type)) else if(IS_INTRA(mb_type) || IS_16X16(mb_type))
printf(" "); av_log(s->avctx, AV_LOG_DEBUG, " ");
else else
printf("?"); av_log(s->avctx, AV_LOG_DEBUG, "?");
if(IS_INTERLACED(mb_type) && s->codec_id == CODEC_ID_H264) if(IS_INTERLACED(mb_type) && s->codec_id == CODEC_ID_H264)
printf("="); av_log(s->avctx, AV_LOG_DEBUG, "=");
else else
printf(" "); av_log(s->avctx, AV_LOG_DEBUG, " ");
} }
// printf(" "); // av_log(s->avctx, AV_LOG_DEBUG, " ");
} }
printf("\n"); av_log(s->avctx, AV_LOG_DEBUG, "\n");
} }
} }
@ -1457,7 +1457,7 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg){
if(pic_arg->linesize[1] != s->uvlinesize) direct=0; if(pic_arg->linesize[1] != s->uvlinesize) direct=0;
if(pic_arg->linesize[2] != s->uvlinesize) direct=0; if(pic_arg->linesize[2] != s->uvlinesize) direct=0;
// printf("%d %d %d %d\n",pic_arg->linesize[0], pic_arg->linesize[1], s->linesize, s->uvlinesize); // av_log(AV_LOG_DEBUG, "%d %d %d %d\n",pic_arg->linesize[0], pic_arg->linesize[1], s->linesize, s->uvlinesize);
if(direct){ if(direct){
i= ff_find_unused_picture(s, 1); i= ff_find_unused_picture(s, 1);
@ -1564,7 +1564,7 @@ static void select_input_picture(MpegEncContext *s){
} }
if(b_frames > s->max_b_frames){ if(b_frames > s->max_b_frames){
fprintf(stderr, "warning, too many bframes in a row\n"); av_log(s->avctx, AV_LOG_ERROR, "warning, too many bframes in a row\n");
b_frames = s->max_b_frames; b_frames = s->max_b_frames;
} }
}else if(s->b_frame_strategy==0){ }else if(s->b_frame_strategy==0){
@ -1589,14 +1589,14 @@ static void select_input_picture(MpegEncContext *s){
s->input_picture[i]->b_frame_score=0; s->input_picture[i]->b_frame_score=0;
} }
}else{ }else{
fprintf(stderr, "illegal b frame strategy\n"); av_log(s->avctx, AV_LOG_ERROR, "illegal b frame strategy\n");
b_frames=0; b_frames=0;
} }
emms_c(); emms_c();
//static int b_count=0; //static int b_count=0;
//b_count+= b_frames; //b_count+= b_frames;
//printf("b_frames: %d\n", b_count); //av_log(s->avctx, AV_LOG_DEBUG, "b_frames: %d\n", b_count);
s->reordered_input_picture[0]= s->input_picture[b_frames]; s->reordered_input_picture[0]= s->input_picture[b_frames];
if( s->picture_in_gop_number + b_frames >= s->gop_size if( s->picture_in_gop_number + b_frames >= s->gop_size
@ -1668,7 +1668,7 @@ int MPV_encode_picture(AVCodecContext *avctx,
int i; int i;
if(avctx->pix_fmt != PIX_FMT_YUV420P){ if(avctx->pix_fmt != PIX_FMT_YUV420P){
fprintf(stderr, "this codec supports only YUV420P\n"); av_log(avctx, AV_LOG_ERROR, "this codec supports only YUV420P\n");
return -1; return -1;
} }
@ -4002,7 +4002,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
break; break;
default: default:
motion_x=motion_y=0; //gcc warning fix motion_x=motion_y=0; //gcc warning fix
printf("illegal MB type\n"); av_log(s->avctx, AV_LOG_ERROR, "illegal MB type\n");
} }
encode_mb(s, motion_x, motion_y); encode_mb(s, motion_x, motion_y);

@ -1238,7 +1238,7 @@ return -1;
int start_code, num; int start_code, num;
start_code = (get_bits(&s->gb, 16)<<16) | get_bits(&s->gb, 16); start_code = (get_bits(&s->gb, 16)<<16) | get_bits(&s->gb, 16);
if(start_code!=0x00000100){ if(start_code!=0x00000100){
fprintf(stderr, "invalid startcode\n"); av_log(s->avctx, AV_LOG_ERROR, "invalid startcode\n");
return -1; return -1;
} }
@ -1248,7 +1248,7 @@ return -1;
s->pict_type = get_bits(&s->gb, 2) + 1; s->pict_type = get_bits(&s->gb, 2) + 1;
if (s->pict_type != I_TYPE && if (s->pict_type != I_TYPE &&
s->pict_type != P_TYPE){ s->pict_type != P_TYPE){
fprintf(stderr, "invalid picture type\n"); av_log(s->avctx, AV_LOG_ERROR, "invalid picture type\n");
return -1; return -1;
} }
#if 0 #if 0
@ -1260,7 +1260,7 @@ return -1;
#endif #endif
s->qscale = get_bits(&s->gb, 5); s->qscale = get_bits(&s->gb, 5);
if(s->qscale==0){ if(s->qscale==0){
fprintf(stderr, "invalid qscale\n"); av_log(s->avctx, AV_LOG_ERROR, "invalid qscale\n");
return -1; return -1;
} }
@ -1268,7 +1268,7 @@ return -1;
code = get_bits(&s->gb, 5); code = get_bits(&s->gb, 5);
if(s->msmpeg4_version==1){ if(s->msmpeg4_version==1){
if(code==0 || code>s->mb_height){ if(code==0 || code>s->mb_height){
fprintf(stderr, "invalid slice height %d\n", code); av_log(s->avctx, AV_LOG_ERROR, "invalid slice height %d\n", code);
return -1; return -1;
} }
@ -1276,7 +1276,7 @@ return -1;
}else{ }else{
/* 0x17: one slice, 0x18: two slices, ... */ /* 0x17: one slice, 0x18: two slices, ... */
if (code < 0x17){ if (code < 0x17){
fprintf(stderr, "error, slice code was %X\n", code); av_log(s->avctx, AV_LOG_ERROR, "error, slice code was %X\n", code);
return -1; return -1;
} }
@ -1314,7 +1314,7 @@ return -1;
} }
s->no_rounding = 1; s->no_rounding = 1;
if(s->avctx->debug&FF_DEBUG_PICT_INFO) if(s->avctx->debug&FF_DEBUG_PICT_INFO)
printf("qscale:%d rlc:%d rl:%d dc:%d mbrl:%d slice:%d \n", av_log(s->avctx, AV_LOG_DEBUG, "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d slice:%d \n",
s->qscale, s->qscale,
s->rl_chroma_table_index, s->rl_chroma_table_index,
s->rl_table_index, s->rl_table_index,
@ -1362,7 +1362,7 @@ return -1;
} }
if(s->avctx->debug&FF_DEBUG_PICT_INFO) if(s->avctx->debug&FF_DEBUG_PICT_INFO)
printf("skip:%d rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d \n", av_log(s->avctx, AV_LOG_DEBUG, "skip:%d rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d \n",
s->use_skip_mb_code, s->use_skip_mb_code,
s->rl_table_index, s->rl_table_index,
s->rl_chroma_table_index, s->rl_chroma_table_index,
@ -1410,11 +1410,11 @@ int msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size)
{ {
s->flipflop_rounding= 0; s->flipflop_rounding= 0;
if(s->msmpeg4_version != 2) if(s->msmpeg4_version != 2)
printf("ext header missing, %d left\n", left); av_log(s->avctx, AV_LOG_ERROR, "ext header missing, %d left\n", left);
} }
else else
{ {
fprintf(stderr, "I frame too long, ignoring ext header\n"); av_log(s->avctx, AV_LOG_ERROR, "I frame too long, ignoring ext header\n");
} }
return 0; return 0;
@ -1517,7 +1517,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
else else
code = get_vlc2(&s->gb, v1_inter_cbpc_vlc.table, V1_INTER_CBPC_VLC_BITS, 3); code = get_vlc2(&s->gb, v1_inter_cbpc_vlc.table, V1_INTER_CBPC_VLC_BITS, 3);
if(code<0 || code>7){ if(code<0 || code>7){
fprintf(stderr, "cbpc %d invalid at %d %d\n", code, s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", code, s->mb_x, s->mb_y);
return -1; return -1;
} }
@ -1531,7 +1531,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
else else
cbp= get_vlc2(&s->gb, v1_intra_cbpc_vlc.table, V1_INTRA_CBPC_VLC_BITS, 1); cbp= get_vlc2(&s->gb, v1_intra_cbpc_vlc.table, V1_INTRA_CBPC_VLC_BITS, 1);
if(cbp<0 || cbp>3){ if(cbp<0 || cbp>3){
fprintf(stderr, "cbpc %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y);
return -1; return -1;
} }
} }
@ -1541,7 +1541,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
cbpy= get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1); cbpy= get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1);
if(cbpy<0){ if(cbpy<0){
fprintf(stderr, "cbpy %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "cbpy %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y);
return -1; return -1;
} }
@ -1570,7 +1570,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
{ {
fprintf(stderr,"\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i); av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
return -1; return -1;
} }
} }
@ -1662,7 +1662,7 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
{ {
fprintf(stderr,"\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i); av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
return -1; return -1;
} }
} }
@ -1688,20 +1688,20 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
level = msmpeg4_decode_dc(s, n, &dc_pred_dir); level = msmpeg4_decode_dc(s, n, &dc_pred_dir);
if (level < 0){ if (level < 0){
fprintf(stderr, "dc overflow- block: %d qscale: %d//\n", n, s->qscale); av_log(s->avctx, AV_LOG_ERROR, "dc overflow- block: %d qscale: %d//\n", n, s->qscale);
if(s->inter_intra_pred) level=0; if(s->inter_intra_pred) level=0;
else return -1; else return -1;
} }
if (n < 4) { if (n < 4) {
rl = &rl_table[s->rl_table_index]; rl = &rl_table[s->rl_table_index];
if(level > 256*s->y_dc_scale){ if(level > 256*s->y_dc_scale){
fprintf(stderr, "dc overflow+ L qscale: %d//\n", s->qscale); av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ L qscale: %d//\n", s->qscale);
if(!s->inter_intra_pred) return -1; if(!s->inter_intra_pred) return -1;
} }
} else { } else {
rl = &rl_table[3 + s->rl_chroma_table_index]; rl = &rl_table[3 + s->rl_chroma_table_index];
if(level > 256*s->c_dc_scale){ if(level > 256*s->c_dc_scale){
fprintf(stderr, "dc overflow+ C qscale: %d//\n", s->qscale); av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ C qscale: %d//\n", s->qscale);
if(!s->inter_intra_pred) return -1; if(!s->inter_intra_pred) return -1;
} }
} }
@ -1770,7 +1770,7 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
if(s->qscale<8){ if(s->qscale<8){
ll= SHOW_UBITS(re, &s->gb, 3); SKIP_BITS(re, &s->gb, 3); ll= SHOW_UBITS(re, &s->gb, 3); SKIP_BITS(re, &s->gb, 3);
if(ll==0){ if(ll==0){
if(SHOW_UBITS(re, &s->gb, 1)) printf("cool a new vlc code ,contact the ffmpeg developers and upload the file\n"); if(SHOW_UBITS(re, &s->gb, 1)) av_log(s->avctx, AV_LOG_ERROR, "cool a new vlc code ,contact the ffmpeg developers and upload the file\n");
SKIP_BITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
ll=8; ll=8;
} }
@ -1891,10 +1891,10 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
if(i&(~63)){ if(i&(~63)){
const int left= s->gb.size_in_bits - get_bits_count(&s->gb); const int left= s->gb.size_in_bits - get_bits_count(&s->gb);
if(((i+192 == 64 && level/qmul==-1) || s->error_resilience<=1) && left>=0){ if(((i+192 == 64 && level/qmul==-1) || s->error_resilience<=1) && left>=0){
fprintf(stderr, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y);
break; break;
}else{ }else{
fprintf(stderr, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
} }
@ -1940,7 +1940,7 @@ static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
level = get_vlc2(&s->gb, dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); level = get_vlc2(&s->gb, dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
} }
if (level < 0){ if (level < 0){
fprintf(stderr, "illegal dc vlc\n"); av_log(s->avctx, AV_LOG_ERROR, "illegal dc vlc\n");
return -1; return -1;
} }
@ -1987,7 +1987,7 @@ static int msmpeg4_decode_motion(MpegEncContext * s,
code = get_vlc2(&s->gb, mv->vlc.table, MV_VLC_BITS, 2); code = get_vlc2(&s->gb, mv->vlc.table, MV_VLC_BITS, 2);
if (code < 0){ if (code < 0){
fprintf(stderr, "illegal MV code at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "illegal MV code at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
if (code == mv->n) { if (code == mv->n) {

@ -51,7 +51,7 @@ typedef struct MsrleContext {
#define FETCH_NEXT_STREAM_BYTE() \ #define FETCH_NEXT_STREAM_BYTE() \
if (stream_ptr >= s->size) \ if (stream_ptr >= s->size) \
{ \ { \
printf(" MS RLE: stream ptr just went out of bounds (1)\n"); \ av_log(s->avctx, AV_LOG_ERROR, " MS RLE: stream ptr just went out of bounds (1)\n"); \
return; \ return; \
} \ } \
stream_byte = s->buf[stream_ptr++]; stream_byte = s->buf[stream_ptr++];
@ -90,14 +90,14 @@ static void msrle_decode_pal8(MsrleContext *s)
/* copy pixels from encoded stream */ /* copy pixels from encoded stream */
if ((row_ptr + pixel_ptr + stream_byte > frame_size) || if ((row_ptr + pixel_ptr + stream_byte > frame_size) ||
(row_ptr < 0)) { (row_ptr < 0)) {
printf(" MS RLE: frame ptr just went out of bounds (1)\n"); av_log(s->avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (1)\n");
return; return;
} }
rle_code = stream_byte; rle_code = stream_byte;
extra_byte = stream_byte & 0x01; extra_byte = stream_byte & 0x01;
if (stream_ptr + rle_code + extra_byte > s->size) { if (stream_ptr + rle_code + extra_byte > s->size) {
printf(" MS RLE: stream ptr just went out of bounds (2)\n"); av_log(s->avctx, AV_LOG_ERROR, " MS RLE: stream ptr just went out of bounds (2)\n");
return; return;
} }
@ -115,7 +115,7 @@ static void msrle_decode_pal8(MsrleContext *s)
/* decode a run of data */ /* decode a run of data */
if ((row_ptr + pixel_ptr + stream_byte > frame_size) || if ((row_ptr + pixel_ptr + stream_byte > frame_size) ||
(row_ptr < 0)) { (row_ptr < 0)) {
printf(" MS RLE: frame ptr just went out of bounds (2)\n"); av_log(s->avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (2)\n");
return; return;
} }
@ -137,7 +137,7 @@ static void msrle_decode_pal8(MsrleContext *s)
/* one last sanity check on the way out */ /* one last sanity check on the way out */
if (stream_ptr < s->size) if (stream_ptr < s->size)
printf(" MS RLE: ended frame decode with bytes left over (%d < %d)\n", av_log(s->avctx, AV_LOG_ERROR, " MS RLE: ended frame decode with bytes left over (%d < %d)\n",
stream_ptr, s->size); stream_ptr, s->size);
} }
@ -165,12 +165,12 @@ static int msrle_decode_frame(AVCodecContext *avctx,
s->frame.reference = 1; s->frame.reference = 1;
if (avctx->get_buffer(avctx, &s->frame)) { if (avctx->get_buffer(avctx, &s->frame)) {
printf (" MS RLE: get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, " MS RLE: get_buffer() failed\n");
return -1; return -1;
} }
if (s->prev_frame.data[0] && (s->frame.linesize[0] != s->prev_frame.linesize[0])) if (s->prev_frame.data[0] && (s->frame.linesize[0] != s->prev_frame.linesize[0]))
printf (" MS RLE: Buffer linesize changed: current %u, previous %u.\n" av_log(avctx, AV_LOG_ERROR, " MS RLE: Buffer linesize changed: current %u, previous %u.\n"
" Expect wrong image and/or crash!\n", " Expect wrong image and/or crash!\n",
s->frame.linesize[0], s->prev_frame.linesize[0]); s->frame.linesize[0], s->prev_frame.linesize[0]);

@ -42,7 +42,7 @@
#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) #define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
#define CHECK_STREAM_PTR(n) \ #define CHECK_STREAM_PTR(n) \
if ((stream_ptr + n) > s->size ) { \ if ((stream_ptr + n) > s->size ) { \
printf (" MS Video-1 warning: stream_ptr out of bounds (%d >= %d)\n", \ av_log(s->avctx, AV_LOG_ERROR, " MS Video-1 warning: stream_ptr out of bounds (%d >= %d)\n", \
stream_ptr + n, s->size); \ stream_ptr + n, s->size); \
return; \ return; \
} }
@ -322,12 +322,12 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
s->size = buf_size; s->size = buf_size;
if (avctx->get_buffer(avctx, &s->frame)) { if (avctx->get_buffer(avctx, &s->frame)) {
printf (" MS Video-1 Video: get_buffer() failed\n"); av_log(s->avctx, AV_LOG_ERROR, " MS Video-1 Video: get_buffer() failed\n");
return -1; return -1;
} }
if (s->prev_frame.data[0] &&(s->frame.linesize[0] != s->prev_frame.linesize[0])) if (s->prev_frame.data[0] &&(s->frame.linesize[0] != s->prev_frame.linesize[0]))
printf (" MS Video-1: Buffer linesize changed: current %u, previous %u.\n" av_log(avctx, AV_LOG_ERROR, " MS Video-1: Buffer linesize changed: current %u, previous %u.\n"
" Expect wrong image and/or crash!\n", " Expect wrong image and/or crash!\n",
s->frame.linesize[0], s->prev_frame.linesize[0]); s->frame.linesize[0], s->prev_frame.linesize[0]);

@ -47,7 +47,7 @@ static int oggvorbis_encode_init(AVCodecContext *avccontext) {
vorbis_info_init(&context->vi) ; vorbis_info_init(&context->vi) ;
if(oggvorbis_init_encoder(&context->vi, avccontext) < 0) { if(oggvorbis_init_encoder(&context->vi, avccontext) < 0) {
fprintf(stderr, "oggvorbis_encode_init: init_encoder failed") ; av_log(avccontext, AV_LOG_ERROR, "oggvorbis_encode_init: init_encoder failed") ;
return -1 ; return -1 ;
} }
vorbis_analysis_init(&context->vd, &context->vi) ; vorbis_analysis_init(&context->vd, &context->vi) ;
@ -112,7 +112,7 @@ static int oggvorbis_encode_close(AVCodecContext *avccontext) {
/* We need to write all the remaining packets into the stream /* We need to write all the remaining packets into the stream
* on closing */ * on closing */
fprintf(stderr, "fixme: not all packets written on oggvorbis_encode_close()\n") ; av_log(avccontext, AV_LOG_ERROR, "fixme: not all packets written on oggvorbis_encode_close()\n") ;
/* /*
while(vorbis_bitrate_flushpacket(&context->vd, &op)) { while(vorbis_bitrate_flushpacket(&context->vd, &op)) {
@ -195,7 +195,7 @@ static int oggvorbis_decode_frame(AVCodecContext *avccontext,
} }
if(op->packetno == 3) { if(op->packetno == 3) {
fprintf(stderr, "vorbis_decode: %d channel, %ldHz, encoder `%s'\n", av_log(avccontext, AV_LOG_ERROR, "vorbis_decode: %d channel, %ldHz, encoder `%s'\n",
context->vi.channels, context->vi.rate, context->vc.vendor); context->vi.channels, context->vi.rate, context->vc.vendor);
avccontext->channels = context->vi.channels ; avccontext->channels = context->vi.channels ;

@ -89,7 +89,7 @@ static int parse_double(const AVOption *c, char *s, double *var)
d = atof(s); d = atof(s);
if (c->min != c->max) { if (c->min != c->max) {
if (d < c->min || d > c->max) { if (d < c->min || d > c->max) {
fprintf(stderr, "Option: %s double value: %f out of range <%f, %f>\n", av_log(NULL, AV_LOG_ERROR, "Option: %s double value: %f out of range <%f, %f>\n",
c->name, d, c->min, c->max); c->name, d, c->min, c->max);
return -1; return -1;
} }
@ -106,7 +106,7 @@ static int parse_int(const AVOption* c, char* s, int* var)
i = atoi(s); i = atoi(s);
if (c->min != c->max) { if (c->min != c->max) {
if (i < (int)c->min || i > (int)c->max) { if (i < (int)c->min || i > (int)c->max) {
fprintf(stderr, "Option: %s integer value: %d out of range <%d, %d>\n", av_log(NULL, AV_LOG_ERROR, "Option: %s integer value: %d out of range <%d, %d>\n",
c->name, i, (int)c->min, (int)c->max); c->name, i, (int)c->min, (int)c->max);
return -1; return -1;
} }
@ -136,7 +136,7 @@ static int parse_string(const AVOption *c, char *s, void* strct, char **var)
//printf("parsed Rc: %d,%d,%d,%f (%d)\n", sf,ef,qs,qf, avctx->rc_override_count); //printf("parsed Rc: %d,%d,%d,%f (%d)\n", sf,ef,qs,qf, avctx->rc_override_count);
} else { } else {
printf("incorrect/unparsable Rc: \"%s\"\n", s); av_log(NULL, AV_LOG_ERROR, "incorrect/unparsable Rc: \"%s\"\n", s);
} }
} else } else
*var = av_strdup(s); *var = av_strdup(s);

@ -244,7 +244,7 @@ static int ra288_decode_frame(AVCodecContext * avctx,
int i,j; int i,j;
if(buf_size<w*h) if(buf_size<w*h)
{ {
fprintf(stderr,"ffra288: Error! Input buffer is too small [%d<%d]\n",buf_size,w*h); av_log(avctx, AV_LOG_ERROR, "ffra288: Error! Input buffer is too small [%d<%d]\n",buf_size,w*h);
return 0; return 0;
} }
datao = data; datao = data;
@ -260,7 +260,7 @@ static int ra288_decode_frame(AVCodecContext * avctx,
} }
else else
{ {
fprintf(stderr,"ffra288: Error: need extra data!!!\n"); av_log(avctx, AV_LOG_ERROR, "ffra288: Error: need extra data!!!\n");
return 0; return 0;
} }
} }

@ -109,7 +109,7 @@ int ff_rate_control_init(MpegEncContext *s)
&rce->pict_type, &rce->qscale, &rce->i_tex_bits, &rce->p_tex_bits, &rce->mv_bits, &rce->misc_bits, &rce->pict_type, &rce->qscale, &rce->i_tex_bits, &rce->p_tex_bits, &rce->mv_bits, &rce->misc_bits,
&rce->f_code, &rce->b_code, &rce->mc_mb_var_sum, &rce->mb_var_sum, &rce->i_count); &rce->f_code, &rce->b_code, &rce->mc_mb_var_sum, &rce->mb_var_sum, &rce->i_count);
if(e!=12){ if(e!=12){
fprintf(stderr, "statistics are damaged at line %d, parser out=%d\n", i, e); av_log(s->avctx, AV_LOG_ERROR, "statistics are damaged at line %d, parser out=%d\n", i, e);
return -1; return -1;
} }
p= next; p= next;
@ -183,14 +183,14 @@ void ff_rate_control_uninit(MpegEncContext *s)
static inline double qp2bits(RateControlEntry *rce, double qp){ static inline double qp2bits(RateControlEntry *rce, double qp){
if(qp<=0.0){ if(qp<=0.0){
fprintf(stderr, "qp<=0.0\n"); av_log(NULL, AV_LOG_ERROR, "qp<=0.0\n");
} }
return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits+1)/ qp; return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits+1)/ qp;
} }
static inline double bits2qp(RateControlEntry *rce, double bits){ static inline double bits2qp(RateControlEntry *rce, double bits){
if(bits<0.9){ if(bits<0.9){
fprintf(stderr, "bits<0.9\n"); av_log(NULL, AV_LOG_ERROR, "bits<0.9\n");
} }
return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits+1)/ bits; return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits+1)/ bits;
} }
@ -213,9 +213,9 @@ static void update_rc_buffer(MpegEncContext *s, int frame_size){
} }
if(rcc->buffer_index < 0) if(rcc->buffer_index < 0)
fprintf(stderr, "rc buffer underflow\n"); av_log(s->avctx, AV_LOG_ERROR, "rc buffer underflow\n");
if(rcc->buffer_index >= s->avctx->rc_buffer_size) if(rcc->buffer_index >= s->avctx->rc_buffer_size)
fprintf(stderr, "rc buffer overflow\n"); av_log(s->avctx, AV_LOG_ERROR, "rc buffer overflow\n");
} }
} }
@ -667,7 +667,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s)
} }
if(s->avctx->debug&FF_DEBUG_RC){ 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", av_log(s->avctx, AV_LOG_DEBUG, "%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",
av_get_pict_type_char(pict_type), qmin, q, qmax, picture_number, (int)wanted_bits/1000, (int)s->total_bits/1000, av_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 br_compensation, short_term_q, s->frame_bits, pic->mb_var_sum, pic->mc_mb_var_sum, s->bit_rate/1000, (int)fps
); );
@ -732,7 +732,7 @@ static int init_pass2(MpegEncContext *s)
all_const_bits= const_bits[I_TYPE] + const_bits[P_TYPE] + const_bits[B_TYPE]; all_const_bits= const_bits[I_TYPE] + const_bits[P_TYPE] + const_bits[B_TYPE];
if(all_available_bits < all_const_bits){ if(all_available_bits < all_const_bits){
fprintf(stderr, "requested bitrate is to low\n"); av_log(s->avctx, AV_LOG_ERROR, "requested bitrate is to low\n");
return -1; return -1;
} }
@ -823,7 +823,7 @@ static int init_pass2(MpegEncContext *s)
av_free(blured_qscale); av_free(blured_qscale);
if(abs(expected_bits/all_available_bits - 1.0) > 0.01 ){ if(abs(expected_bits/all_available_bits - 1.0) > 0.01 ){
fprintf(stderr, "Error: 2pass curve failed to converge\n"); av_log(s->avctx, AV_LOG_ERROR, "Error: 2pass curve failed to converge\n");
return -1; return -1;
} }

@ -243,14 +243,14 @@ ReSampleContext *audio_resample_init(int output_channels, int input_channels,
if ( input_channels > 2) if ( input_channels > 2)
{ {
printf("Resampling with input channels greater than 2 unsupported."); av_log(NULL, AV_LOG_ERROR, "Resampling with input channels greater than 2 unsupported.");
return NULL; return NULL;
} }
s = av_mallocz(sizeof(ReSampleContext)); s = av_mallocz(sizeof(ReSampleContext));
if (!s) if (!s)
{ {
printf("Can't allocate memory for resample context."); av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for resample context.");
return NULL; return NULL;
} }

@ -411,7 +411,7 @@ static void roqvideo_decode_frame(RoqContext *ri)
} }
break; break;
default: default:
printf("Unknown vq code: %d\n", vqid); av_log(ri->avctx, AV_LOG_ERROR, "Unknown vq code: %d\n", vqid);
} }
} }
@ -453,7 +453,7 @@ static int roq_decode_frame(AVCodecContext *avctx,
*data_size = 0; *data_size = 0;
if (avctx->get_buffer(avctx, &s->current_frame)) { if (avctx->get_buffer(avctx, &s->current_frame)) {
printf (" RoQ: get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, " RoQ: get_buffer() failed\n");
return -1; return -1;
} }
s->y_stride = s->current_frame.linesize[0]; s->y_stride = s->current_frame.linesize[0];

@ -71,7 +71,7 @@ typedef struct RpzaContext {
total_blocks--; \ total_blocks--; \
if (total_blocks < 0) \ if (total_blocks < 0) \
{ \ { \
printf("warning: block counter just went negative (this should not happen)\n"); \ av_log(s->avctx, AV_LOG_ERROR, "warning: block counter just went negative (this should not happen)\n"); \
return; \ return; \
} \ } \
} }
@ -100,7 +100,7 @@ static void rpza_decode_stream(RpzaContext *s)
/* First byte is always 0xe1. Warn if it's different */ /* First byte is always 0xe1. Warn if it's different */
if (s->buf[stream_ptr] != 0xe1) if (s->buf[stream_ptr] != 0xe1)
printf("First chunk byte is 0x%02x instead of 0x1e\n", av_log(s->avctx, AV_LOG_ERROR, "First chunk byte is 0x%02x instead of 0x1e\n",
s->buf[stream_ptr]); s->buf[stream_ptr]);
/* Get chunk size, ingnoring first byte */ /* Get chunk size, ingnoring first byte */
@ -109,7 +109,7 @@ static void rpza_decode_stream(RpzaContext *s)
/* If length mismatch use size from MOV file and try to decode anyway */ /* If length mismatch use size from MOV file and try to decode anyway */
if (chunk_size != s->size) if (chunk_size != s->size)
printf("MOV chunk size != encoded chunk size; using MOV chunk size\n"); av_log(s->avctx, AV_LOG_ERROR, "MOV chunk size != encoded chunk size; using MOV chunk size\n");
chunk_size = s->size; chunk_size = s->size;
@ -236,7 +236,7 @@ static void rpza_decode_stream(RpzaContext *s)
/* Unknown opcode */ /* Unknown opcode */
default: default:
printf("Unknown opcode %d in rpza chunk." av_log(s->avctx, AV_LOG_ERROR, "Unknown opcode %d in rpza chunk."
" Skip remaining %d bytes of chunk data.\n", opcode, " Skip remaining %d bytes of chunk data.\n", opcode,
chunk_size - stream_ptr); chunk_size - stream_ptr);
return; return;
@ -269,7 +269,7 @@ static int rpza_decode_frame(AVCodecContext *avctx,
s->frame.reference = 1; s->frame.reference = 1;
if (avctx->get_buffer(avctx, &s->frame)) { if (avctx->get_buffer(avctx, &s->frame)) {
printf (" RPZA Video: get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, " RPZA Video: get_buffer() failed\n");
return -1; return -1;
} }

@ -216,7 +216,7 @@ int rv_decode_dc(MpegEncContext *s, int n)
get_bits(&s->gb, 9); get_bits(&s->gb, 9);
code = 1; code = 1;
} else { } else {
fprintf(stderr, "chroma dc error\n"); av_log(s->avctx, AV_LOG_ERROR, "chroma dc error\n");
return 0xffff; return 0xffff;
} }
} else { } else {
@ -286,7 +286,7 @@ static int rv10_decode_picture_header(MpegEncContext *s)
else else
s->pict_type = I_TYPE; s->pict_type = I_TYPE;
//printf("h:%X ver:%d\n",h,s->rv10_version); //printf("h:%X ver:%d\n",h,s->rv10_version);
if(!marker) printf("marker missing\n"); if(!marker) av_log(s->avctx, AV_LOG_ERROR, "marker missing\n");
pb_frame = get_bits(&s->gb, 1); pb_frame = get_bits(&s->gb, 1);
#ifdef DEBUG #ifdef DEBUG
@ -294,13 +294,13 @@ static int rv10_decode_picture_header(MpegEncContext *s)
#endif #endif
if (pb_frame){ if (pb_frame){
fprintf(stderr, "pb frame not supported\n"); av_log(s->avctx, AV_LOG_ERROR, "pb frame not supported\n");
return -1; return -1;
} }
s->qscale = get_bits(&s->gb, 5); s->qscale = get_bits(&s->gb, 5);
if(s->qscale==0){ if(s->qscale==0){
fprintf(stderr, "error, qscale:0\n"); av_log(s->avctx, AV_LOG_ERROR, "error, qscale:0\n");
return -1; return -1;
} }
@ -363,7 +363,7 @@ static int rv10_decode_init(AVCodecContext *avctx)
s->h263_long_vectors=0; s->h263_long_vectors=0;
break; break;
default: default:
fprintf(stderr, "unknown header %X\n", avctx->sub_id); av_log(s->avctx, AV_LOG_ERROR, "unknown header %X\n", avctx->sub_id);
} }
//printf("ver:%X\n", avctx->sub_id); //printf("ver:%X\n", avctx->sub_id);
s->flags= avctx->flags; s->flags= avctx->flags;
@ -411,19 +411,19 @@ static int rv10_decode_packet(AVCodecContext *avctx,
mb_count = rv10_decode_picture_header(s); mb_count = rv10_decode_picture_header(s);
if (mb_count < 0) { if (mb_count < 0) {
fprintf(stderr, "HEADER ERROR\n"); av_log(s->avctx, AV_LOG_ERROR, "HEADER ERROR\n");
return -1; return -1;
} }
if (s->mb_x >= s->mb_width || if (s->mb_x >= s->mb_width ||
s->mb_y >= s->mb_height) { s->mb_y >= s->mb_height) {
fprintf(stderr, "POS ERROR %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "POS ERROR %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
mb_pos = s->mb_y * s->mb_width + s->mb_x; mb_pos = s->mb_y * s->mb_width + s->mb_x;
left = s->mb_width * s->mb_height - mb_pos; left = s->mb_width * s->mb_height - mb_pos;
if (mb_count > left) { if (mb_count > left) {
fprintf(stderr, "COUNT ERROR\n"); av_log(s->avctx, AV_LOG_ERROR, "COUNT ERROR\n");
return -1; return -1;
} }
@ -463,7 +463,7 @@ static int rv10_decode_packet(AVCodecContext *avctx,
s->mv_dir = MV_DIR_FORWARD; s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16; s->mv_type = MV_TYPE_16X16;
if (ff_h263_decode_mb(s, s->block) == SLICE_ERROR) { if (ff_h263_decode_mb(s, s->block) == SLICE_ERROR) {
fprintf(stderr, "ERROR at MB %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "ERROR at MB %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
ff_h263_update_motion_val(s); ff_h263_update_motion_val(s);

@ -613,7 +613,7 @@ static int svq1_decode_frame_header (GetBitContext *bitbuf,MpegEncContext *s) {
svq1_parse_string (bitbuf, (char *) msg); svq1_parse_string (bitbuf, (char *) msg);
printf ("embedded message: \"%s\"\n", (char *) msg); av_log(s->avctx, AV_LOG_INFO, "embedded message: \"%s\"\n", (char *) msg);
} }
skip_bits (bitbuf, 2); skip_bits (bitbuf, 2);

@ -690,7 +690,7 @@ static int svq3_decode_slice_header (H264Context *h) {
if (((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 0) { if (((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 0) {
/* TODO: what? */ /* TODO: what? */
fprintf (stderr, "unsupported slice header (%02X)\n", header); av_log(h->s.avctx, AV_LOG_ERROR, "unsupported slice header (%02X)\n", header);
return -1; return -1;
} else { } else {
int length = (header >> 5) & 3; int length = (header >> 5) & 3;
@ -841,7 +841,7 @@ static int svq3_decode_frame (AVCodecContext *avctx,
s->picture_number = h->slice_num; s->picture_number = h->slice_num;
if(avctx->debug&FF_DEBUG_PICT_INFO){ if(avctx->debug&FF_DEBUG_PICT_INFO){
printf("%c hpel:%d, tpel:%d aqp:%d qp:%d\n", av_log(h->s.avctx, AV_LOG_DEBUG, "%c hpel:%d, tpel:%d aqp:%d qp:%d\n",
av_get_pict_type_char(s->pict_type), h->halfpel_flag, h->thirdpel_flag, av_get_pict_type_char(s->pict_type), h->halfpel_flag, h->thirdpel_flag,
s->adaptive_quant, s->qscale s->adaptive_quant, s->qscale
); );
@ -874,7 +874,7 @@ static int svq3_decode_frame (AVCodecContext *avctx,
h->frame_num_offset += 256; h->frame_num_offset += 256;
} }
if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) { if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) {
printf ("error in B-frame picture id\n"); av_log(h->s.avctx, AV_LOG_ERROR, "error in B-frame picture id\n");
return -1; return -1;
} }
} else { } else {
@ -920,7 +920,7 @@ static int svq3_decode_frame (AVCodecContext *avctx,
mb_type += 4; mb_type += 4;
} }
if (mb_type > 33 || svq3_decode_mb (h, mb_type)) { if (mb_type > 33 || svq3_decode_mb (h, mb_type)) {
fprintf (stderr, "error while decoding MB %d %d\n", s->mb_x, s->mb_y); av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }

@ -1,6 +1,7 @@
/* /*
* utils for libavcodec * utils for libavcodec
* Copyright (c) 2001 Fabrice Bellard. * Copyright (c) 2001 Fabrice Bellard.
* Copyright (c) 2003 Michel Bardiaux for the av_log API
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -25,6 +26,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "dsputil.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include <stdarg.h>
void *av_mallocz(unsigned int size) void *av_mallocz(unsigned int size)
{ {
@ -766,3 +768,52 @@ int64_t av_rescale(int64_t a, int b, int c){
return ((h/c)<<32) + l/c; return ((h/c)<<32) + l/c;
} }
/* av_log API */
#ifdef AV_LOG_TRAP_PRINTF
#undef stderr
#undef fprintf
#endif
static int av_log_level = AV_LOG_DEBUG;
static void av_log_default_callback(AVCodecContext* avctx, int level, const char* fmt, va_list vl)
{
if(level>av_log_level)
return;
if(avctx)
fprintf(stderr, "[%s @ %p]", avctx->codec->name, avctx);
vfprintf(stderr, fmt, vl);
}
static void (*av_log_callback)(AVCodecContext*, int, const char*, va_list) = av_log_default_callback;
void av_log(AVCodecContext* avctx, int level, const char *fmt, ...)
{
va_list vl;
va_start(vl, fmt);
av_vlog(avctx, level, fmt, vl);
va_end(vl);
}
void av_vlog(AVCodecContext* avctx, int level, const char *fmt, va_list vl)
{
av_log_callback(avctx, level, fmt, vl);
}
int av_log_get_level(void)
{
return av_log_level;
}
void av_log_set_level(int level)
{
av_log_level = level;
}
void av_log_set_callback(void (*callback)(AVCodecContext*, int, const char*, va_list))
{
av_log_callback = callback;
}

@ -57,7 +57,7 @@ static int decode_frame(AVCodecContext *avctx,
p->reference= 0; p->reference= 0;
if(avctx->get_buffer(avctx, p) < 0){ if(avctx->get_buffer(avctx, p) < 0){
fprintf(stderr, "get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1; return -1;
} }
p->pict_type= I_TYPE; p->pict_type= I_TYPE;

@ -1109,7 +1109,7 @@ static void unpack_token(GetBitContext *gb, int token, int *zero_run,
break; break;
default: default:
printf (" vp3: help! Got a bad token: %d > 31\n", token); av_log(NULL, AV_LOG_ERROR, " vp3: help! Got a bad token: %d > 31\n", token);
break; break;
} }
@ -1549,7 +1549,7 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
/* if the fragment is in bounds, check its coding status */ /* if the fragment is in bounds, check its coding status */
current_fragment = s->superblock_fragments[i * 16 + j]; current_fragment = s->superblock_fragments[i * 16 + j];
if (current_fragment >= s->fragment_count) { if (current_fragment >= s->fragment_count) {
printf (" vp3:unpack_superblocks(): bad fragment number (%d >= %d)\n", av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_superblocks(): bad fragment number (%d >= %d)\n",
current_fragment, s->fragment_count); current_fragment, s->fragment_count);
return 1; return 1;
} }
@ -1685,7 +1685,7 @@ static int unpack_modes(Vp3DecodeContext *s, GetBitContext *gb)
(s->macroblock_coding[current_macroblock] == MODE_COPY)) (s->macroblock_coding[current_macroblock] == MODE_COPY))
continue; continue;
if (current_macroblock >= s->macroblock_count) { if (current_macroblock >= s->macroblock_count) {
printf (" vp3:unpack_modes(): bad macroblock number (%d >= %d)\n", av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_modes(): bad macroblock number (%d >= %d)\n",
current_macroblock, s->macroblock_count); current_macroblock, s->macroblock_count);
return 1; return 1;
} }
@ -1703,7 +1703,7 @@ static int unpack_modes(Vp3DecodeContext *s, GetBitContext *gb)
if (current_fragment == -1) if (current_fragment == -1)
continue; continue;
if (current_fragment >= s->fragment_count) { if (current_fragment >= s->fragment_count) {
printf (" vp3:unpack_modes(): bad fragment number (%d >= %d)\n", av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_modes(): bad fragment number (%d >= %d)\n",
current_fragment, s->fragment_count); current_fragment, s->fragment_count);
return 1; return 1;
} }
@ -1764,14 +1764,14 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
(s->macroblock_coding[current_macroblock] == MODE_COPY)) (s->macroblock_coding[current_macroblock] == MODE_COPY))
continue; continue;
if (current_macroblock >= s->macroblock_count) { if (current_macroblock >= s->macroblock_count) {
printf (" vp3:unpack_vectors(): bad macroblock number (%d >= %d)\n", av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_vectors(): bad macroblock number (%d >= %d)\n",
current_macroblock, s->macroblock_count); current_macroblock, s->macroblock_count);
return 1; return 1;
} }
current_fragment = s->macroblock_fragments[current_macroblock * 6]; current_fragment = s->macroblock_fragments[current_macroblock * 6];
if (current_fragment >= s->fragment_count) { if (current_fragment >= s->fragment_count) {
printf (" vp3:unpack_vectors(): bad fragment number (%d >= %d\n", av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_vectors(): bad fragment number (%d >= %d\n",
current_fragment, s->fragment_count); current_fragment, s->fragment_count);
return 1; return 1;
} }
@ -1887,7 +1887,7 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
if (current_fragment == -1) if (current_fragment == -1)
continue; continue;
if (current_fragment >= s->fragment_count) { if (current_fragment >= s->fragment_count) {
printf (" vp3:unpack_vectors(): bad fragment number (%d >= %d)\n", av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_vectors(): bad fragment number (%d >= %d)\n",
current_fragment, s->fragment_count); current_fragment, s->fragment_count);
return 1; return 1;
} }
@ -1929,7 +1929,7 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
if ((first_fragment >= s->fragment_count) || if ((first_fragment >= s->fragment_count) ||
(last_fragment >= s->fragment_count)) { (last_fragment >= s->fragment_count)) {
printf (" vp3:unpack_vlcs(): bad fragment number (%d -> %d ?)\n", av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_vlcs(): bad fragment number (%d -> %d ?)\n",
first_fragment, last_fragment); first_fragment, last_fragment);
return 0; return 0;
} }
@ -2393,7 +2393,7 @@ static void render_fragments(Vp3DecodeContext *s,
for (x = 0; x < width; x += 8, i++) { for (x = 0; x < width; x += 8, i++) {
if ((i < 0) || (i >= s->fragment_count)) { if ((i < 0) || (i >= s->fragment_count)) {
printf (" vp3:render_fragments(): bad fragment number (%d)\n", i); av_log(s->avctx, AV_LOG_ERROR, " vp3:render_fragments(): bad fragment number (%d)\n", i);
return; return;
} }
@ -2424,7 +2424,7 @@ static void render_fragments(Vp3DecodeContext *s,
src_x= (motion_x>>1) + x; src_x= (motion_x>>1) + x;
src_y= (motion_y>>1) + y; src_y= (motion_y>>1) + y;
if ((motion_x == 0xbeef) || (motion_y == 0xbeef)) if ((motion_x == 0xbeef) || (motion_y == 0xbeef))
printf (" help! got beefy vector! (%X, %X)\n", motion_x, motion_y); av_log(s->avctx, AV_LOG_ERROR, " help! got beefy vector! (%X, %X)\n", motion_x, motion_y);
motion_halfpel_index = motion_x & 0x01; motion_halfpel_index = motion_x & 0x01;
motion_source += (motion_x >> 1); motion_source += (motion_x >> 1);
@ -2704,7 +2704,7 @@ static int vp3_decode_frame(AVCodecContext *avctx,
if (s->theora && get_bits1(&gb)) if (s->theora && get_bits1(&gb))
{ {
printf("Theora: bad frame indicator\n"); av_log(s->avctx, AV_LOG_ERROR, "Theora: bad frame indicator\n");
return -1; return -1;
} }
@ -2712,7 +2712,7 @@ static int vp3_decode_frame(AVCodecContext *avctx,
if (s->theora && s->keyframe) if (s->theora && s->keyframe)
{ {
if (get_bits1(&gb)) if (get_bits1(&gb))
printf("Theora: warning, unsupported keyframe coding type?!\n"); av_log(s->avctx, AV_LOG_ERROR, "Theora: warning, unsupported keyframe coding type?!\n");
skip_bits(&gb, 2); /* reserved? */ skip_bits(&gb, 2); /* reserved? */
} }
else else
@ -2743,7 +2743,7 @@ static int vp3_decode_frame(AVCodecContext *avctx,
s->golden_frame.reference = 3; s->golden_frame.reference = 3;
if(avctx->get_buffer(avctx, &s->golden_frame) < 0) { if(avctx->get_buffer(avctx, &s->golden_frame) < 0) {
printf("vp3: get_buffer() failed\n"); av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\n");
return -1; return -1;
} }
@ -2758,7 +2758,7 @@ static int vp3_decode_frame(AVCodecContext *avctx,
/* allocate a new current frame */ /* allocate a new current frame */
s->current_frame.reference = 3; s->current_frame.reference = 3;
if(avctx->get_buffer(avctx, &s->current_frame) < 0) { if(avctx->get_buffer(avctx, &s->current_frame) < 0) {
printf("vp3: get_buffer() failed\n"); av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\n");
return -1; return -1;
} }
} }
@ -2786,7 +2786,7 @@ if (!s->keyframe) {
unpack_vectors(s, &gb) || unpack_vectors(s, &gb) ||
unpack_dct_coeffs(s, &gb)) { unpack_dct_coeffs(s, &gb)) {
printf(" vp3: could not decode frame\n"); av_log(s->avctx, AV_LOG_ERROR, " vp3: could not decode frame\n");
return -1; return -1;
} }

@ -155,7 +155,7 @@ static int vqa_decode_init(AVCodecContext *avctx)
/* make sure the extradata made it */ /* make sure the extradata made it */
if (s->avctx->extradata_size != VQA_HEADER_SIZE) { if (s->avctx->extradata_size != VQA_HEADER_SIZE) {
printf(" VQA video: expected extradata size of %d\n", VQA_HEADER_SIZE); av_log(s->avctx, AV_LOG_ERROR, " VQA video: expected extradata size of %d\n", VQA_HEADER_SIZE);
return -1; return -1;
} }
@ -206,8 +206,8 @@ static int vqa_decode_init(AVCodecContext *avctx)
#define CHECK_COUNT() \ #define CHECK_COUNT() \
if (dest_index + count > dest_size) { \ if (dest_index + count > dest_size) { \
printf (" VQA video: decode_format80 problem: next op would overflow dest_index\n"); \ av_log(NULL, AV_LOG_ERROR, " VQA video: decode_format80 problem: next op would overflow dest_index\n"); \
printf (" VQA video: current dest_index = %d, count = %d, dest_size = %d\n", \ av_log(NULL, AV_LOG_ERROR, " VQA video: current dest_index = %d, count = %d, dest_size = %d\n", \
dest_index, count, dest_size); \ dest_index, count, dest_size); \
return; \ return; \
} }
@ -231,7 +231,7 @@ static void decode_format80(unsigned char *src, int src_size,
return; return;
if (dest_index >= dest_size) { if (dest_index >= dest_size) {
printf (" VQA video: decode_format80 problem: dest_index (%d) exceeded dest_size (%d)\n", av_log(NULL, AV_LOG_ERROR, " VQA video: decode_format80 problem: dest_index (%d) exceeded dest_size (%d)\n",
dest_index, dest_size); dest_index, dest_size);
return; return;
} }
@ -299,7 +299,7 @@ static void decode_format80(unsigned char *src, int src_size,
* not every entry needs to be filled */ * not every entry needs to be filled */
if (check_size) if (check_size)
if (dest_index < dest_size) if (dest_index < dest_size)
printf (" VQA video: decode_format80 problem: decode finished with dest_index (%d) < dest_size (%d)\n", av_log(NULL, AV_LOG_ERROR, " VQA video: decode_format80 problem: decode finished with dest_index (%d) < dest_size (%d)\n",
dest_index, dest_size); dest_index, dest_size);
} }
@ -367,7 +367,7 @@ static void vqa_decode_chunk(VqaContext *s)
break; break;
default: default:
printf (" VQA video: Found unknown chunk type: %c%c%c%c (%08X)\n", av_log(s->avctx, AV_LOG_ERROR, " VQA video: Found unknown chunk type: %c%c%c%c (%08X)\n",
(chunk_type >> 24) & 0xFF, (chunk_type >> 24) & 0xFF,
(chunk_type >> 16) & 0xFF, (chunk_type >> 16) & 0xFF,
(chunk_type >> 8) & 0xFF, (chunk_type >> 8) & 0xFF,
@ -384,7 +384,7 @@ static void vqa_decode_chunk(VqaContext *s)
if ((cpl0_chunk != -1) && (cplz_chunk != -1)) { if ((cpl0_chunk != -1) && (cplz_chunk != -1)) {
/* a chunk should not have both chunk types */ /* a chunk should not have both chunk types */
printf (" VQA video: problem: found both CPL0 and CPLZ chunks\n"); av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: found both CPL0 and CPLZ chunks\n");
return; return;
} }
@ -401,7 +401,7 @@ static void vqa_decode_chunk(VqaContext *s)
chunk_size = BE_32(&s->buf[cpl0_chunk + 4]); chunk_size = BE_32(&s->buf[cpl0_chunk + 4]);
/* sanity check the palette size */ /* sanity check the palette size */
if (chunk_size / 3 > 256) { if (chunk_size / 3 > 256) {
printf (" VQA video: problem: found a palette chunk with %d colors\n", av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: found a palette chunk with %d colors\n",
chunk_size / 3); chunk_size / 3);
return; return;
} }
@ -419,7 +419,7 @@ static void vqa_decode_chunk(VqaContext *s)
if ((cbf0_chunk != -1) && (cbfz_chunk != -1)) { if ((cbf0_chunk != -1) && (cbfz_chunk != -1)) {
/* a chunk should not have both chunk types */ /* a chunk should not have both chunk types */
printf (" VQA video: problem: found both CBF0 and CBFZ chunks\n"); av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: found both CBF0 and CBFZ chunks\n");
return; return;
} }
@ -438,7 +438,7 @@ static void vqa_decode_chunk(VqaContext *s)
chunk_size = BE_32(&s->buf[cbf0_chunk + 4]); chunk_size = BE_32(&s->buf[cbf0_chunk + 4]);
/* sanity check the full codebook size */ /* sanity check the full codebook size */
if (chunk_size > MAX_CODEBOOK_SIZE) { if (chunk_size > MAX_CODEBOOK_SIZE) {
printf (" VQA video: problem: CBF0 chunk too large (0x%X bytes)\n", av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: CBF0 chunk too large (0x%X bytes)\n",
chunk_size); chunk_size);
return; return;
} }
@ -451,7 +451,7 @@ static void vqa_decode_chunk(VqaContext *s)
if (vptz_chunk == -1) { if (vptz_chunk == -1) {
/* something is wrong if there is no VPTZ chunk */ /* something is wrong if there is no VPTZ chunk */
printf (" VQA video: problem: no VPTZ chunk found\n"); av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: no VPTZ chunk found\n");
return; return;
} }
@ -508,7 +508,7 @@ static void vqa_decode_chunk(VqaContext *s)
/* handle partial codebook */ /* handle partial codebook */
if ((cbp0_chunk != -1) && (cbpz_chunk != -1)) { if ((cbp0_chunk != -1) && (cbpz_chunk != -1)) {
/* a chunk should not have both chunk types */ /* a chunk should not have both chunk types */
printf (" VQA video: problem: found both CBP0 and CBPZ chunks\n"); av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: found both CBP0 and CBPZ chunks\n");
return; return;
} }
@ -573,7 +573,7 @@ static int vqa_decode_frame(AVCodecContext *avctx,
avctx->release_buffer(avctx, &s->frame); avctx->release_buffer(avctx, &s->frame);
if (avctx->get_buffer(avctx, &s->frame)) { if (avctx->get_buffer(avctx, &s->frame)) {
printf (" VQA Video: get_buffer() failed\n"); av_log(s->avctx, AV_LOG_ERROR, " VQA Video: get_buffer() failed\n");
return -1; return -1;
} }

@ -338,7 +338,7 @@ static int decode_ext_header(Wmv2Context *w){
s->slice_height = s->mb_height / code; s->slice_height = s->mb_height / code;
if(s->avctx->debug&FF_DEBUG_PICT_INFO){ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
printf("fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, code:%d, flag3:%d, slices:%d\n", av_log(s->avctx, AV_LOG_DEBUG, "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, code:%d, flag3:%d, slices:%d\n",
fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit, w->top_left_mv_flag, w->per_mb_rl_bit, code, w->flag3, fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit, w->top_left_mv_flag, w->per_mb_rl_bit, code, w->flag3,
code); code);
} }
@ -366,7 +366,7 @@ return -1;
s->pict_type = get_bits(&s->gb, 1) + 1; s->pict_type = get_bits(&s->gb, 1) + 1;
if(s->pict_type == I_TYPE){ if(s->pict_type == I_TYPE){
code = get_bits(&s->gb, 7); code = get_bits(&s->gb, 7);
printf("I7:%X/\n", code); av_log(s->avctx, AV_LOG_ERROR, "I7:%X/\n", code);
} }
s->qscale = get_bits(&s->gb, 5); s->qscale = get_bits(&s->gb, 5);
if(s->qscale < 0) if(s->qscale < 0)
@ -397,7 +397,7 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s)
s->inter_intra_pred= 0; s->inter_intra_pred= 0;
s->no_rounding = 1; s->no_rounding = 1;
if(s->avctx->debug&FF_DEBUG_PICT_INFO){ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
printf("qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n", av_log(s->avctx, AV_LOG_DEBUG, "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
s->qscale, s->qscale,
s->rl_chroma_table_index, s->rl_chroma_table_index,
s->rl_table_index, s->rl_table_index,
@ -447,7 +447,7 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s)
s->no_rounding ^= 1; s->no_rounding ^= 1;
if(s->avctx->debug&FF_DEBUG_PICT_INFO){ if(s->avctx->debug&FF_DEBUG_PICT_INFO){
printf("rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n", av_log(s->avctx, AV_LOG_DEBUG, "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
s->rl_table_index, s->rl_table_index,
s->rl_chroma_table_index, s->rl_chroma_table_index,
s->dc_table_index, s->dc_table_index,
@ -471,7 +471,7 @@ s->picture_number++; //FIXME ?
// return wmv2_decode_j_picture(w); //FIXME // return wmv2_decode_j_picture(w); //FIXME
if(w->j_type){ if(w->j_type){
printf("J-type picture isnt supported\n"); av_log(s->avctx, AV_LOG_ERROR, "J-type picture isnt supported\n");
return -1; return -1;
} }
@ -604,7 +604,7 @@ static void wmv2_add_block(Wmv2Context *w, DCTELEM *block1, uint8_t *dst, int st
memset(w->abt_block2[n], 0, 64*sizeof(DCTELEM)); memset(w->abt_block2[n], 0, 64*sizeof(DCTELEM));
break; break;
default: default:
fprintf(stderr, "internal error in WMV2 abt\n"); av_log(s->avctx, AV_LOG_ERROR, "internal error in WMV2 abt\n");
} }
} }
@ -738,7 +738,7 @@ static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
s->mb_intra = 1; s->mb_intra = 1;
code = get_vlc2(&s->gb, mb_intra_vlc.table, MB_INTRA_VLC_BITS, 2); code = get_vlc2(&s->gb, mb_intra_vlc.table, MB_INTRA_VLC_BITS, 2);
if (code < 0){ if (code < 0){
fprintf(stderr, "II-cbp illegal at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "II-cbp illegal at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
/* predict coded block pattern */ /* predict coded block pattern */
@ -784,7 +784,7 @@ static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (wmv2_decode_inter_block(w, block[i], i, (cbp >> (5 - i)) & 1) < 0) if (wmv2_decode_inter_block(w, block[i], i, (cbp >> (5 - i)) & 1) < 0)
{ {
fprintf(stderr,"\nerror while decoding inter block: %d x %d (%d)\n", s->mb_x, s->mb_y, i); av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding inter block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
return -1; return -1;
} }
} }
@ -805,7 +805,7 @@ static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
{ {
fprintf(stderr,"\nerror while decoding intra block: %d x %d (%d)\n", s->mb_x, s->mb_y, i); av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding intra block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
return -1; return -1;
} }
} }

@ -116,7 +116,7 @@ static int xan_decode_init(AVCodecContext *avctx)
if ((avctx->codec->id == CODEC_ID_XAN_WC3) && if ((avctx->codec->id == CODEC_ID_XAN_WC3) &&
(s->avctx->palctrl == NULL)) { (s->avctx->palctrl == NULL)) {
printf (" WC3 Xan video: palette expected.\n"); av_log(avctx, AV_LOG_ERROR, " WC3 Xan video: palette expected.\n");
return -1; return -1;
} }
@ -336,7 +336,7 @@ static void inline xan_wc3_build_palette(XanContext *s,
break; break;
default: default:
printf (" Xan WC3: Unhandled colorspace\n"); av_log(s->avctx, AV_LOG_ERROR, " Xan WC3: Unhandled colorspace\n");
break; break;
} }
} }
@ -457,7 +457,7 @@ static void inline xan_wc3_output_pixel_run(XanContext *s,
break; break;
default: default:
printf (" Xan WC3: Unhandled colorspace\n"); av_log(s->avctx, AV_LOG_ERROR, " Xan WC3: Unhandled colorspace\n");
break; break;
} }
} }
@ -600,7 +600,7 @@ static void inline xan_wc3_copy_pixel_run(XanContext *s,
break; break;
default: default:
printf (" Xan WC3: Unhandled colorspace\n"); av_log(s->avctx, AV_LOG_ERROR, " Xan WC3: Unhandled colorspace\n");
break; break;
} }
} }
@ -761,7 +761,7 @@ static int xan_decode_frame(AVCodecContext *avctx,
} }
if (avctx->get_buffer(avctx, &s->current_frame)) { if (avctx->get_buffer(avctx, &s->current_frame)) {
printf (" Xan Video: get_buffer() failed\n"); av_log(s->avctx, AV_LOG_ERROR, " Xan Video: get_buffer() failed\n");
return -1; return -1;
} }
s->current_frame.reference = 3; s->current_frame.reference = 3;

Loading…
Cancel
Save