Mercurial > libavcodec.hg
changeset 4594:a96d905dcbaa libavcodec
Add av_ prefix to clip functions
author | reimar |
---|---|
date | Sun, 25 Feb 2007 10:27:12 +0000 |
parents | 2aea8bf268d8 |
children | 340c876320eb |
files | adpcm.c cavs.c cavsdsp.c cook.c dsicinav.c dsputil.c error_resilience.c eval.c flacenc.c g726.c h263.c h264.c imc.c indeo2.c jpeg_ls.c motion_est.c mpegvideo.c ratecontrol.c resample2.c snow.c svq1.c svq3.c truemotion2.c truespeech.c vc1.c vc1dsp.c vmdav.c vp3.c vp5.c vp56.c vp6.c wmv2.c |
diffstat | 32 files changed, 177 insertions(+), 177 deletions(-) [+] |
line wrap: on
line diff
--- a/adpcm.c Sun Feb 25 07:53:44 2007 +0000 +++ b/adpcm.c Sun Feb 25 10:27:12 2007 +0000 @@ -209,7 +209,7 @@ int nibble = FFMIN(7, abs(delta)*4/step_table[c->step_index]) + (delta<0)*8; c->prev_sample = c->prev_sample + ((step_table[c->step_index] * yamaha_difflookup[nibble]) / 8); CLAMP_TO_SHORT(c->prev_sample); - c->step_index = clip(c->step_index + index_table[nibble], 0, 88); + c->step_index = av_clip(c->step_index + index_table[nibble], 0, 88); return nibble; } @@ -224,7 +224,7 @@ else bias=-c->idelta/2; nibble= (nibble + bias) / c->idelta; - nibble= clip(nibble, -8, 7)&0x0F; + nibble= av_clip(nibble, -8, 7)&0x0F; predictor += (signed)((nibble & 0x08)?(nibble - 0x10):(nibble)) * c->idelta; CLAMP_TO_SHORT(predictor); @@ -254,7 +254,7 @@ c->predictor = c->predictor + ((c->step * yamaha_difflookup[nibble]) / 8); CLAMP_TO_SHORT(c->predictor); c->step = (c->step * yamaha_indexscale[nibble]) >> 8; - c->step = clip(c->step, 127, 24567); + c->step = av_clip(c->step, 127, 24567); return nibble; } @@ -324,8 +324,8 @@ if(version == CODEC_ID_ADPCM_MS) { const int predictor = ((nodes[j]->sample1 * c->coeff1) + (nodes[j]->sample2 * c->coeff2)) / 256; const int div = (sample - predictor) / step; - const int nmin = clip(div-range, -8, 6); - const int nmax = clip(div+range, -7, 7); + const int nmin = av_clip(div-range, -8, 6); + const int nmax = av_clip(div+range, -7, 7); for(nidx=nmin; nidx<=nmax; nidx++) { const int nibble = nidx & 0xf; int dec_sample = predictor + nidx * step; @@ -372,8 +372,8 @@ #define LOOP_NODES(NAME, STEP_TABLE, STEP_INDEX)\ const int predictor = nodes[j]->sample1;\ const int div = (sample - predictor) * 4 / STEP_TABLE;\ - int nmin = clip(div-range, -7, 6);\ - int nmax = clip(div+range, -6, 7);\ + int nmin = av_clip(div-range, -7, 6);\ + int nmax = av_clip(div+range, -6, 7);\ if(nmin<=0) nmin--; /* distinguish -0 from +0 */\ if(nmax<0) nmax--;\ for(nidx=nmin; nidx<=nmax; nidx++) {\ @@ -381,9 +381,9 @@ int dec_sample = predictor + (STEP_TABLE * yamaha_difflookup[nibble]) / 8;\ STORE_NODE(NAME, STEP_INDEX);\ } - LOOP_NODES(ima, step_table[step], clip(step + index_table[nibble], 0, 88)); + LOOP_NODES(ima, step_table[step], av_clip(step + index_table[nibble], 0, 88)); } else { //CODEC_ID_ADPCM_YAMAHA - LOOP_NODES(yamaha, step, clip((step * yamaha_indexscale[nibble]) >> 8, 127, 24567)); + LOOP_NODES(yamaha, step, av_clip((step * yamaha_indexscale[nibble]) >> 8, 127, 24567)); #undef LOOP_NODES #undef STORE_NODE } @@ -734,7 +734,7 @@ c->predictor += (c->step * yamaha_difflookup[nibble]) / 8; CLAMP_TO_SHORT(c->predictor); c->step = (c->step * yamaha_indexscale[nibble]) >> 8; - c->step = clip(c->step, 127, 24567); + c->step = av_clip(c->step, 127, 24567); return c->predictor; } @@ -974,10 +974,10 @@ n = buf_size - 7 * avctx->channels; if (n < 0) return -1; - block_predictor[0] = clip(*src++, 0, 7); + block_predictor[0] = av_clip(*src++, 0, 7); block_predictor[1] = 0; if (st) - block_predictor[1] = clip(*src++, 0, 7); + block_predictor[1] = av_clip(*src++, 0, 7); c->status[0].idelta = (int16_t)((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; if (st){ @@ -1299,8 +1299,8 @@ c->status[i].step_index += table[delta & (~signmask)]; - c->status[i].step_index = clip(c->status[i].step_index, 0, 88); - c->status[i].predictor = clip(c->status[i].predictor, -32768, 32767); + c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88); + c->status[i].predictor = av_clip(c->status[i].predictor, -32768, 32767); *samples++ = c->status[i].predictor; }
--- a/cavs.c Sun Feb 25 07:53:44 2007 +0000 +++ b/cavs.c Sun Feb 25 10:27:12 2007 +0000 @@ -128,9 +128,9 @@ } #define SET_PARAMS \ - alpha = alpha_tab[clip(qp_avg + h->alpha_offset,0,63)]; \ - beta = beta_tab[clip(qp_avg + h->beta_offset, 0,63)]; \ - tc = tc_tab[clip(qp_avg + h->alpha_offset,0,63)]; + alpha = alpha_tab[av_clip(qp_avg + h->alpha_offset,0,63)]; \ + beta = beta_tab[av_clip(qp_avg + h->beta_offset, 0,63)]; \ + tc = tc_tab[av_clip(qp_avg + h->alpha_offset,0,63)]; /** * in-loop deblocking filter for a single macroblock
--- a/cavsdsp.c Sun Feb 25 07:53:44 2007 +0000 +++ b/cavsdsp.c Sun Feb 25 10:27:12 2007 +0000 @@ -63,16 +63,16 @@ int q0 = Q0; if(abs(p0-q0)<alpha && abs(P1-p0)<beta && abs(Q1-q0)<beta) { - int delta = clip(((q0-p0)*3+P1-Q1+4)>>3,-tc, tc); - P0 = clip_uint8(p0+delta); - Q0 = clip_uint8(q0-delta); + int delta = av_clip(((q0-p0)*3+P1-Q1+4)>>3,-tc, tc); + P0 = av_clip_uint8(p0+delta); + Q0 = av_clip_uint8(q0-delta); if(abs(P2-p0)<beta) { - delta = clip(((P0-P1)*3+P2-Q0+4)>>3, -tc, tc); - P1 = clip_uint8(P1+delta); + delta = av_clip(((P0-P1)*3+P2-Q0+4)>>3, -tc, tc); + P1 = av_clip_uint8(P1+delta); } if(abs(Q2-q0)<beta) { - delta = clip(((Q1-Q0)*3+P0-Q2+4)>>3, -tc, tc); - Q1 = clip_uint8(Q1-delta); + delta = av_clip(((Q1-Q0)*3+P0-Q2+4)>>3, -tc, tc); + Q1 = av_clip_uint8(Q1-delta); } } } @@ -98,9 +98,9 @@ static inline void loop_filter_c1(uint8_t *p0_p,int stride,int alpha, int beta, int tc) { if(abs(P0-Q0)<alpha && abs(P1-P0)<beta && abs(Q1-Q0)<beta) { - int delta = clip(((Q0-P0)*3+P1-Q1+4)>>3, -tc, tc); - P0 = clip_uint8(P0+delta); - Q0 = clip_uint8(Q0-delta); + int delta = av_clip(((Q0-P0)*3+P1-Q1+4)>>3, -tc, tc); + P0 = av_clip_uint8(P0+delta); + Q0 = av_clip_uint8(Q0-delta); } }
--- a/cook.c Sun Feb 25 07:53:44 2007 +0000 +++ b/cook.c Sun Feb 25 10:27:12 2007 +0000 @@ -998,7 +998,7 @@ */ for (j = 0; j < q->samples_per_channel; j++) { out[chan + q->nb_channels * j] = - clip(lrintf(q->mono_mdct_output[j]), -32768, 32767); + av_clip(lrintf(q->mono_mdct_output[j]), -32768, 32767); } }
--- a/dsicinav.c Sun Feb 25 07:53:44 2007 +0000 +++ b/dsicinav.c Sun Feb 25 10:27:12 2007 +0000 @@ -327,7 +327,7 @@ } while (buf_size > 0) { cin->delta += cinaudio_delta16_table[*src++]; - cin->delta = clip(cin->delta, -32768, 32767); + cin->delta = av_clip(cin->delta, -32768, 32767); *samples++ = cin->delta; --buf_size; }
--- a/dsputil.c Sun Feb 25 07:53:44 2007 +0000 +++ b/dsputil.c Sun Feb 25 10:27:12 2007 +0000 @@ -1178,19 +1178,19 @@ + src[index+stride+1]* frac_x )* frac_y + r)>>(shift*2); }else{ - index= src_x + clip(src_y, 0, height)*stride; + index= src_x + av_clip(src_y, 0, height)*stride; dst[y*stride + x]= ( ( src[index ]*(s-frac_x) + src[index +1]* frac_x )*s + r)>>(shift*2); } }else{ if((unsigned)src_y < height){ - index= clip(src_x, 0, width) + src_y*stride; + index= av_clip(src_x, 0, width) + src_y*stride; dst[y*stride + x]= ( ( src[index ]*(s-frac_y) + src[index+stride ]* frac_y )*s + r)>>(shift*2); }else{ - index= clip(src_x, 0, width) + clip(src_y, 0, height)*stride; + index= av_clip(src_x, 0, width) + av_clip(src_y, 0, height)*stride; dst[y*stride + x]= src[index ]; } } @@ -2434,8 +2434,8 @@ #undef op2_put #endif -#define op_scale1(x) block[x] = clip_uint8( (block[x]*weight + offset) >> log2_denom ) -#define op_scale2(x) dst[x] = clip_uint8( (src[x]*weights + dst[x]*weightd + offset) >> (log2_denom+1)) +#define op_scale1(x) block[x] = av_clip_uint8( (block[x]*weight + offset) >> log2_denom ) +#define op_scale2(x) dst[x] = av_clip_uint8( (src[x]*weights + dst[x]*weightd + offset) >> (log2_denom+1)) #define H264_WEIGHT(W,H) \ static void weight_h264_pixels ## W ## x ## H ## _c(uint8_t *block, int stride, int log2_denom, int weight, int offset){ \ int y; \ @@ -2659,7 +2659,7 @@ ad1= FFABS(d1)>>1; - d2= clip((p0-p3)/4, -ad1, ad1); + d2= av_clip((p0-p3)/4, -ad1, ad1); src[x-2*stride] = p0 - d2; src[x+ stride] = p3 + d2; @@ -2694,7 +2694,7 @@ ad1= FFABS(d1)>>1; - d2= clip((p0-p3)/4, -ad1, ad1); + d2= av_clip((p0-p3)/4, -ad1, ad1); src[y*stride-2] = p0 - d2; src[y*stride+1] = p3 + d2; @@ -2752,17 +2752,17 @@ int i_delta; if( FFABS( p2 - p0 ) < beta ) { - pix[-2*xstride] = p1 + clip( (( p2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - p1, -tc0[i], tc0[i] ); + pix[-2*xstride] = p1 + av_clip( (( p2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - p1, -tc0[i], tc0[i] ); tc++; } if( FFABS( q2 - q0 ) < beta ) { - pix[ xstride] = q1 + clip( (( q2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - q1, -tc0[i], tc0[i] ); + pix[ xstride] = q1 + av_clip( (( q2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - q1, -tc0[i], tc0[i] ); tc++; } - i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); - pix[-xstride] = clip_uint8( p0 + i_delta ); /* p0' */ - pix[0] = clip_uint8( q0 - i_delta ); /* q0' */ + i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); + pix[-xstride] = av_clip_uint8( p0 + i_delta ); /* p0' */ + pix[0] = av_clip_uint8( q0 - i_delta ); /* q0' */ } pix += ystride; } @@ -2796,10 +2796,10 @@ FFABS( p1 - p0 ) < beta && FFABS( q1 - q0 ) < beta ) { - int delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); - - pix[-xstride] = clip_uint8( p0 + delta ); /* p0' */ - pix[0] = clip_uint8( q0 - delta ); /* q0' */ + int delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); + + pix[-xstride] = av_clip_uint8( p0 + delta ); /* p0' */ + pix[0] = av_clip_uint8( q0 - delta ); /* q0' */ } pix += ystride; }
--- a/error_resilience.c Sun Feb 25 07:53:44 2007 +0000 +++ b/error_resilience.c Sun Feb 25 10:27:12 2007 +0000 @@ -612,8 +612,8 @@ * error of the same type occured */ void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int endy, int status){ - const int start_i= clip(startx + starty * s->mb_width , 0, s->mb_num-1); - const int end_i = clip(endx + endy * s->mb_width , 0, s->mb_num); + const int start_i= av_clip(startx + starty * s->mb_width , 0, s->mb_num-1); + const int end_i = av_clip(endx + endy * s->mb_width , 0, s->mb_num); const int start_xy= s->mb_index2xy[start_i]; const int end_xy = s->mb_index2xy[end_i]; int mask= -1;
--- a/eval.c Sun Feb 25 07:53:44 2007 +0000 +++ b/eval.c Sun Feb 25 10:27:12 2007 +0000 @@ -155,7 +155,7 @@ case e_func2: return e->value * e->a.func2(p->opaque, eval_expr(p, e->param[0]), eval_expr(p, e->param[1])); case e_squish: return 1/(1+exp(4*eval_expr(p, e->param[0]))); case e_gauss: { double d = eval_expr(p, e->param[0]); return exp(-d*d/2)/sqrt(2*M_PI); } - case e_ld: return e->value * p->var[clip(eval_expr(p, e->param[0]), 0, VARS-1)]; + case e_ld: return e->value * p->var[av_clip(eval_expr(p, e->param[0]), 0, VARS-1)]; case e_while: { double d = NAN; while(eval_expr(p, e->param[0])) @@ -177,7 +177,7 @@ case e_div: return e->value * (d / d2); case e_add: return e->value * (d + d2); case e_last:return e->value * d2; - case e_st : return e->value * (p->var[clip(d, 0, VARS-1)]= d2); + case e_st : return e->value * (p->var[av_clip(d, 0, VARS-1)]= d2); } } }
--- a/flacenc.c Sun Feb 25 07:53:44 2007 +0000 +++ b/flacenc.c Sun Feb 25 10:27:12 2007 +0000 @@ -244,7 +244,7 @@ /* set compression option overrides from AVCodecContext */ if(avctx->use_lpc >= 0) { - s->options.use_lpc = clip(avctx->use_lpc, 0, 11); + s->options.use_lpc = av_clip(avctx->use_lpc, 0, 11); } if(s->options.use_lpc == 1) av_log(avctx, AV_LOG_DEBUG, " use lpc: Levinson-Durbin recursion with Welch window\n"); @@ -712,7 +712,7 @@ error=0; for(i=0; i<order; i++) { error += lpc_in[i] * (1 << sh); - lpc_out[i] = clip(lrintf(error), -qmax, qmax); + lpc_out[i] = av_clip(lrintf(error), -qmax, qmax); error -= lpc_out[i]; } *shift = sh;
--- a/g726.c Sun Feb 25 07:53:44 2007 +0000 +++ b/g726.c Sun Feb 25 10:27:12 2007 +0000 @@ -213,12 +213,12 @@ c->b[i] = 0; } else { /* This is a bit crazy, but it really is +255 not +256 */ - fa1 = clip((-c->a[0]*c->pk[0]*pk0)>>5, -256, 255); + fa1 = av_clip((-c->a[0]*c->pk[0]*pk0)>>5, -256, 255); c->a[1] += 128*pk0*c->pk[1] + fa1 - (c->a[1]>>7); - c->a[1] = clip(c->a[1], -12288, 12288); + c->a[1] = av_clip(c->a[1], -12288, 12288); c->a[0] += 64*3*pk0*c->pk[0] - (c->a[0] >> 8); - c->a[0] = clip(c->a[0], -(15360 - c->a[1]), 15360 - c->a[1]); + c->a[0] = av_clip(c->a[0], -(15360 - c->a[1]), 15360 - c->a[1]); for (i=0; i<6; i++) c->b[i] += 128*dq0*sgn(-c->dq[i].sign) - (c->b[i]>>8); @@ -248,7 +248,7 @@ c->ap += (0x200 - c->ap) >> 4; /* Update Yu and Yl */ - c->yu = clip(c->y + (((c->tbls->W[I] << 5) - c->y) >> 5), 544, 5120); + c->yu = av_clip(c->y + (((c->tbls->W[I] << 5) - c->y) >> 5), 544, 5120); c->yl += c->yu + ((-c->yl)>>6); /* Next iteration for Y */ @@ -264,7 +264,7 @@ c->se += mult(i2f(c->a[i] >> 2, &f), &c->sr[i]); c->se >>= 1; - return clip(re_signal << 2, -0xffff, 0xffff); + return av_clip(re_signal << 2, -0xffff, 0xffff); } static int g726_reset(G726Context* c, int bit_rate)
--- a/h263.c Sun Feb 25 07:53:44 2007 +0000 +++ b/h263.c Sun Feb 25 10:27:12 2007 +0000 @@ -211,7 +211,7 @@ for(i=0; i<2; i++){ int div, error; div= (s->avctx->time_base.num*1800000LL + 500LL*s->avctx->time_base.den) / ((1000LL+i)*s->avctx->time_base.den); - div= clip(1, div, 127); + div= av_clip(1, div, 127); error= FFABS(s->avctx->time_base.num*1800000LL - (1000LL+i)*s->avctx->time_base.den*div); if(error < best_error){ best_error= error; @@ -496,7 +496,7 @@ for(i=0; i<s->mb_num; i++){ unsigned int lam= s->lambda_table[ s->mb_index2xy[i] ]; int qp= (lam*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7); - qscale_table[ s->mb_index2xy[i] ]= clip(qp, s->avctx->qmin, s->avctx->qmax); + qscale_table[ s->mb_index2xy[i] ]= av_clip(qp, s->avctx->qmin, s->avctx->qmax); } }
--- a/h264.c Sun Feb 25 07:53:44 2007 +0000 +++ b/h264.c Sun Feb 25 10:27:12 2007 +0000 @@ -1322,13 +1322,13 @@ int i; for(i=0; i<h->ref_count[0]; i++){ int poc0 = h->ref_list[0][i].poc; - int td = clip(poc1 - poc0, -128, 127); + int td = av_clip(poc1 - poc0, -128, 127); if(td == 0 /* FIXME || pic0 is a long-term ref */){ h->dist_scale_factor[i] = 256; }else{ - int tb = clip(poc - poc0, -128, 127); + int tb = av_clip(poc - poc0, -128, 127); int tx = (16384 + (FFABS(td) >> 1)) / td; - h->dist_scale_factor[i] = clip((tb*tx + 32) >> 6, -1024, 1023); + h->dist_scale_factor[i] = av_clip((tb*tx + 32) >> 6, -1024, 1023); } } if(FRAME_MBAFF){ @@ -1948,7 +1948,7 @@ */ static inline int get_chroma_qp(int chroma_qp_index_offset, int qscale){ - return chroma_qp[clip(qscale + chroma_qp_index_offset, 0, 51)]; + return chroma_qp[av_clip(qscale + chroma_qp_index_offset, 0, 51)]; } //FIXME need to check that this doesnt overflow signed 32 bit for low qp, i am not sure, it's very close @@ -4122,11 +4122,11 @@ int poc0 = h->ref_list[0][ref0].poc; for(ref1=0; ref1 < h->ref_count[1]; ref1++){ int poc1 = h->ref_list[1][ref1].poc; - int td = clip(poc1 - poc0, -128, 127); + int td = av_clip(poc1 - poc0, -128, 127); if(td){ - int tb = clip(cur_poc - poc0, -128, 127); + int tb = av_clip(cur_poc - poc0, -128, 127); int tx = (16384 + (FFABS(td) >> 1)) / td; - int dist_scale_factor = clip((tb*tx + 32) >> 6, -1024, 1023) >> 2; + int dist_scale_factor = av_clip((tb*tx + 32) >> 6, -1024, 1023) >> 2; if(dist_scale_factor < -64 || dist_scale_factor > 128) h->implicit_weight[ref0][ref1] = 32; else @@ -6814,17 +6814,17 @@ int i_delta; if( FFABS( p2 - p0 ) < beta ) { - pix[-2] = p1 + clip( ( p2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( p1 << 1 ) ) >> 1, -tc0, tc0 ); + pix[-2] = p1 + av_clip( ( p2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( p1 << 1 ) ) >> 1, -tc0, tc0 ); tc++; } if( FFABS( q2 - q0 ) < beta ) { - pix[1] = q1 + clip( ( q2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( q1 << 1 ) ) >> 1, -tc0, tc0 ); + pix[1] = q1 + av_clip( ( q2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( q1 << 1 ) ) >> 1, -tc0, tc0 ); tc++; } - i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); - pix[-1] = clip_uint8( p0 + i_delta ); /* p0' */ - pix[0] = clip_uint8( q0 - i_delta ); /* q0' */ + i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); + pix[-1] = av_clip_uint8( p0 + i_delta ); /* p0' */ + pix[0] = av_clip_uint8( q0 - i_delta ); /* q0' */ tprintf("filter_mb_mbaff_edgev i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d, tc:%d\n# bS:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, tc, bS[bS_index], pix[-3], p1, p0, q0, q1, pix[2], p1, pix[-1], pix[0], q1); } }else{ @@ -6902,10 +6902,10 @@ if( FFABS( p0 - q0 ) < alpha && FFABS( p1 - p0 ) < beta && FFABS( q1 - q0 ) < beta ) { - const int i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); - - pix[-1] = clip_uint8( p0 + i_delta ); /* p0' */ - pix[0] = clip_uint8( q0 - i_delta ); /* q0' */ + const int i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); + + pix[-1] = av_clip_uint8( p0 + i_delta ); /* p0' */ + pix[0] = av_clip_uint8( q0 - i_delta ); /* q0' */ tprintf("filter_mb_mbaff_edgecv i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d, tc:%d\n# bS:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, tc, bS[bS_index], pix[-3], p1, p0, q0, q1, pix[2], p1, pix[-1], pix[0], q1); } }else{ @@ -7387,9 +7387,9 @@ for( i= 0; i < 460; i++ ) { int pre; if( h->slice_type == I_TYPE ) - pre = clip( ((cabac_context_init_I[i][0] * s->qscale) >>4 ) + cabac_context_init_I[i][1], 1, 126 ); + pre = av_clip( ((cabac_context_init_I[i][0] * s->qscale) >>4 ) + cabac_context_init_I[i][1], 1, 126 ); else - pre = clip( ((cabac_context_init_PB[h->cabac_init_idc][i][0] * s->qscale) >>4 ) + cabac_context_init_PB[h->cabac_init_idc][i][1], 1, 126 ); + pre = av_clip( ((cabac_context_init_PB[h->cabac_init_idc][i][0] * s->qscale) >>4 ) + cabac_context_init_PB[h->cabac_init_idc][i][1], 1, 126 ); if( pre <= 63 ) h->cabac_state[i] = 2 * ( 63 - pre ) + 0;
--- a/imc.c Sun Feb 25 07:53:44 2007 +0000 +++ b/imc.c Sun Feb 25 10:27:12 2007 +0000 @@ -347,7 +347,7 @@ iacc = 0; for(j = (stream_format_code & 0x2)?4:0; j < BANDS; j++) { - cwlen = clip((int)((q->flcoeffs4[j] * 0.5) - summa + 0.5), 0, 6); + cwlen = av_clip((int)((q->flcoeffs4[j] * 0.5) - summa + 0.5), 0, 6); q->bitsBandT[j] = cwlen; summer += q->bandWidthT[j] * cwlen;
--- a/indeo2.c Sun Feb 25 07:53:44 2007 +0000 +++ b/indeo2.c Sun Feb 25 10:27:12 2007 +0000 @@ -87,11 +87,11 @@ } } else { /* add two deltas from table */ t = dst[out - stride] + (table[c * 2] - 128); - t= clip_uint8(t); + t= av_clip_uint8(t); dst[out] = t; out++; t = dst[out - stride] + (table[(c * 2) + 1] - 128); - t= clip_uint8(t); + t= av_clip_uint8(t); dst[out] = t; out++; } @@ -121,11 +121,11 @@ out += c * 2; } else { /* add two deltas from table */ t = dst[out] + (((table[c * 2] - 128)*3) >> 2); - t= clip_uint8(t); + t= av_clip_uint8(t); dst[out] = t; out++; t = dst[out] + (((table[(c * 2) + 1] - 128)*3) >> 2); - t= clip_uint8(t); + t= av_clip_uint8(t); dst[out] = t; out++; }
--- a/jpeg_ls.c Sun Feb 25 07:53:44 2007 +0000 +++ b/jpeg_ls.c Sun Feb 25 10:27:12 2007 +0000 @@ -366,10 +366,10 @@ } if(sign){ - pred = clip(pred - state->C[context], 0, state->maxval); + pred = av_clip(pred - state->C[context], 0, state->maxval); err = -ls_get_code_regular(&s->gb, state, context); } else { - pred = clip(pred + state->C[context], 0, state->maxval); + pred = av_clip(pred + state->C[context], 0, state->maxval); err = ls_get_code_regular(&s->gb, state, context); } @@ -381,7 +381,7 @@ pred += state->range * state->twonear; else if(pred > state->maxval + state->near) pred -= state->range * state->twonear; - pred = clip(pred, 0, state->maxval); + pred = av_clip(pred, 0, state->maxval); } pred &= state->maxval; @@ -623,9 +623,9 @@ err = -(state->near - err) / state->twonear; if(RItype || (Rb >= Ra)) - Ra = clip(pred + err * state->twonear, 0, state->maxval); + Ra = av_clip(pred + err * state->twonear, 0, state->maxval); else - Ra = clip(pred - err * state->twonear, 0, state->maxval); + Ra = av_clip(pred - err * state->twonear, 0, state->maxval); W(cur, x, Ra); } if(err < 0) @@ -646,11 +646,11 @@ if(context < 0){ context = -context; sign = 1; - pred = clip(pred - state->C[context], 0, state->maxval); + pred = av_clip(pred - state->C[context], 0, state->maxval); err = pred - R(cur, x); }else{ sign = 0; - pred = clip(pred + state->C[context], 0, state->maxval); + pred = av_clip(pred + state->C[context], 0, state->maxval); err = R(cur, x) - pred; } @@ -660,9 +660,9 @@ else err = -(state->near - err) / state->twonear; if(!sign) - Ra = clip(pred + err * state->twonear, 0, state->maxval); + Ra = av_clip(pred + err * state->twonear, 0, state->maxval); else - Ra = clip(pred - err * state->twonear, 0, state->maxval); + Ra = av_clip(pred - err * state->twonear, 0, state->maxval); W(cur, x, Ra); }
--- a/motion_est.c Sun Feb 25 07:53:44 2007 +0000 +++ b/motion_est.c Sun Feb 25 10:27:12 2007 +0000 @@ -1798,15 +1798,15 @@ c->pred_x=0; c->pred_y=0; - P_LEFT[0] = clip(mv_table[mot_xy - 1][0], xmin<<shift, xmax<<shift); - P_LEFT[1] = clip(mv_table[mot_xy - 1][1], ymin<<shift, ymax<<shift); + P_LEFT[0] = av_clip(mv_table[mot_xy - 1][0], xmin<<shift, xmax<<shift); + P_LEFT[1] = av_clip(mv_table[mot_xy - 1][1], ymin<<shift, ymax<<shift); /* special case for first line */ if (!s->first_slice_line) { //FIXME maybe allow this over thread boundary as its clipped - P_TOP[0] = clip(mv_table[mot_xy - mot_stride ][0], xmin<<shift, xmax<<shift); - P_TOP[1] = clip(mv_table[mot_xy - mot_stride ][1], ymin<<shift, ymax<<shift); - P_TOPRIGHT[0] = clip(mv_table[mot_xy - mot_stride + 1 ][0], xmin<<shift, xmax<<shift); - P_TOPRIGHT[1] = clip(mv_table[mot_xy - mot_stride + 1 ][1], ymin<<shift, ymax<<shift); + P_TOP[0] = av_clip(mv_table[mot_xy - mot_stride ][0], xmin<<shift, xmax<<shift); + P_TOP[1] = av_clip(mv_table[mot_xy - mot_stride ][1], ymin<<shift, ymax<<shift); + P_TOPRIGHT[0] = av_clip(mv_table[mot_xy - mot_stride + 1 ][0], xmin<<shift, xmax<<shift); + P_TOPRIGHT[1] = av_clip(mv_table[mot_xy - mot_stride + 1 ][1], ymin<<shift, ymax<<shift); P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]); P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);
--- a/mpegvideo.c Sun Feb 25 07:53:44 2007 +0000 +++ b/mpegvideo.c Sun Feb 25 10:27:12 2007 +0000 @@ -188,7 +188,7 @@ static inline void update_qscale(MpegEncContext *s){ s->qscale= (s->lambda*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7); - s->qscale= clip(s->qscale, s->avctx->qmin, s->avctx->qmax); + s->qscale= av_clip(s->qscale, s->avctx->qmin, s->avctx->qmax); s->lambda2= (s->lambda*s->lambda + FF_LAMBDA_SCALE/2) >> FF_LAMBDA_SHIFT; } @@ -1713,10 +1713,10 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color){ int x, y, fr, f; - sx= clip(sx, 0, w-1); - sy= clip(sy, 0, h-1); - ex= clip(ex, 0, w-1); - ey= clip(ey, 0, h-1); + sx= av_clip(sx, 0, w-1); + sy= av_clip(sy, 0, h-1); + ex= av_clip(ex, 0, w-1); + ey= av_clip(ey, 0, h-1); buf[sy*stride + sx]+= color; @@ -1762,10 +1762,10 @@ static void draw_arrow(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color){ int dx,dy; - sx= clip(sx, -100, w+100); - sy= clip(sy, -100, h+100); - ex= clip(ex, -100, w+100); - ey= clip(ey, -100, h+100); + sx= av_clip(sx, -100, w+100); + sy= av_clip(sy, -100, h+100); + ex= av_clip(ex, -100, w+100); + ey= av_clip(ey, -100, h+100); dx= ex - sx; dy= ey - sy; @@ -2664,10 +2664,10 @@ src_y = s->mb_y * 16 + (motion_y >> (s->sprite_warping_accuracy+1)); motion_x<<=(3-s->sprite_warping_accuracy); motion_y<<=(3-s->sprite_warping_accuracy); - src_x = clip(src_x, -16, s->width); + src_x = av_clip(src_x, -16, s->width); if (src_x == s->width) motion_x =0; - src_y = clip(src_y, -16, s->height); + src_y = av_clip(src_y, -16, s->height); if (src_y == s->height) motion_y =0; @@ -2706,10 +2706,10 @@ src_y = s->mb_y * 8 + (motion_y >> (s->sprite_warping_accuracy+1)); motion_x<<=(3-s->sprite_warping_accuracy); motion_y<<=(3-s->sprite_warping_accuracy); - src_x = clip(src_x, -8, s->width>>1); + src_x = av_clip(src_x, -8, s->width>>1); if (src_x == s->width>>1) motion_x =0; - src_y = clip(src_y, -8, s->height>>1); + src_y = av_clip(src_y, -8, s->height>>1); if (src_y == s->height>>1) motion_y =0; @@ -2879,10 +2879,10 @@ src_y += motion_y >> 1; /* WARNING: do no forget half pels */ - src_x = clip(src_x, -16, width); //FIXME unneeded for emu? + src_x = av_clip(src_x, -16, width); //FIXME unneeded for emu? if (src_x == width) dxy &= ~1; - src_y = clip(src_y, -16, height); + src_y = av_clip(src_y, -16, height); if (src_y == height) dxy &= ~2; src += src_y * stride + src_x; @@ -3358,10 +3358,10 @@ src_x = s->mb_x * 8 + mx; src_y = s->mb_y * 8 + my; - src_x = clip(src_x, -8, s->width/2); + src_x = av_clip(src_x, -8, s->width/2); if (src_x == s->width/2) dxy &= ~1; - src_y = clip(src_y, -8, s->height/2); + src_y = av_clip(src_y, -8, s->height/2); if (src_y == s->height/2) dxy &= ~2; @@ -3574,10 +3574,10 @@ src_y = mb_y * 16 + (motion_y >> 2) + (i >>1) * 8; /* WARNING: do no forget half pels */ - src_x = clip(src_x, -16, s->width); + src_x = av_clip(src_x, -16, s->width); if (src_x == s->width) dxy &= ~3; - src_y = clip(src_y, -16, s->height); + src_y = av_clip(src_y, -16, s->height); if (src_y == s->height) dxy &= ~12; @@ -4343,7 +4343,7 @@ s->dquant= s->qscale - last_qp; if(s->out_format==FMT_H263){ - s->dquant= clip(s->dquant, -2, 2); + s->dquant= av_clip(s->dquant, -2, 2); if(s->codec_id==CODEC_ID_MPEG4){ if(!s->mb_intra){ @@ -5742,7 +5742,7 @@ for(i=1;i<64;i++){ int j= s->dsp.idct_permutation[i]; - s->intra_matrix[j] = clip_uint8((ff_mpeg1_default_intra_matrix[i] * s->qscale) >> 3); + s->intra_matrix[j] = av_clip_uint8((ff_mpeg1_default_intra_matrix[i] * s->qscale) >> 3); } convert_matrix(&s->dsp, s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, s->intra_quant_bias, 8, 8, 1);
--- a/ratecontrol.c Sun Feb 25 07:53:44 2007 +0000 +++ b/ratecontrol.c Sun Feb 25 10:27:12 2007 +0000 @@ -280,7 +280,7 @@ } left= buffer_size - rcc->buffer_index - 1; - rcc->buffer_index += clip(left, min_rate, max_rate); + rcc->buffer_index += av_clip(left, min_rate, max_rate); if(rcc->buffer_index > buffer_size){ int stuffing= ceil((rcc->buffer_index - buffer_size)/8); @@ -417,8 +417,8 @@ qmax= (int)(qmax*FFABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5); } - qmin= clip(qmin, 1, FF_LAMBDA_MAX); - qmax= clip(qmax, 1, FF_LAMBDA_MAX); + qmin= av_clip(qmin, 1, FF_LAMBDA_MAX); + qmax= av_clip(qmax, 1, FF_LAMBDA_MAX); if(qmax<qmin) qmax= qmin; @@ -915,7 +915,7 @@ for(i=0; i<rcc->num_entries; i++){ /* av_log(s->avctx, AV_LOG_DEBUG, "[lavc rc] entry[%d].new_qscale = %.3f qp = %.3f\n", i, rcc->entry[i].new_qscale, rcc->entry[i].new_qscale / FF_QP2LAMBDA); */ - qscale_sum += clip(rcc->entry[i].new_qscale / FF_QP2LAMBDA, s->avctx->qmin, s->avctx->qmax); + qscale_sum += av_clip(rcc->entry[i].new_qscale / FF_QP2LAMBDA, s->avctx->qmin, s->avctx->qmax); } assert(toobig <= 40); av_log(s->avctx, AV_LOG_DEBUG,
--- a/resample2.c Sun Feb 25 07:53:44 2007 +0000 +++ b/resample2.c Sun Feb 25 10:27:12 2007 +0000 @@ -121,7 +121,7 @@ /* normalize so that an uniform color remains the same */ for(i=0;i<tap_count;i++) { - v = clip(lrintf(tab[i] * scale / norm + e), FELEM_MIN, FELEM_MAX); + v = av_clip(lrintf(tab[i] * scale / norm + e), FELEM_MIN, FELEM_MAX); filter[ph * tap_count + i] = v; e += tab[i] * scale / norm - v; }
--- a/snow.c Sun Feb 25 07:53:44 2007 +0000 +++ b/snow.c Sun Feb 25 10:27:12 2007 +0000 @@ -1810,7 +1810,7 @@ static inline void decode_subband_slice_buffered(SnowContext *s, SubBand *b, slice_buffer * sb, int start_y, int h, int save_state[1]){ const int w= b->width; int y; - const int qlog= clip(s->qlog + b->qlog, 0, QROOT*16); + const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; int new_index = 0; @@ -2898,7 +2898,7 @@ } *b= backup; - return clip(((ab<<LOG2_OBMC_MAX) + aa/2)/aa, 0, 255); //FIXME we shouldnt need cliping + return av_clip(((ab<<LOG2_OBMC_MAX) + aa/2)/aa, 0, 255); //FIXME we shouldnt need cliping } static inline int get_block_bits(SnowContext *s, int x, int y, int w){ @@ -3407,7 +3407,7 @@ const int level= b->level; const int w= b->width; const int h= b->height; - const int qlog= clip(s->qlog + b->qlog, 0, QROOT*16); + const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); int x,y, thres1, thres2; // START_TIMER @@ -3466,7 +3466,7 @@ static void dequantize_slice_buffered(SnowContext *s, slice_buffer * sb, SubBand *b, DWTELEM *src, int stride, int start_y, int end_y){ const int w= b->width; - const int qlog= clip(s->qlog + b->qlog, 0, QROOT*16); + const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; int x,y; @@ -3494,7 +3494,7 @@ static void dequantize(SnowContext *s, SubBand *b, DWTELEM *src, int stride){ const int w= b->width; const int h= b->height; - const int qlog= clip(s->qlog + b->qlog, 0, QROOT*16); + const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; int x,y; @@ -3869,7 +3869,7 @@ const int w= b->width; const int h= b->height; const int stride= b->stride; - const int qlog= clip(2*QROOT + b->qlog, 0, QROOT*16); + const int qlog= av_clip(2*QROOT + b->qlog, 0, QROOT*16); const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); const int qdiv= (1<<16)/qmul; int x, y;
--- a/svq1.c Sun Feb 25 07:53:44 2007 +0000 +++ b/svq1.c Sun Feb 25 10:27:12 2007 +0000 @@ -1004,8 +1004,8 @@ diff= block_sum[stage] - sum; mean= (diff + (size>>1)) >> (level+3); assert(mean >-300 && mean<300); - if(intra) mean= clip(mean, 0, 255); - else mean= clip(mean, -256, 255); + if(intra) mean= av_clip(mean, 0, 255); + else mean= av_clip(mean, -256, 255); score= sqr - ((diff*(int64_t)diff)>>(level+3)); //FIXME 64bit slooow if(score < best_vector_score){ best_vector_score= score;
--- a/svq3.c Sun Feb 25 07:53:44 2007 +0000 +++ b/svq3.c Sun Feb 25 10:27:12 2007 +0000 @@ -285,8 +285,8 @@ emu = 1; } - mx = clip (mx, -16, (s->h_edge_pos - width + 15)); - my = clip (my, -16, (s->v_edge_pos - height + 15)); + mx = av_clip (mx, -16, (s->h_edge_pos - width + 15)); + my = av_clip (my, -16, (s->v_edge_pos - height + 15)); } /* form component predictions */ @@ -361,8 +361,8 @@ } /* clip motion vector prediction to frame border */ - mx = clip (mx, extra_width - 6*x, h_edge_pos - 6*x); - my = clip (my, extra_width - 6*y, v_edge_pos - 6*y); + mx = av_clip (mx, extra_width - 6*x, h_edge_pos - 6*x); + my = av_clip (my, extra_width - 6*y, v_edge_pos - 6*y); /* get (optional) motion vector differential */ if (mode == PREDICT_MODE) {
--- a/truemotion2.c Sun Feb 25 07:53:44 2007 +0000 +++ b/truemotion2.c Sun Feb 25 10:27:12 2007 +0000 @@ -384,7 +384,7 @@ d = deltas[i + j * 4]; ct += d; last[i] += ct; - Y[i] = clip_uint8(last[i]); + Y[i] = av_clip_uint8(last[i]); } Y += stride; ctx->D[j] = ct; @@ -735,7 +735,7 @@ src = (ctx->cur?ctx->Y2:ctx->Y1); for(j = 0; j < ctx->avctx->height; j++){ for(i = 0; i < ctx->avctx->width; i++){ - Y[i] = clip_uint8(*src++); + Y[i] = av_clip_uint8(*src++); } Y += p->linesize[0]; } @@ -743,7 +743,7 @@ src = (ctx->cur?ctx->U2:ctx->U1); for(j = 0; j < (ctx->avctx->height + 1) >> 1; j++){ for(i = 0; i < (ctx->avctx->width + 1) >> 1; i++){ - U[i] = clip_uint8(*src++); + U[i] = av_clip_uint8(*src++); } U += p->linesize[2]; } @@ -751,7 +751,7 @@ src = (ctx->cur?ctx->V2:ctx->V1); for(j = 0; j < (ctx->avctx->height + 1) >> 1; j++){ for(i = 0; i < (ctx->avctx->width + 1) >> 1; i++){ - V[i] = clip_uint8(*src++); + V[i] = av_clip_uint8(*src++); } V += p->linesize[1]; }
--- a/truespeech.c Sun Feb 25 07:53:44 2007 +0000 +++ b/truespeech.c Sun Feb 25 10:27:12 2007 +0000 @@ -281,7 +281,7 @@ for(k = 0; k < 8; k++) sum += ptr0[k] * ptr1[k]; sum = (sum + (out[i] << 12) + 0x800) >> 12; - out[i] = clip(sum, -0x7FFE, 0x7FFE); + out[i] = av_clip(sum, -0x7FFE, 0x7FFE); for(k = 7; k > 0; k--) ptr0[k] = ptr0[k - 1]; ptr0[0] = out[i]; @@ -311,11 +311,11 @@ sum += ptr0[k] * t[k]; for(k = 7; k > 0; k--) ptr0[k] = ptr0[k - 1]; - ptr0[0] = clip((sum + 0x800) >> 12, -0x7FFE, 0x7FFE); + ptr0[0] = av_clip((sum + 0x800) >> 12, -0x7FFE, 0x7FFE); sum = ((ptr0[1] * (dec->filtval - (dec->filtval >> 2))) >> 4) + sum; sum = sum - (sum >> 3); - out[i] = clip((sum + 0x800) >> 12, -0x7FFE, 0x7FFE); + out[i] = av_clip((sum + 0x800) >> 12, -0x7FFE, 0x7FFE); } }
--- a/vc1.c Sun Feb 25 07:53:44 2007 +0000 +++ b/vc1.c Sun Feb 25 10:27:12 2007 +0000 @@ -821,10 +821,10 @@ uvsrc_x = s->mb_x * 8 + (uvmx >> 2); uvsrc_y = s->mb_y * 8 + (uvmy >> 2); - src_x = clip( src_x, -16, s->mb_width * 16); - src_y = clip( src_y, -16, s->mb_height * 16); - uvsrc_x = clip(uvsrc_x, -8, s->mb_width * 8); - uvsrc_y = clip(uvsrc_y, -8, s->mb_height * 8); + src_x = av_clip( src_x, -16, s->mb_width * 16); + src_y = av_clip( src_y, -16, s->mb_height * 16); + uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8); + uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8); srcY += src_y * s->linesize + src_x; srcU += uvsrc_y * s->uvlinesize + uvsrc_x; @@ -944,8 +944,8 @@ src_x = s->mb_x * 16 + (n&1) * 8 + (mx >> 2); src_y = s->mb_y * 16 + (n&2) * 4 + (my >> 2); - src_x = clip( src_x, -16, s->mb_width * 16); - src_y = clip( src_y, -16, s->mb_height * 16); + src_x = av_clip( src_x, -16, s->mb_width * 16); + src_y = av_clip( src_y, -16, s->mb_height * 16); srcY += src_y * s->linesize + src_x; @@ -1071,8 +1071,8 @@ uvsrc_x = s->mb_x * 8 + (uvmx >> 2); uvsrc_y = s->mb_y * 8 + (uvmy >> 2); - uvsrc_x = clip(uvsrc_x, -8, s->mb_width * 8); - uvsrc_y = clip(uvsrc_y, -8, s->mb_height * 8); + uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8); + uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8); srcU = s->last_picture.data[1] + uvsrc_y * s->uvlinesize + uvsrc_x; srcV = s->last_picture.data[2] + uvsrc_y * s->uvlinesize + uvsrc_x; if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) @@ -1499,8 +1499,8 @@ shift = v->lumshift << 6; } for(i = 0; i < 256; i++) { - v->luty[i] = clip_uint8((scale * i + shift + 32) >> 6); - v->lutuv[i] = clip_uint8((scale * (i - 128) + 128*64 + 32) >> 6); + v->luty[i] = av_clip_uint8((scale * i + shift + 32) >> 6); + v->lutuv[i] = av_clip_uint8((scale * (i - 128) + 128*64 + 32) >> 6); } } if(v->mv_mode == MV_PMODE_1MV_HPEL || v->mv_mode == MV_PMODE_1MV_HPEL_BILIN) @@ -1740,8 +1740,8 @@ shift = v->lumshift << 6; } for(i = 0; i < 256; i++) { - v->luty[i] = clip_uint8((scale * i + shift + 32) >> 6); - v->lutuv[i] = clip_uint8((scale * (i - 128) + 128*64 + 32) >> 6); + v->luty[i] = av_clip_uint8((scale * i + shift + 32) >> 6); + v->lutuv[i] = av_clip_uint8((scale * (i - 128) + 128*64 + 32) >> 6); } v->use_ic = 1; } @@ -2116,10 +2116,10 @@ uvsrc_x = s->mb_x * 8 + (uvmx >> 2); uvsrc_y = s->mb_y * 8 + (uvmy >> 2); - src_x = clip( src_x, -16, s->mb_width * 16); - src_y = clip( src_y, -16, s->mb_height * 16); - uvsrc_x = clip(uvsrc_x, -8, s->mb_width * 8); - uvsrc_y = clip(uvsrc_y, -8, s->mb_height * 8); + src_x = av_clip( src_x, -16, s->mb_width * 16); + src_y = av_clip( src_y, -16, s->mb_height * 16); + uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8); + uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8); srcY += src_y * s->linesize + src_x; srcU += uvsrc_y * s->uvlinesize + uvsrc_x;
--- a/vc1dsp.c Sun Feb 25 07:53:44 2007 +0000 +++ b/vc1dsp.c Sun Feb 25 10:27:12 2007 +0000 @@ -355,7 +355,7 @@ tptr = tmp; for(j = 0; j < 11; j++) { for(i = 0; i < 8; i++) - tptr[i] = clip_uint8(vc1_mspel_filter(src + i, 1, m, r)); + tptr[i] = av_clip_uint8(vc1_mspel_filter(src + i, 1, m, r)); src += stride; tptr += 8; } @@ -365,7 +365,7 @@ tptr = tmp + 8; for(j = 0; j < 8; j++) { for(i = 0; i < 8; i++) - dst[i] = clip_uint8(vc1_mspel_filter(tptr + i, 8, m, r)); + dst[i] = av_clip_uint8(vc1_mspel_filter(tptr + i, 8, m, r)); dst += stride; tptr += 8; }
--- a/vmdav.c Sun Feb 25 07:53:44 2007 +0000 +++ b/vmdav.c Sun Feb 25 10:27:12 2007 +0000 @@ -462,7 +462,7 @@ s->predictors[chan] -= vmdaudio_table[buf[i] & 0x7F]; else s->predictors[chan] += vmdaudio_table[buf[i]]; - s->predictors[chan] = clip(s->predictors[chan], -32768, 32767); + s->predictors[chan] = av_clip(s->predictors[chan], -32768, 32767); out[i] = s->predictors[chan]; chan ^= stereo; }
--- a/vp3.c Sun Feb 25 07:53:44 2007 +0000 +++ b/vp3.c Sun Feb 25 10:27:12 2007 +0000 @@ -633,7 +633,7 @@ int qmin= 8<<(inter + !i); int qscale= i ? ac_scale_factor : dc_scale_factor; - s->qmat[inter][plane][i]= clip((qscale * coeff)/100 * 4, qmin, 4096); + s->qmat[inter][plane][i]= av_clip((qscale * coeff)/100 * 4, qmin, 4096); } } } @@ -1729,8 +1729,8 @@ (first_pixel[-2] - first_pixel[ 1]) +3*(first_pixel[ 0] - first_pixel[-1]); filter_value = bounding_values[(filter_value + 4) >> 3]; - first_pixel[-1] = clip_uint8(first_pixel[-1] + filter_value); - first_pixel[ 0] = clip_uint8(first_pixel[ 0] - filter_value); + first_pixel[-1] = av_clip_uint8(first_pixel[-1] + filter_value); + first_pixel[ 0] = av_clip_uint8(first_pixel[ 0] - filter_value); } } @@ -1746,8 +1746,8 @@ (first_pixel[2 * nstride] - first_pixel[ stride]) +3*(first_pixel[0 ] - first_pixel[nstride]); filter_value = bounding_values[(filter_value + 4) >> 3]; - first_pixel[nstride] = clip_uint8(first_pixel[nstride] + filter_value); - first_pixel[0] = clip_uint8(first_pixel[0] - filter_value); + first_pixel[nstride] = av_clip_uint8(first_pixel[nstride] + filter_value); + first_pixel[0] = av_clip_uint8(first_pixel[0] - filter_value); } }
--- a/vp5.c Sun Feb 25 07:53:44 2007 +0000 +++ b/vp5.c Sun Feb 25 10:27:12 2007 +0000 @@ -164,7 +164,7 @@ for (pt=0; pt<2; pt++) for (ctx=0; ctx<36; ctx++) for (node=0; node<5; node++) - s->coeff_model_dcct[pt][ctx][node] = clip(((s->coeff_model_dccv[pt][node] * vp5_dccv_lc[node][ctx][0] + 128) >> 8) + vp5_dccv_lc[node][ctx][1], 1, 254); + s->coeff_model_dcct[pt][ctx][node] = av_clip(((s->coeff_model_dccv[pt][node] * vp5_dccv_lc[node][ctx][0] + 128) >> 8) + vp5_dccv_lc[node][ctx][1], 1, 254); /* coeff_model_acct is a linear combination of coeff_model_ract */ for (ct=0; ct<3; ct++) @@ -172,7 +172,7 @@ for (cg=0; cg<3; cg++) for (ctx=0; ctx<6; ctx++) for (node=0; node<5; node++) - s->coeff_model_acct[pt][ct][cg][ctx][node] = clip(((s->coeff_model_ract[pt][ct][cg][node] * vp5_ract_lc[ct][cg][node][ctx][0] + 128) >> 8) + vp5_ract_lc[ct][cg][node][ctx][1], 1, 254); + s->coeff_model_acct[pt][ct][cg][ctx][node] = av_clip(((s->coeff_model_ract[pt][ct][cg][node] * vp5_ract_lc[ct][cg][node][ctx][0] + 128) >> 8) + vp5_ract_lc[ct][cg][node][ctx][1], 1, 254); } static void vp5_parse_coeff(vp56_context_t *s)
--- a/vp56.c Sun Feb 25 07:53:44 2007 +0000 +++ b/vp56.c Sun Feb 25 10:27:12 2007 +0000 @@ -308,8 +308,8 @@ for (i=0; i<12; i++) { v = (yuv[-pix2_inc] + 3*(yuv[0]-yuv[-pix_inc]) - yuv[pix_inc] + 4) >>3; v = s->adjust(v, t); - yuv[-pix_inc] = clip_uint8(yuv[-pix_inc] + v); - yuv[0] = clip_uint8(yuv[0] - v); + yuv[-pix_inc] = av_clip_uint8(yuv[-pix_inc] + v); + yuv[0] = av_clip_uint8(yuv[0] - v); yuv += line_inc; } }
--- a/vp6.c Sun Feb 25 07:53:44 2007 +0000 +++ b/vp6.c Sun Feb 25 10:27:12 2007 +0000 @@ -236,7 +236,7 @@ for (pt=0; pt<2; pt++) for (ctx=0; ctx<3; ctx++) for (node=0; node<5; node++) - s->coeff_model_dcct[pt][ctx][node] = clip(((s->coeff_model_dccv[pt][node] * vp6_dccv_lc[ctx][node][0] + 128) >> 8) + vp6_dccv_lc[ctx][node][1], 1, 255); + s->coeff_model_dcct[pt][ctx][node] = av_clip(((s->coeff_model_dccv[pt][node] * vp6_dccv_lc[ctx][node][0] + 128) >> 8) + vp6_dccv_lc[ctx][node][1], 1, 255); } static void vp6_parse_vector_adjustment(vp56_context_t *s, vp56_mv_t *vect) @@ -395,7 +395,7 @@ for (y=0; y<8; y++) { for (x=0; x<8; x++) { - dst[x] = clip_uint8(( src[x-delta ] * weights[0] + dst[x] = av_clip_uint8(( src[x-delta ] * weights[0] + src[x ] * weights[1] + src[x+delta ] * weights[2] + src[x+2*delta] * weights[3] + 64) >> 7); @@ -434,7 +434,7 @@ for (y=0; y<11; y++) { for (x=0; x<8; x++) { - t[x] = clip_uint8(( src[x-1] * h_weights[0] + t[x] = av_clip_uint8(( src[x-1] * h_weights[0] + src[x ] * h_weights[1] + src[x+1] * h_weights[2] + src[x+2] * h_weights[3] + 64) >> 7); @@ -446,7 +446,7 @@ t = tmp + 8; for (y=0; y<8; y++) { for (x=0; x<8; x++) { - dst[x] = clip_uint8(( t[x-8 ] * v_weights[0] + dst[x] = av_clip_uint8(( t[x-8 ] * v_weights[0] + t[x ] * v_weights[1] + t[x+8 ] * v_weights[2] + t[x+16] * v_weights[3] + 64) >> 7);
--- a/wmv2.c Sun Feb 25 07:53:44 2007 +0000 +++ b/wmv2.c Sun Feb 25 10:27:12 2007 +0000 @@ -641,8 +641,8 @@ /* WARNING: do no forget half pels */ v_edge_pos = s->v_edge_pos; - src_x = clip(src_x, -16, s->width); - src_y = clip(src_y, -16, s->height); + src_x = av_clip(src_x, -16, s->width); + src_y = av_clip(src_y, -16, s->height); if(src_x<=-16 || src_x >= s->width) dxy &= ~3; @@ -688,10 +688,10 @@ src_x = s->mb_x * 8 + mx; src_y = s->mb_y * 8 + my; - src_x = clip(src_x, -8, s->width >> 1); + src_x = av_clip(src_x, -8, s->width >> 1); if (src_x == (s->width >> 1)) dxy &= ~1; - src_y = clip(src_y, -8, s->height >> 1); + src_y = av_clip(src_y, -8, s->height >> 1); if (src_y == (s->height >> 1)) dxy &= ~2; offset = (src_y * uvlinesize) + src_x;