Mercurial > libavcodec.hg
comparison dsputil.c @ 2065:9e4bebc39ade libavcodec
noise preserving sum of squares comparission function
author | michael |
---|---|
date | Mon, 07 Jun 2004 03:23:31 +0000 |
parents | 9447bbd8a7e9 |
children | 4bfb146e701b |
comparison
equal
deleted
inserted
replaced
2064:b77fe059dd09 | 2065:9e4bebc39ade |
---|---|
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){ | |
2591 int score1=0; | |
2592 int score2=0; | |
2593 int x,y; | |
2594 | |
2595 for(y=0; y<h; y++){ | |
2596 for(x=0; x<16; x++){ | |
2597 score1+= (s1[x ] - s2[x ])*(s1[x ] - s2[x ]); | |
2598 } | |
2599 if(y+1<h){ | |
2600 for(x=0; x<15; x++){ | |
2601 score2+= ABS( s1[x ] - s1[x +stride] | |
2602 - s1[x+1] + s1[x+1+stride]) | |
2603 -ABS( s2[x ] - s2[x +stride] | |
2604 - s2[x+1] + s2[x+1+stride]); | |
2605 } | |
2606 } | |
2607 s1+= stride; | |
2608 s2+= stride; | |
2609 } | |
2610 | |
2611 return score1 + ABS(score2)*8; | |
2612 } | |
2613 | |
2614 static int nsse8_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int stride, int h){ | |
2615 int score1=0; | |
2616 int score2=0; | |
2617 int x,y; | |
2618 | |
2619 for(y=0; y<h; y++){ | |
2620 for(x=0; x<8; x++){ | |
2621 score1+= (s1[x ] - s2[x ])*(s1[x ] - s2[x ]); | |
2622 } | |
2623 if(y+1<h){ | |
2624 for(x=0; x<7; x++){ | |
2625 score2+= ABS( s1[x ] - s1[x +stride] | |
2626 - s1[x+1] + s1[x+1+stride]) | |
2627 -ABS( s2[x ] - s2[x +stride] | |
2628 - s2[x+1] + s2[x+1+stride]); | |
2629 } | |
2630 } | |
2631 s1+= stride; | |
2632 s2+= stride; | |
2633 } | |
2634 | |
2635 return score1 + ABS(score2)*8; | |
2636 } | |
2637 | |
2590 static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){ | 2638 static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){ |
2591 int i; | 2639 int i; |
2592 unsigned int sum=0; | 2640 unsigned int sum=0; |
2593 | 2641 |
2594 for(i=0; i<8*8; i++){ | 2642 for(i=0; i<8*8; i++){ |
2678 cmp[i]= c->vsse[i]; | 2726 cmp[i]= c->vsse[i]; |
2679 break; | 2727 break; |
2680 case FF_CMP_ZERO: | 2728 case FF_CMP_ZERO: |
2681 cmp[i]= zero_cmp; | 2729 cmp[i]= zero_cmp; |
2682 break; | 2730 break; |
2731 case FF_CMP_NSSE: | |
2732 cmp[i]= c->nsse[i]; | |
2733 break; | |
2683 default: | 2734 default: |
2684 av_log(NULL, AV_LOG_ERROR,"internal error in cmp function selection\n"); | 2735 av_log(NULL, AV_LOG_ERROR,"internal error in cmp function selection\n"); |
2685 } | 2736 } |
2686 } | 2737 } |
2687 } | 2738 } |
3311 SET_CMP_FUNC(bit) | 3362 SET_CMP_FUNC(bit) |
3312 c->vsad[0]= vsad16_c; | 3363 c->vsad[0]= vsad16_c; |
3313 c->vsad[4]= vsad_intra16_c; | 3364 c->vsad[4]= vsad_intra16_c; |
3314 c->vsse[0]= vsse16_c; | 3365 c->vsse[0]= vsse16_c; |
3315 c->vsse[4]= vsse_intra16_c; | 3366 c->vsse[4]= vsse_intra16_c; |
3367 c->nsse[0]= nsse16_c; | |
3368 c->nsse[1]= nsse8_c; | |
3316 | 3369 |
3317 c->add_bytes= add_bytes_c; | 3370 c->add_bytes= add_bytes_c; |
3318 c->diff_bytes= diff_bytes_c; | 3371 c->diff_bytes= diff_bytes_c; |
3319 c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c; | 3372 c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c; |
3320 c->bswap_buf= bswap_buf; | 3373 c->bswap_buf= bswap_buf; |