From a5db5bda07fa3cec06024d1e18fcbcb855a37d37 Mon Sep 17 00:00:00 2001
From: Luca Barbato <lu_zero@gentoo.org>
Date: Thu, 12 Oct 2006 10:26:07 +0000
Subject: [PATCH] ppc generic prefetch

Originally committed as revision 6669 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavcodec/ppc/dsputil_ppc.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ppc/dsputil_ppc.c b/libavcodec/ppc/dsputil_ppc.c
index 48076d25a30..b8502a0dd2d 100644
--- a/libavcodec/ppc/dsputil_ppc.c
+++ b/libavcodec/ppc/dsputil_ppc.c
@@ -249,10 +249,19 @@ long check_dcbzl_effect(void)
 }
 #endif
 
+static void prefetch_ppc(void *mem, int stride, int h)
+{
+    register const uint8_t *p = mem;
+    do {
+        asm volatile ("dcbt 0,%0" : : "r" (p));
+        p+= stride;
+    } while(--h);
+}
+
 void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx)
 {
     // Common optimizations whether Altivec is available or not
-
+    c->prefetch = prefetch_ppc;
     switch (check_dcbzl_effect()) {
         case 32:
             c->clear_blocks = clear_blocks_dcbz32_ppc;
-- 
GitLab