Mercurial > libavcodec.hg
changeset 8978:a49197cd37ce libavcodec
Adding 2 intra 8x8 cmp functions: vsad, vsse
author | romansh |
---|---|
date | Thu, 19 Feb 2009 00:30:24 +0000 |
parents | 82ab0b77695b |
children | 5337b260a70d |
files | dsputil.c |
diffstat | 1 files changed, 35 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/dsputil.c Thu Feb 19 00:28:19 2009 +0000 +++ b/dsputil.c Thu Feb 19 00:30:24 2009 +0000 @@ -3937,20 +3937,23 @@ return bits; } -static int vsad_intra16_c(/*MpegEncContext*/ void *c, uint8_t *s, uint8_t *dummy, int stride, int h){ - int score=0; - int x,y; - - for(y=1; y<h; y++){ - for(x=0; x<16; x+=4){ - score+= FFABS(s[x ] - s[x +stride]) + FFABS(s[x+1] - s[x+1+stride]) - +FFABS(s[x+2] - s[x+2+stride]) + FFABS(s[x+3] - s[x+3+stride]); - } - s+= stride; - } - - return score; +#define VSAD_INTRA(size) \ +static int vsad_intra##size##_c(/*MpegEncContext*/ void *c, uint8_t *s, uint8_t *dummy, int stride, int h){ \ + int score=0; \ + int x,y; \ + \ + for(y=1; y<h; y++){ \ + for(x=0; x<size; x+=4){ \ + score+= FFABS(s[x ] - s[x +stride]) + FFABS(s[x+1] - s[x+1+stride]) \ + +FFABS(s[x+2] - s[x+2+stride]) + FFABS(s[x+3] - s[x+3+stride]); \ + } \ + s+= stride; \ + } \ + \ + return score; \ } +VSAD_INTRA(8) +VSAD_INTRA(16) static int vsad16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int stride, int h){ int score=0; @@ -3968,20 +3971,23 @@ } #define SQ(a) ((a)*(a)) -static int vsse_intra16_c(/*MpegEncContext*/ void *c, uint8_t *s, uint8_t *dummy, int stride, int h){ - int score=0; - int x,y; - - for(y=1; y<h; y++){ - for(x=0; x<16; x+=4){ - score+= SQ(s[x ] - s[x +stride]) + SQ(s[x+1] - s[x+1+stride]) - +SQ(s[x+2] - s[x+2+stride]) + SQ(s[x+3] - s[x+3+stride]); - } - s+= stride; - } - - return score; +#define VSSE_INTRA(size) \ +static int vsse_intra##size##_c(/*MpegEncContext*/ void *c, uint8_t *s, uint8_t *dummy, int stride, int h){ \ + int score=0; \ + int x,y; \ + \ + for(y=1; y<h; y++){ \ + for(x=0; x<size; x+=4){ \ + score+= SQ(s[x ] - s[x +stride]) + SQ(s[x+1] - s[x+1+stride]) \ + +SQ(s[x+2] - s[x+2+stride]) + SQ(s[x+3] - s[x+3+stride]); \ + } \ + s+= stride; \ + } \ + \ + return score; \ } +VSSE_INTRA(8) +VSSE_INTRA(16) static int vsse16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int stride, int h){ int score=0; @@ -4540,6 +4546,7 @@ SET_CMP_FUNC(hadamard8_diff) c->hadamard8_diff[4]= hadamard8_intra16_c; + c->hadamard8_diff[5]= hadamard8_intra8x8_c; SET_CMP_FUNC(dct_sad) SET_CMP_FUNC(dct_max) #if CONFIG_GPL @@ -4555,8 +4562,10 @@ SET_CMP_FUNC(bit) c->vsad[0]= vsad16_c; c->vsad[4]= vsad_intra16_c; + c->vsad[5]= vsad_intra8_c; c->vsse[0]= vsse16_c; c->vsse[4]= vsse_intra16_c; + c->vsse[5]= vsse_intra8_c; c->nsse[0]= nsse16_c; c->nsse[1]= nsse8_c; #if CONFIG_SNOW_ENCODER