[FFmpeg-cvslog] Move sub_hfyu_median_prediction_int16() to losslessviddsp

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


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

Move sub_hfyu_median_prediction_int16() to losslessviddsp

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

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

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

diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index aba8f9c..7c19a08 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -156,25 +156,7 @@ static void sub_median_prediction(HYuvContext *s, uint8_t *dst, const uint8_t *s
     if (s->bps <= 8) {
         s->dsp.sub_hfyu_median_prediction(dst, src1, src2, w , left, left_top);
     } else {
-        int i;
-        uint16_t l, lt;
-        const uint16_t *src116 = (const uint16_t *)src1;
-        const uint16_t *src216 = (const uint16_t *)src2;
-        uint16_t       *dst16  = (      uint16_t *)dst;
-        unsigned mask = s->n - 1;
-
-        l  = *left;
-        lt = *left_top;
-
-        for(i=0; i<w; i++){
-            const int pred = mid_pred(l, src116[i], (l + src116[i] - lt) & mask);
-            lt = src116[i];
-            l  = src216[i];
-            dst16[i] = (l - pred) & mask;
-        }
-
-        *left     = l;
-        *left_top = lt;
+        s->llviddsp.sub_hfyu_median_prediction_int16((uint16_t *)dst, (const uint16_t *)src1, (const uint16_t *)src2, s->n - 1, w , left, left_top);
     }
 }
 
diff --git a/libavcodec/lossless_videodsp.c b/libavcodec/lossless_videodsp.c
index 8279901..72eeb26 100644
--- a/libavcodec/lossless_videodsp.c
+++ b/libavcodec/lossless_videodsp.c
@@ -77,6 +77,24 @@ static void add_hfyu_median_prediction_int16_c(uint16_t *dst, const uint16_t *sr
     *left_top = lt;
 }
 
+static void sub_hfyu_median_prediction_int16_c(uint16_t *dst, const uint16_t *src1, const uint16_t *src2, unsigned mask, int w, int *left, int *left_top){
+    int i;
+    uint16_t l, lt;
+
+    l  = *left;
+    lt = *left_top;
+
+    for(i=0; i<w; i++){
+        const int pred = mid_pred(l, src1[i], (l + src1[i] - lt) & mask);
+        lt = src1[i];
+        l  = src2[i];
+        dst[i] = (l - pred) & mask;
+    }
+
+    *left     = l;
+    *left_top = lt;
+}
+
 static int add_hfyu_left_prediction_int16_c(uint16_t *dst, const uint16_t *src, unsigned mask, int w, int acc){
     int i;
 
@@ -103,6 +121,7 @@ void ff_llviddsp_init(LLVidDSPContext *c)
     c->diff_int16= diff_int16_c;
     c->add_hfyu_left_prediction_int16   = add_hfyu_left_prediction_int16_c;
     c->add_hfyu_median_prediction_int16 = add_hfyu_median_prediction_int16_c;
+    c->sub_hfyu_median_prediction_int16 = sub_hfyu_median_prediction_int16_c;
 
     if (ARCH_X86)
         ff_llviddsp_init_x86(c);
diff --git a/libavcodec/lossless_videodsp.h b/libavcodec/lossless_videodsp.h
index 87b133a..e4dfca3 100644
--- a/libavcodec/lossless_videodsp.h
+++ b/libavcodec/lossless_videodsp.h
@@ -29,6 +29,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);
 
+    void (*sub_hfyu_median_prediction_int16)(uint16_t *dst, const uint16_t *src1, const uint16_t *src2, unsigned mask, int w, int *left, int *left_top);
     void (*add_hfyu_median_prediction_int16)(uint16_t *dst, const uint16_t *top, const uint16_t *diff, unsigned mask, int w, int *left, int *left_top);
     int  (*add_hfyu_left_prediction_int16)(uint16_t *dst, const uint16_t *src, unsigned mask, int w, int left);
 } LLVidDSPContext;



More information about the ffmpeg-cvslog mailing list