[FFmpeg-cvslog] swscale: split hScale() function pointer into h[cy]Scale().

Ronald S. Bultje git at videolan.org
Thu Aug 18 11:48:06 CEST 2011


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Wed Aug  3 11:25:01 2011 -0700| [3f04ab4fcddaaf166da2d623927a6b8547ab87a6] | committer: Ronald S. Bultje

swscale: split hScale() function pointer into h[cy]Scale().

This allows using more specific implementations for chroma/luma, e.g.
we can make assumptions on filterSize being constant, thus avoiding
that test at runtime.

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

 libswscale/ppc/swscale_altivec.c  |    2 +-
 libswscale/swscale.c              |   12 ++++++------
 libswscale/swscale_internal.h     |   11 ++++++++---
 libswscale/x86/swscale_template.c |    2 +-
 4 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/libswscale/ppc/swscale_altivec.c b/libswscale/ppc/swscale_altivec.c
index 7fdca39..67db2de 100644
--- a/libswscale/ppc/swscale_altivec.c
+++ b/libswscale/ppc/swscale_altivec.c
@@ -400,7 +400,7 @@ void ff_sws_init_swScale_altivec(SwsContext *c)
         return;
 
     if (c->srcBpc == 8 && c->dstBpc <= 10) {
-        c->hScale       = hScale_altivec_real;
+        c->hyScale = c->hcScale = hScale_altivec_real;
     }
     if (!is16BPS(dstFormat) && !is9_OR_10BPS(dstFormat) &&
         dstFormat != PIX_FMT_NV12 && dstFormat != PIX_FMT_NV21 &&
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index f5b0ab4..733f57b 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -2087,7 +2087,7 @@ static av_always_inline void hyscale(SwsContext *c, int16_t *dst, int dstWidth,
     }
 
     if (!c->hyscale_fast) {
-        c->hScale(c, dst, dstWidth, src, hLumFilter, hLumFilterPos, hLumFilterSize);
+        c->hyScale(c, dst, dstWidth, src, hLumFilter, hLumFilterPos, hLumFilterSize);
     } else { // fast bilinear upscale / crap downscale
         c->hyscale_fast(c, dst, dstWidth, src, srcW, xInc);
     }
@@ -2125,8 +2125,8 @@ static av_always_inline void hcscale(SwsContext *c, int16_t *dst1, int16_t *dst2
     }
 
     if (!c->hcscale_fast) {
-        c->hScale(c, dst1, dstWidth, src1, hChrFilter, hChrFilterPos, hChrFilterSize);
-        c->hScale(c, dst2, dstWidth, src2, hChrFilter, hChrFilterPos, hChrFilterSize);
+        c->hcScale(c, dst1, dstWidth, src1, hChrFilter, hChrFilterPos, hChrFilterSize);
+        c->hcScale(c, dst2, dstWidth, src2, hChrFilter, hChrFilterPos, hChrFilterSize);
     } else { // fast bilinear upscale / crap downscale
         c->hcscale_fast(c, dst1, dst2, dstWidth, src1, src2, srcW, xInc);
     }
@@ -2789,16 +2789,16 @@ static av_cold void sws_init_swScale_c(SwsContext *c)
 
     if (c->srcBpc == 8) {
         if (c->dstBpc <= 10) {
-            c->hScale       = hScale8To15_c;
+            c->hyScale = c->hcScale = hScale8To15_c;
             if (c->flags & SWS_FAST_BILINEAR) {
                 c->hyscale_fast = hyscale_fast_c;
                 c->hcscale_fast = hcscale_fast_c;
             }
         } else {
-            c->hScale = hScale8To19_c;
+            c->hyScale = c->hcScale = hScale8To19_c;
         }
     } else {
-        c->hScale = c->dstBpc > 10 ? hScale16To19_c : hScale16To15_c;
+        c->hyScale = c->hcScale = c->dstBpc > 10 ? hScale16To19_c : hScale16To15_c;
     }
 
     if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index d09477e..a13b89d 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -481,9 +481,14 @@ typedef struct SwsContext {
      *                   (and input coefficients thus padded with zeroes)
      *                   to simplify creating SIMD code.
      */
-    void (*hScale)(struct SwsContext *c, int16_t *dst, int dstW, const uint8_t *src,
-                   const int16_t *filter, const int16_t *filterPos,
-                   int filterSize);
+    /** @{ */
+    void (*hyScale)(struct SwsContext *c, int16_t *dst, int dstW, const uint8_t *src,
+                    const int16_t *filter, const int16_t *filterPos,
+                    int filterSize);
+    void (*hcScale)(struct SwsContext *c, int16_t *dst, int dstW, const uint8_t *src,
+                    const int16_t *filter, const int16_t *filterPos,
+                    int filterSize);
+    /** @} */
 
     void (*lumConvertRange)(int16_t *dst, int width); ///< Color range conversion function for luma plane if needed.
     void (*chrConvertRange)(int16_t *dst1, int16_t *dst2, int width); ///< Color range conversion function for chroma planes if needed.
diff --git a/libswscale/x86/swscale_template.c b/libswscale/x86/swscale_template.c
index 0a5f5d5..705c623 100644
--- a/libswscale/x86/swscale_template.c
+++ b/libswscale/x86/swscale_template.c
@@ -2318,7 +2318,7 @@ static av_cold void RENAME(sws_init_swScale)(SwsContext *c)
 
     if (c->srcBpc == 8 && c->dstBpc <= 10) {
 #if !COMPILE_TEMPLATE_MMX2
-    c->hScale       = RENAME(hScale      );
+    c->hyScale = c->hcScale = RENAME(hScale      );
 #endif /* !COMPILE_TEMPLATE_MMX2 */
 
     // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one).



More information about the ffmpeg-cvslog mailing list