[Ffmpeg-devel] snow MC simplification
Michael Niedermayer
michaelni
Sun Jan 8 22:46:49 CET 2006
Hi
Snow currently uses the h.264 luma MC functions if possible and if not
(1/8 pel) then its own MC functions (mc_block())
the result is that mc_block() is only used for some chroma blocks if qpel is
enabled, so it would be nice if we could et rid of it, the attached patch
does that, but it needs testing (encode stuff with and without and view with
the respective player with and without the patch)
if anyone has other ideas on how this can be simplified then dont hesitate
to reply ...
--
Michael
-------------- next part --------------
Index: tests/rotozoom.regression.ref
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/tests/rotozoom.regression.ref,v
retrieving revision 1.109
diff -u -r1.109 rotozoom.regression.ref
--- tests/rotozoom.regression.ref 8 Jan 2006 17:06:26 -0000 1.109
+++ tests/rotozoom.regression.ref 8 Jan 2006 17:32:20 -0000
@@ -119,12 +119,12 @@
3524768 ./data/a-ffv1.avi
dde5895817ad9d219f79a52d0bdfb001 *./data/out.yuv
stddev: 0.00 PSNR:99.99 bytes:7602176
-b926518ac399c7af0f218a7115315b4f *./data/a-snow.avi
-286800 ./data/a-snow.avi
-6c59db71d950610f854d05e2cef18609 *./data/out.yuv
-stddev: 2.32 PSNR:40.80 bytes:7602176
-3f20642bb789dfb75ae3e8c03f9b425c *./data/a-snow53.avi
-2725570 ./data/a-snow53.avi
+32156e088abebab70bd15c7ed0bc80bb *./data/a-snow.avi
+291802 ./data/a-snow.avi
+af37c28d06b651db21bab3aee7f65e85 *./data/out.yuv
+stddev: 2.34 PSNR:40.73 bytes:7602176
+f9b2564fbd045026677cdf46c4350c00 *./data/a-snow53.avi
+2747816 ./data/a-snow53.avi
dde5895817ad9d219f79a52d0bdfb001 *./data/out.yuv
stddev: 0.00 PSNR:99.99 bytes:7602176
a553532dcd54c1c421b52c3b6fece6ef *./data/a-dv.dv
Index: tests/ffmpeg.regression.ref
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/tests/ffmpeg.regression.ref,v
retrieving revision 1.154
diff -u -r1.154 ffmpeg.regression.ref
--- tests/ffmpeg.regression.ref 8 Jan 2006 17:06:26 -0000 1.154
+++ tests/ffmpeg.regression.ref 8 Jan 2006 17:32:20 -0000
@@ -119,12 +119,12 @@
2653642 ./data/a-ffv1.avi
799d3db687f6cdd7a837ec156efc171f *./data/out.yuv
stddev: 0.00 PSNR:99.99 bytes:7602176
-14fa515bf25a47fc2ad3d18b726e8e31 *./data/a-snow.avi
-1197138 ./data/a-snow.avi
-e7c746171b092266b0cf55bb5de2a40a *./data/out.yuv
-stddev: 2.89 PSNR:38.87 bytes:7602176
-11fd61ee7e67ef7a7b2a3df973691305 *./data/a-snow53.avi
-3533710 ./data/a-snow53.avi
+3c0450a0b47961d82e681681cafd10b5 *./data/a-snow.avi
+1187772 ./data/a-snow.avi
+c9685e52b7b36154ead280596691bbb6 *./data/out.yuv
+stddev: 2.89 PSNR:38.88 bytes:7602176
+b484b753cca3cfd7e31f9d592ddd2b16 *./data/a-snow53.avi
+3546164 ./data/a-snow53.avi
799d3db687f6cdd7a837ec156efc171f *./data/out.yuv
stddev: 0.00 PSNR:99.99 bytes:7602176
e1da20e3f52f4d2aa18e9486986161fc *./data/a-dv.dv
Index: libavcodec/snow.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/snow.c,v
retrieving revision 1.78
diff -u -r1.78 snow.c
--- libavcodec/snow.c 8 Jan 2006 01:50:34 -0000 1.78
+++ libavcodec/snow.c 8 Jan 2006 17:32:21 -0000
@@ -2498,9 +2498,14 @@
const int scale= plane_index ? s->mv_scale : 2*s->mv_scale;
int mx= block->mx*scale;
int my= block->my*scale;
- const int dx= mx&15;
- const int dy= my&15;
+ int dx, dy;
const int tab_index= 3 - (b_w>>2) + (b_w>>4);
+ static const round_tab[8]= {0, 0, 2, 0,
+ 0, 0,-2, 0};
+ mx+= round_tab[mx&7];
+ my+= round_tab[my&7];
+ dx= mx&15;
+ dy= my&15;
sx += (mx>>4) - 2;
sy += (my>>4) - 2;
src += sx + sy*stride;
@@ -2513,9 +2518,9 @@
assert(!(b_w&(b_w-1)));
assert(b_w>1 && b_h>1);
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)
+ assert(!(dx&3) && !(dy&3));
+
+ if(b_w==b_h)
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[tab_index+1][dy+(dx>>2)](dst ,src + 2 + 2*stride,stride);
More information about the ffmpeg-devel
mailing list