summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorRoman Shaposhnik <roman@shaposhnik.org>2009-02-19 00:30:24 +0000
committerRoman Shaposhnik <roman@shaposhnik.org>2009-02-19 00:30:24 +0000
commit7fb7f6367a4cc55a0ab0b42a11d1e2c2086e3877 (patch)
tree2d2e657c9e73188c9a3fa15dec93d3cf9b03a0ce /libavcodec
parent4cff8dc88fb9932ad797e03e6df9aef91272b46e (diff)
Adding 2 intra 8x8 cmp functions: vsad, vsse
Originally committed as revision 17448 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dsputil.c65
1 files changed, 37 insertions, 28 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 71a5b946e4..86a6c37793 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -3937,20 +3937,23 @@ static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, in
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 @@ static int vsad16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int st
}
#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 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx)
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 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx)
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