changeset 6510:4f23a6c3cda4

use libavcodec's optimized MC functions
author arpi
date Sat, 22 Jun 2002 23:58:15 +0000
parents 762d3cf8da36
children a2086150099b
files libmpcodecs/native/svq1.c
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/native/svq1.c	Sat Jun 22 23:57:45 2002 +0000
+++ b/libmpcodecs/native/svq1.c	Sat Jun 22 23:58:15 2002 +0000
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "../../config.h"
 #include "bswap.h"
 
 /* variable length (bit) code */
@@ -40,6 +41,12 @@
 #include "svq1.h"
 #include "svq1_cb.h"
 
+#ifdef USE_LIBAVCODEC
+typedef void (*op_pixels_func)(unsigned char *block, const unsigned char *pixels, int line_size, int h);
+extern op_pixels_func put_pixels_tab[4];
+extern op_pixels_func put_no_rnd_pixels_tab[4];
+#endif
+
 /* memory bit stream */
 typedef struct bit_buffer_s {
   uint8_t	*buffer;
@@ -339,6 +346,10 @@
   src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1))*pitch];
   dst = current;
 
+#ifdef USE_LIBAVCODEC
+  put_pixels_tab[((mv.y & 1) << 1) | (mv.x & 1)](dst,src,pitch,16);
+  put_pixels_tab[((mv.y & 1) << 1) | (mv.x & 1)](dst+8,src+8,pitch,16);
+#else
   /* form prediction */
   if (mv.y & 0x1) {
     if (mv.x & 0x1) {
@@ -375,6 +386,7 @@
       }
     }
   }
+#endif
 
   return 0;
 }
@@ -441,6 +453,9 @@
     src = &previous[(x + (pmv[i]->x >> 1)) + (y + (pmv[i]->y >> 1))*pitch];
     dst = current;
 
+#ifdef USE_LIBAVCODEC
+    put_pixels_tab[((pmv[i]->y & 1) << 1) | (pmv[i]->x & 1)](dst,src,pitch,8);
+#else
     if (pmv[i]->y & 0x1) {
       if (pmv[i]->x & 0x1) {
 	for (sy=0; sy < 8; sy++) {
@@ -476,6 +491,7 @@
 	}
       }
     }
+#endif
 
     /* select next block */
     if (i & 1) {