[FFmpeg-cvslog] Move add_hfyu_left_prediction_int16 to losslessviddsp

Michael Niedermayer git at videolan.org
Mon Jan 20 23:03:40 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Jan 20 22:21:24 2014 +0100| [883570e6b70ae4d1413d2d2f552687d80b32e1e5] | committer: Michael Niedermayer

Move add_hfyu_left_prediction_int16 to losslessviddsp

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=883570e6b70ae4d1413d2d2f552687d80b32e1e5
---

 libavcodec/huffyuvdec.c        |   21 +--------------------
 libavcodec/lossless_videodsp.c |   21 +++++++++++++++++++++
 libavcodec/lossless_videodsp.h |    1 +
 3 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 26c8309..59d58a8 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -680,26 +680,7 @@ static int left_prediction(HYuvContext *s, uint8_t *dst, const uint8_t *src, int
     if (s->bps <= 8) {
         return s->dsp.add_hfyu_left_prediction(dst, src, w, acc);
     } else {
-        //FIXME optimize
-        unsigned mask = s->n-1;
-        int i;
-        const uint16_t *src16 = (const uint16_t *)src;
-        uint16_t       *dst16 = (      uint16_t *)dst;
-
-        for(i=0; i<w-1; i++){
-            acc+= src16[i];
-            dst16[i]= acc & mask;
-            i++;
-            acc+= src16[i];
-            dst16[i]= acc & mask;
-        }
-
-        for(; i<w; i++){
-            acc+= src16[i];
-            dst16[i]= acc & mask;
-        }
-
-        return acc;
+        return s->llviddsp.add_hfyu_left_prediction_int16((      uint16_t *)dst, (const uint16_t *)src, s->n-1, w, acc);
     }
 }
 
diff --git a/libavcodec/lossless_videodsp.c b/libavcodec/lossless_videodsp.c
index 7654f3e..e494072 100644
--- a/libavcodec/lossless_videodsp.c
+++ b/libavcodec/lossless_videodsp.c
@@ -59,10 +59,31 @@ static void diff_int16_c(uint16_t *dst, const uint16_t *src1, const uint16_t *sr
         dst[i] = (src1[i] - src2[i]) & mask;
 }
 
+static int add_hfyu_left_prediction_int16_c(uint16_t *dst, const uint16_t *src, unsigned mask, int w, int acc){
+    int i;
+
+    for(i=0; i<w-1; i++){
+        acc+= src[i];
+        dst[i]= acc & mask;
+        i++;
+        acc+= src[i];
+        dst[i]= acc & mask;
+    }
+
+    for(; i<w; i++){
+        acc+= src[i];
+        dst[i]= acc & mask;
+    }
+
+    return acc;
+}
+
+
 void ff_llviddsp_init(LLVidDSPContext *c)
 {
     c->add_int16 = add_int16_c;
     c->diff_int16= diff_int16_c;
+    c->add_hfyu_left_prediction_int16   = add_hfyu_left_prediction_int16_c;
 
     if (ARCH_X86)
         ff_llviddsp_init_x86(c);
diff --git a/libavcodec/lossless_videodsp.h b/libavcodec/lossless_videodsp.h
index 79dcc74..3f768ad 100644
--- a/libavcodec/lossless_videodsp.h
+++ b/libavcodec/lossless_videodsp.h
@@ -28,6 +28,7 @@
 typedef struct LLVidDSPContext {
     void (*add_int16)(uint16_t *dst/*align 16*/, const uint16_t *src/*align 16*/, unsigned mask, int w);
     void (*diff_int16)(uint16_t *dst/*align 16*/, const uint16_t *src1/*align 16*/, const uint16_t *src2/*align 1*/, unsigned mask, int w);
+    int  (*add_hfyu_left_prediction_int16)(uint16_t *dst, const uint16_t *src, unsigned mask, int w, int left);
 } LLVidDSPContext;
 
 void ff_llviddsp_init(LLVidDSPContext *llviddsp);



More information about the ffmpeg-cvslog mailing list