comparison dsputil.c @ 2066:4bfb146e701b libavcodec

nsse weight
author michael
date Mon, 07 Jun 2004 17:30:02 +0000
parents 9e4bebc39ade
children db8baace74d8
comparison
equal deleted inserted replaced
2065:9e4bebc39ade 2066:4bfb146e701b
2585 pix3 += line_size; 2585 pix3 += line_size;
2586 } 2586 }
2587 return s; 2587 return s;
2588 } 2588 }
2589 2589
2590 static int nsse16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int stride, int h){ 2590 static int nsse16_c(MpegEncContext *c, uint8_t *s1, uint8_t *s2, int stride, int h){
2591 int score1=0; 2591 int score1=0;
2592 int score2=0; 2592 int score2=0;
2593 int x,y; 2593 int x,y;
2594 2594
2595 for(y=0; y<h; y++){ 2595 for(y=0; y<h; y++){
2596 for(x=0; x<16; x++){ 2596 for(x=0; x<16; x++){
2597 score1+= (s1[x ] - s2[x ])*(s1[x ] - s2[x ]); 2597 score1+= (s1[x ] - s2[x ])*(s1[x ] - s2[x ]);
2598 } 2598 }
2599 if(y+1<h){ 2599 if(y+1<h){
2605 } 2605 }
2606 } 2606 }
2607 s1+= stride; 2607 s1+= stride;
2608 s2+= stride; 2608 s2+= stride;
2609 } 2609 }
2610 2610
2611 return score1 + ABS(score2)*8; 2611 if(c) return score1 + ABS(score2)*c->avctx->nsse_weight;
2612 } 2612 else return score1 + ABS(score2)*8;
2613 2613 }
2614 static int nsse8_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int stride, int h){ 2614
2615 static int nsse8_c(MpegEncContext *c, uint8_t *s1, uint8_t *s2, int stride, int h){
2615 int score1=0; 2616 int score1=0;
2616 int score2=0; 2617 int score2=0;
2617 int x,y; 2618 int x,y;
2618 2619
2619 for(y=0; y<h; y++){ 2620 for(y=0; y<h; y++){
2630 } 2631 }
2631 s1+= stride; 2632 s1+= stride;
2632 s2+= stride; 2633 s2+= stride;
2633 } 2634 }
2634 2635
2635 return score1 + ABS(score2)*8; 2636 if(c) return score1 + ABS(score2)*c->avctx->nsse_weight;
2637 else return score1 + ABS(score2)*8;
2636 } 2638 }
2637 2639
2638 static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){ 2640 static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){
2639 int i; 2641 int i;
2640 unsigned int sum=0; 2642 unsigned int sum=0;