Browse code

swscale: remove VOF/VOFW.

Ronald S. Bultje authored on 2011/05/26 22:17:52
Showing 2 changed files
... ...
@@ -35,14 +35,6 @@
35 35
 
36 36
 #define MAX_FILTER_SIZE 256
37 37
 
38
-#if ARCH_X86
39
-#define VOFW 5120
40
-#else
41
-#define VOFW 2048 // faster on PPC and not tested on others
42
-#endif
43
-
44
-#define VOF  (VOFW*2)
45
-
46 38
 #if HAVE_BIGENDIAN
47 39
 #define ALT32_CORR (-1)
48 40
 #else
... ...
@@ -749,6 +749,7 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
749 749
     int srcH= c->srcH;
750 750
     int dstW= c->dstW;
751 751
     int dstH= c->dstH;
752
+    int dst_stride = FFALIGN(dstW * sizeof(int16_t), 16), dst_stride_px = dst_stride >> 1;
752 753
     int flags, cpu_flags;
753 754
     enum PixelFormat srcFormat= c->srcFormat;
754 755
     enum PixelFormat dstFormat= c->dstFormat;
... ...
@@ -996,26 +997,24 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
996 996
     //Note we need at least one pixel more at the end because of the MMX code (just in case someone wanna replace the 4000/8000)
997 997
     /* align at 16 bytes for AltiVec */
998 998
     for (i=0; i<c->vLumBufSize; i++) {
999
-        FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i+c->vLumBufSize], VOF+1, fail);
999
+        FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i+c->vLumBufSize], dst_stride+1, fail);
1000 1000
         c->lumPixBuf[i] = c->lumPixBuf[i+c->vLumBufSize];
1001 1001
     }
1002
-    c->uv_off = VOFW;
1002
+    c->uv_off = dst_stride_px;
1003 1003
     for (i=0; i<c->vChrBufSize; i++) {
1004
-        FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i+c->vChrBufSize], VOF*2+1, fail);
1004
+        FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i+c->vChrBufSize], dst_stride*2+1, fail);
1005 1005
         c->chrUPixBuf[i] = c->chrUPixBuf[i+c->vChrBufSize];
1006
-        c->chrVPixBuf[i] = c->chrVPixBuf[i+c->vChrBufSize] = c->chrUPixBuf[i] + VOFW;
1006
+        c->chrVPixBuf[i] = c->chrVPixBuf[i+c->vChrBufSize] = c->chrUPixBuf[i] + dst_stride_px;
1007 1007
     }
1008 1008
     if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
1009 1009
         for (i=0; i<c->vLumBufSize; i++) {
1010
-            FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i+c->vLumBufSize], VOF+1, fail);
1010
+            FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i+c->vLumBufSize], dst_stride+1, fail);
1011 1011
             c->alpPixBuf[i] = c->alpPixBuf[i+c->vLumBufSize];
1012 1012
         }
1013 1013
 
1014 1014
     //try to avoid drawing green stuff between the right end and the stride end
1015 1015
     for (i=0; i<c->vChrBufSize; i++)
1016
-        memset(c->chrUPixBuf[i], 64, VOF*2+1);
1017
-
1018
-    assert(2*VOFW == VOF);
1016
+        memset(c->chrUPixBuf[i], 64, dst_stride*2+1);
1019 1017
 
1020 1018
     assert(c->chrDstH <= dstH);
1021 1019