# HG changeset patch # User michael # Date 1066066050 0 # Node ID 8ffd0c00e6dff6ba68d5265957005f73f9720249 # Parent fcfa169fdbf845c4080f61e2fec564f3e65d1cdd mmx2 optimization of huffyuv median encoding diff -r fcfa169fdbf8 -r 8ffd0c00e6df dsputil.c --- a/dsputil.c Mon Oct 13 14:37:04 2003 +0000 +++ b/dsputil.c Mon Oct 13 17:27:30 2003 +0000 @@ -2526,6 +2526,24 @@ 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; iadd_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 diff -r fcfa169fdbf8 -r 8ffd0c00e6df dsputil.h --- a/dsputil.h Mon Oct 13 14:37:04 2003 +0000 +++ b/dsputil.h Mon Oct 13 17:27:30 2003 +0000 @@ -234,6 +234,11 @@ /* huffyuv specific */ void (*add_bytes)(uint8_t *dst/*align 16*/, uint8_t *src/*align 16*/, int w); void (*diff_bytes)(uint8_t *dst/*align 16*/, uint8_t *src1/*align 16*/, uint8_t *src2/*align 1*/,int w); + /** + * subtract huffyuv's variant of median prediction + * note, this might read from src1[-1], src2[-1] + */ + void (*sub_hfyu_median_prediction)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w, int *left, int *left_top); void (*bswap_buf)(uint32_t *dst, uint32_t *src, int w); /* (I)DCT */ diff -r fcfa169fdbf8 -r 8ffd0c00e6df huffyuv.c --- a/huffyuv.c Mon Oct 13 14:37:04 2003 +0000 +++ b/huffyuv.c Mon Oct 13 17:27:30 2003 +0000 @@ -153,25 +153,6 @@ *left_top= lt; } -//FIXME optimize -static inline void sub_median_prediction(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; idata[0][3]; lefttopu= p->data[1][1]; lefttopv= p->data[2][1]; - sub_median_prediction(s->temp[0], p->data[0]+4, p->data[0] + fake_ystride+4, width-4 , &lefty, &lefttopy); - sub_median_prediction(s->temp[1], p->data[1]+2, p->data[1] + fake_ustride+2, width2-2, &leftu, &lefttopu); - sub_median_prediction(s->temp[2], p->data[2]+2, p->data[2] + fake_vstride+2, width2-2, &leftv, &lefttopv); + s->dsp.sub_hfyu_median_prediction(s->temp[0], p->data[0]+4, p->data[0] + fake_ystride+4, width-4 , &lefty, &lefttopy); + s->dsp.sub_hfyu_median_prediction(s->temp[1], p->data[1]+2, p->data[1] + fake_ustride+2, width2-2, &leftu, &lefttopu); + s->dsp.sub_hfyu_median_prediction(s->temp[2], p->data[2]+2, p->data[2] + fake_vstride+2, width2-2, &leftv, &lefttopv); encode_422_bitstream(s, width-4); y++; cy++; @@ -1011,7 +992,7 @@ if(s->bitstream_bpp==12){ while(2*cy > y){ ydst= p->data[0] + p->linesize[0]*y; - sub_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy); + s->dsp.sub_hfyu_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy); encode_gray_bitstream(s, width); y++; } @@ -1021,9 +1002,9 @@ udst= p->data[1] + p->linesize[1]*cy; vdst= p->data[2] + p->linesize[2]*cy; - sub_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy); - sub_median_prediction(s->temp[1], udst - fake_ustride, udst, width2, &leftu, &lefttopu); - sub_median_prediction(s->temp[2], vdst - fake_vstride, vdst, width2, &leftv, &lefttopv); + s->dsp.sub_hfyu_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy); + s->dsp.sub_hfyu_median_prediction(s->temp[1], udst - fake_ustride, udst, width2, &leftu, &lefttopu); + s->dsp.sub_hfyu_median_prediction(s->temp[2], vdst - fake_vstride, vdst, width2, &leftv, &lefttopv); encode_422_bitstream(s, width); } diff -r fcfa169fdbf8 -r 8ffd0c00e6df i386/dsputil_mmx.c --- a/i386/dsputil_mmx.c Mon Oct 13 14:37:04 2003 +0000 +++ b/i386/dsputil_mmx.c Mon Oct 13 17:27:30 2003 +0000 @@ -583,6 +583,43 @@ for(; isub_hfyu_median_prediction= sub_hfyu_median_prediction_mmx2; } else if (mm_flags & MM_3DNOW) { c->put_pixels_tab[0][1] = put_pixels16_x2_3dnow; c->put_pixels_tab[0][2] = put_pixels16_y2_3dnow;