aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dsputil.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-10-13 17:27:30 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-10-13 17:27:30 +0000
commit84705403444dc440a41d6aea2d49bac7bdfdedff (patch)
tree4250e821d043be1a0bf9849e8c768816a9631238 /libavcodec/dsputil.c
parent8c812d73178de487c658e343505d2212ba55bcb1 (diff)
downloadffmpeg-84705403444dc440a41d6aea2d49bac7bdfdedff.tar.gz
mmx2 optimization of huffyuv median encoding
Originally committed as revision 2372 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dsputil.c')
-rw-r--r--libavcodec/dsputil.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 9e7cca734f..270424706a 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -2526,6 +2526,24 @@ static void diff_bytes_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
dst[i+0] = src1[i+0]-src2[i+0];
}
+static void sub_hfyu_median_prediction_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w, int *left, int *left_top){
+ int i;
+ uint8_t l, lt;
+
+ l= *left;
+ lt= *left_top;
+
+ for(i=0; i<w; i++){
+ const int pred= mid_pred(l, src1[i], (l + src1[i] - lt)&0xFF);
+ lt= src1[i];
+ l= src2[i];
+ dst[i]= l - pred;
+ }
+
+ *left= l;
+ *left_top= lt;
+}
+
#define BUTTERFLY2(o1,o2,i1,i2) \
o1= (i1)+(i2);\
o2= (i1)-(i2);
@@ -3007,6 +3025,7 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->add_bytes= add_bytes_c;
c->diff_bytes= diff_bytes_c;
+ c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c;
c->bswap_buf= bswap_buf;
#ifdef HAVE_MMX