From 80e44bc3bf31ead00fe3df3d1bf2a197cd0856d8 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 8 Jan 2006 01:50:34 +0000 Subject: [PATCH] use h264 MC functions for 2xX Xx2 blocks in snow too Originally committed as revision 4824 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/dsputil.c | 75 +++++++++++++++++++++++++++++++++++++++++++ libavcodec/dsputil.h | 5 +-- libavcodec/snow.c | 14 ++++---- tests/ffmpeg.regression.ref | 4 +-- tests/rotozoom.regression.ref | 4 +-- 5 files changed, 90 insertions(+), 12 deletions(-) diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 3587ebf..c7ae725 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -1487,6 +1487,17 @@ H264_CHROMA_MC(avg_ , op_avg) #undef op_avg #undef op_put +static inline void copy_block2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h) +{ + int i; + for(i=0; il) #define LD64(a) (((const struct unaligned_64 *) (a))->l) +#define ST16(a, b) (((struct unaligned_16 *) (a))->l) = (b) #define ST32(a, b) (((struct unaligned_32 *) (a))->l) = (b) #else /* __GNUC__ */ diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 0aa56db..20d24f4 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -2500,6 +2500,7 @@ static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *src, uint8_t *tmp, int my= block->my*scale; const int dx= mx&15; const int dy= my&15; + const int tab_index= 3 - (b_w>>2) + (b_w>>4); sx += (mx>>4) - 2; sy += (my>>4) - 2; src += sx + sy*stride; @@ -2511,17 +2512,18 @@ static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *src, uint8_t *tmp, assert(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h); assert(!(b_w&(b_w-1))); assert(b_w>1 && b_h>1); - if((dx&3) || (dy&3) || b_w==2 || b_h==2) + assert(tab_index>=0 && tab_index<4); + if((dx&3) || (dy&3)) mc_block(dst, src, tmp, stride, b_w, b_h, dx, dy); else if(b_w==b_h) - s->dsp.put_h264_qpel_pixels_tab[2-(b_w>>3)][dy+(dx>>2)](dst,src + 2 + 2*stride,stride); + s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst,src + 2 + 2*stride,stride); else if(b_w==2*b_h){ - s->dsp.put_h264_qpel_pixels_tab[2-(b_h>>3)][dy+(dx>>2)](dst ,src + 2 + 2*stride,stride); - s->dsp.put_h264_qpel_pixels_tab[2-(b_h>>3)][dy+(dx>>2)](dst+b_h,src + 2 + b_h + 2*stride,stride); + s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst ,src + 2 + 2*stride,stride); + s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst+b_h,src + 2 + b_h + 2*stride,stride); }else{ assert(2*b_w==b_h); - s->dsp.put_h264_qpel_pixels_tab[2-(b_w>>3)][dy+(dx>>2)](dst ,src + 2 + 2*stride ,stride); - s->dsp.put_h264_qpel_pixels_tab[2-(b_w>>3)][dy+(dx>>2)](dst+b_w*stride,src + 2 + 2*stride+b_w*stride,stride); + s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst ,src + 2 + 2*stride ,stride); + s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst+b_w*stride,src + 2 + 2*stride+b_w*stride,stride); } } } diff --git a/tests/ffmpeg.regression.ref b/tests/ffmpeg.regression.ref index c56846f..f845e19 100644 --- a/tests/ffmpeg.regression.ref +++ b/tests/ffmpeg.regression.ref @@ -123,8 +123,8 @@ stddev: 0.00 PSNR:99.99 bytes:7602176 1197138 ./data/a-snow.avi e7c746171b092266b0cf55bb5de2a40a *./data/out.yuv stddev: 2.89 PSNR:38.87 bytes:7602176 -94bedf8929178a8202ae3b5dbcdb84dd *./data/a-snow53.avi -3533696 ./data/a-snow53.avi +11fd61ee7e67ef7a7b2a3df973691305 *./data/a-snow53.avi +3533710 ./data/a-snow53.avi 799d3db687f6cdd7a837ec156efc171f *./data/out.yuv stddev: 0.00 PSNR:99.99 bytes:7602176 e1da20e3f52f4d2aa18e9486986161fc *./data/a-dv.dv diff --git a/tests/rotozoom.regression.ref b/tests/rotozoom.regression.ref index 4eda12d..33280ef 100644 --- a/tests/rotozoom.regression.ref +++ b/tests/rotozoom.regression.ref @@ -123,8 +123,8 @@ b926518ac399c7af0f218a7115315b4f *./data/a-snow.avi 286800 ./data/a-snow.avi 6c59db71d950610f854d05e2cef18609 *./data/out.yuv stddev: 2.32 PSNR:40.80 bytes:7602176 -4d2bcc832e318fad3c25614e31daa6fe *./data/a-snow53.avi -2725630 ./data/a-snow53.avi +3f20642bb789dfb75ae3e8c03f9b425c *./data/a-snow53.avi +2725570 ./data/a-snow53.avi dde5895817ad9d219f79a52d0bdfb001 *./data/out.yuv stddev: 0.00 PSNR:99.99 bytes:7602176 a553532dcd54c1c421b52c3b6fece6ef *./data/a-dv.dv -- 2.7.4