Mercurial > libavcodec.hg
comparison mpegvideo.c @ 1722:7e040c2a86e4 libavcodec
warn the user if we had to clip some dct coefficient due to a crappy format which doenst support the whole needed range (msmpeg4/wmv mostly but mpeg1 too to a lesser extend)
author | michael |
---|---|
date | Sun, 04 Jan 2004 14:43:52 +0000 |
parents | 4e72fb256b25 |
children | 033d889d7c2c |
comparison
equal
deleted
inserted
replaced
1721:8158e66f1f75 | 1722:7e040c2a86e4 |
---|---|
3138 static inline void clip_coeffs(MpegEncContext *s, DCTELEM *block, int last_index) | 3138 static inline void clip_coeffs(MpegEncContext *s, DCTELEM *block, int last_index) |
3139 { | 3139 { |
3140 int i; | 3140 int i; |
3141 const int maxlevel= s->max_qcoeff; | 3141 const int maxlevel= s->max_qcoeff; |
3142 const int minlevel= s->min_qcoeff; | 3142 const int minlevel= s->min_qcoeff; |
3143 int overflow=0; | |
3143 | 3144 |
3144 if(s->mb_intra){ | 3145 if(s->mb_intra){ |
3145 i=1; //skip clipping of intra dc | 3146 i=1; //skip clipping of intra dc |
3146 }else | 3147 }else |
3147 i=0; | 3148 i=0; |
3148 | 3149 |
3149 for(;i<=last_index; i++){ | 3150 for(;i<=last_index; i++){ |
3150 const int j= s->intra_scantable.permutated[i]; | 3151 const int j= s->intra_scantable.permutated[i]; |
3151 int level = block[j]; | 3152 int level = block[j]; |
3152 | 3153 |
3153 if (level>maxlevel) level=maxlevel; | 3154 if (level>maxlevel){ |
3154 else if(level<minlevel) level=minlevel; | 3155 level=maxlevel; |
3155 | 3156 overflow++; |
3157 }else if(level<minlevel){ | |
3158 level=minlevel; | |
3159 overflow++; | |
3160 } | |
3161 | |
3156 block[j]= level; | 3162 block[j]= level; |
3157 } | 3163 } |
3164 | |
3165 if(overflow && s->avctx->mb_decision == FF_MB_DECISION_SIMPLE) | |
3166 av_log(s->avctx, AV_LOG_INFO, "warning, cliping %d dct coefficents to %d..%d\n", overflow, minlevel, maxlevel); | |
3158 } | 3167 } |
3159 | 3168 |
3160 #if 0 | 3169 #if 0 |
3161 static int pix_vcmp16x8(uint8_t *s, int stride){ //FIXME move to dsputil & optimize | 3170 static int pix_vcmp16x8(uint8_t *s, int stride){ //FIXME move to dsputil & optimize |
3162 int score=0; | 3171 int score=0; |