[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19292] trunk/blender/extern/ffmpeg: Bug #18396: Upgraded FFMPEG gives color artefacts.

Benoit Bolsee benoit.bolsee at online.be
Sat Mar 14 18:39:08 CET 2009


Revision: 19292
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19292
Author:   ben2610
Date:     2009-03-14 18:39:07 +0100 (Sat, 14 Mar 2009)

Log Message:
-----------
Bug #18396: Upgraded FFMPEG gives color artefacts. The problem as been identified as a discrepency between libswscale and the rest of ffmpeg code due to a different revision numbering scheme for libswscale. Both extern/ffmpeg and Windows versions are now in sync with ffmpeg revision 12758 and libswscale revision 26336.

Revision Links:
--------------
    http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12758
    http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26336

Modified Paths:
--------------
    trunk/blender/extern/ffmpeg/ffmpeg-update.sh
    trunk/blender/extern/ffmpeg/libavcodec/vp56.c
    trunk/blender/extern/ffmpeg/libswscale/Makefile
    trunk/blender/extern/ffmpeg/libswscale/cs_test.c
    trunk/blender/extern/ffmpeg/libswscale/internal_bfin.S
    trunk/blender/extern/ffmpeg/libswscale/rgb2rgb.c
    trunk/blender/extern/ffmpeg/libswscale/rgb2rgb.h
    trunk/blender/extern/ffmpeg/libswscale/rgb2rgb_template.c
    trunk/blender/extern/ffmpeg/libswscale/swscale-example.c
    trunk/blender/extern/ffmpeg/libswscale/swscale.c
    trunk/blender/extern/ffmpeg/libswscale/swscale.h
    trunk/blender/extern/ffmpeg/libswscale/swscale_altivec_template.c
    trunk/blender/extern/ffmpeg/libswscale/swscale_bfin.c
    trunk/blender/extern/ffmpeg/libswscale/swscale_internal.h
    trunk/blender/extern/ffmpeg/libswscale/swscale_template.c
    trunk/blender/extern/ffmpeg/libswscale/yuv2rgb.c
    trunk/blender/extern/ffmpeg/libswscale/yuv2rgb_altivec.c
    trunk/blender/extern/ffmpeg/libswscale/yuv2rgb_bfin.c
    trunk/blender/extern/ffmpeg/libswscale/yuv2rgb_mlib.c
    trunk/blender/extern/ffmpeg/libswscale/yuv2rgb_template.c
    trunk/blender/extern/ffmpeg/libswscale/yuv2rgb_vis.c

Removed Paths:
-------------
    trunk/blender/extern/ffmpeg/libswscale/swscale_avoption.c

Modified: trunk/blender/extern/ffmpeg/ffmpeg-update.sh
===================================================================
--- trunk/blender/extern/ffmpeg/ffmpeg-update.sh	2009-03-14 13:59:45 UTC (rev 19291)
+++ trunk/blender/extern/ffmpeg/ffmpeg-update.sh	2009-03-14 17:39:07 UTC (rev 19292)
@@ -13,7 +13,10 @@
 
 mkdir ffmpeg
 
-svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
+# get the latest revision from SVN.
+# Please note that if you want to retrieve a specific revision,
+# libswscale has a different revision number than the rest of ffmpeg.
+svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
 
 rm -rf `find ffmpeg/ -type d -name ".svn"`
 

Modified: trunk/blender/extern/ffmpeg/libavcodec/vp56.c
===================================================================
--- trunk/blender/extern/ffmpeg/libavcodec/vp56.c	2009-03-14 13:59:45 UTC (rev 19291)
+++ trunk/blender/extern/ffmpeg/libavcodec/vp56.c	2009-03-14 17:39:07 UTC (rev 19292)
@@ -499,11 +499,12 @@
 {
     vp56_context_t *s = avctx->priv_data;
     AVFrame *const p = s->framep[VP56_FRAME_CURRENT];
+    int remaining_buf_size = buf_size;
     int is_alpha, alpha_offset;
 
     if (s->has_alpha) {
         alpha_offset = bytestream_get_be24(&buf);
-        buf_size -= 3;
+        remaining_buf_size -= 3;
     }
 
     for (is_alpha=0; is_alpha < 1+s->has_alpha; is_alpha++) {
@@ -514,7 +515,7 @@
 
         s->modelp = &s->models[is_alpha];
 
-        res = s->parse_header(s, buf, buf_size, &golden_frame);
+        res = s->parse_header(s, buf, remaining_buf_size, &golden_frame);
         if (!res)
             return -1;
 
@@ -619,7 +620,7 @@
             FFSWAP(AVFrame *, s->framep[VP56_FRAME_GOLDEN],
                               s->framep[VP56_FRAME_GOLDEN2]);
             buf += alpha_offset;
-            buf_size -= alpha_offset;
+            remaining_buf_size -= alpha_offset;
         }
     }
 

Modified: trunk/blender/extern/ffmpeg/libswscale/Makefile
===================================================================
--- trunk/blender/extern/ffmpeg/libswscale/Makefile	2009-03-14 13:59:45 UTC (rev 19291)
+++ trunk/blender/extern/ffmpeg/libswscale/Makefile	2009-03-14 17:39:07 UTC (rev 19292)
@@ -1,25 +1,26 @@
-include $(SUBDIR)../config.mak
+include ../config.mak
 
 NAME = swscale
 FFLIBS = avutil
 
-HEADERS = swscale.h
+OBJS = rgb2rgb.o swscale.o
 
-OBJS = rgb2rgb.o swscale.o swscale_avoption.o
-
-OBJS-$(ARCH_BFIN)          +=  internal_bfin.o swscale_bfin.o yuv2rgb_bfin.o
 OBJS-$(CONFIG_GPL)         +=  yuv2rgb.o
-OBJS-$(CONFIG_MLIB)        +=  yuv2rgb_mlib.o
 OBJS-$(HAVE_ALTIVEC)       +=  yuv2rgb_altivec.o
-OBJS-$(HAVE_VIS)           +=  yuv2rgb_vis.o
 
-TESTS = cs_test swscale-example
+OBJS-$(ARCH_BFIN)          +=  swscale_bfin.o \
+                               yuv2rgb_bfin.o \
 
-CLEANFILES = cs_test swscale-example
+ASM_OBJS-$(ARCH_BFIN)      += internal_bfin.o
 
-include $(SUBDIR)../common.mak
+HEADERS = swscale.h rgb2rgb.h
 
-$(SUBDIR)cs_test: $(SUBDIR)cs_test.o $(SUBDIR)$(LIBNAME)
+include ../common.mak
 
-$(SUBDIR)swscale-example: $(SUBDIR)swscale-example.o $(SUBDIR)$(LIBNAME)
-$(SUBDIR)swscale-example: EXTRALIBS += -lm
+cs_test: cs_test.o $(LIBNAME)
+
+swscale-example: swscale-example.o $(LIBNAME)
+swscale-example: EXTRALIBS += -lm
+
+clean::
+	rm -f cs_test swscale-example

Modified: trunk/blender/extern/ffmpeg/libswscale/cs_test.c
===================================================================
--- trunk/blender/extern/ffmpeg/libswscale/cs_test.c	2009-03-14 13:59:45 UTC (rev 19291)
+++ trunk/blender/extern/ffmpeg/libswscale/cs_test.c	2009-03-14 17:39:07 UTC (rev 19292)
@@ -3,18 +3,18 @@
  *
  * This file is part of FFmpeg.
  *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * FFmpeg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -75,7 +75,7 @@
         struct func_info_s {
             int src_bpp;
             int dst_bpp;
-            const char *name;
+            char *name;
             void (*func)(const uint8_t *src, uint8_t *dst, long src_size);
         } func_info[] = {
             FUNC(2, 2, rgb15to16),
@@ -127,7 +127,7 @@
                 for(srcOffset=128; srcOffset<196; srcOffset+=4){
                     uint8_t *src= srcBuffer+srcOffset;
                     uint8_t *dst= dstBuffer+dstOffset;
-                    const char *name=NULL;
+                    char *name=NULL;
 
                     if(failed) break; //don't fill the screen with shit ...
 

Modified: trunk/blender/extern/ffmpeg/libswscale/internal_bfin.S
===================================================================
--- trunk/blender/extern/ffmpeg/libswscale/internal_bfin.S	2009-03-14 13:59:45 UTC (rev 19291)
+++ trunk/blender/extern/ffmpeg/libswscale/internal_bfin.S	2009-03-14 17:39:07 UTC (rev 19292)
@@ -2,8 +2,8 @@
  * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
  *                    April 20, 2007
  *
- * Blackfin video color space converter operations
- * convert I420 YV12 to RGB in various formats
+ * Blackfin Video Color Space Converters Operations
+ *  convert I420 YV12 to RGB in various formats,
  *
  * This file is part of FFmpeg.
  *
@@ -24,73 +24,74 @@
 
 
 /*
-YUV420 to RGB565 conversion. This routine takes a YUV 420 planar macroblock
-and converts it to RGB565. R:5 bits, G:6 bits, B:5 bits.. packed into shorts.
+    YUV420 to RGB565 conversion.  This routine takes a YUV 420 planar macroblock
+    and converts it to RGB565.  R:5 bits, G:6 bits, B:5 bits.. packed into shorts
 
 
-The following calculation is used for the conversion:
+    The following calculation is used for the conversion:
 
-  r = clipz((y-oy)*cy  + crv*(v-128))
-  g = clipz((y-oy)*cy  + cgv*(v-128) + cgu*(u-128))
-  b = clipz((y-oy)*cy  + cbu*(u-128))
+      r = clipz((y-oy)*cy  + crv*(v-128))
+      g = clipz((y-oy)*cy  + cgv*(v-128) + cgu*(u-128))
+      b = clipz((y-oy)*cy  + cbu*(u-128))
 
-y,u,v are prescaled by a factor of 4 i.e. left-shifted to gain precision.
+    y,u,v are pre scaled by a factor of 4 i.e. left shifted to gain precision.
 
 
-New factorization to eliminate the truncation error which was
-occurring due to the byteop3p.
+    New factorization to eliminate the truncation error which was
+    occuring due to the byteop3p.
 
 
-1) Use the bytop16m to subtract quad bytes we use this in U8 this
- then so the offsets need to be renormalized to 8bits.
+  1) use the bytop16m to subtract quad bytes we use this in U8 this
+   then so the offsets need to be renormalized to 8bits.
 
-2) Scale operands up by a factor of 4 not 8 because Blackfin
-   multiplies include a shift.
+  2) scale operands up by a factor of 4 not 8 because Blackfin
+     multiplies include a shift.
 
-3) Compute into the accumulators cy*yx0, cy*yx1.
+  3) compute into the accumulators cy*yx0, cy*yx1
 
-4) Compute each of the linear equations:
-     r = clipz((y - oy) * cy  + crv * (v - 128))
+  4) compute each of the linear equations
+      r = clipz((y-oy)*cy  + crv*(v-128))
 
-     g = clipz((y - oy) * cy  + cgv * (v - 128) + cgu * (u - 128))
+      g = clipz((y-oy)*cy  + cgv*(v-128) + cgu*(u-128))
 
-     b = clipz((y - oy) * cy  + cbu * (u - 128))
+      b = clipz((y-oy)*cy  + cbu*(u-128))
 
-   Reuse of the accumulators requires that we actually multiply
-   twice once with addition and the second time with a subtraction.
+     reuse of the accumulators requires that we actually multiply
+     twice once with addition and the second time with a subtaction.
 
-   Because of this we need to compute the equations in the order R B
-   then G saving the writes for B in the case of 24/32 bit color
-   formats.
+     because of this we need to compute the equations in the order R B
+     then G saving the writes for B in the case of 24/32 bit color
+     formats.
 
-   API: yuv2rgb_kind (uint8_t *Y, uint8_t *U, uint8_t *V, int *out,
-                      int dW, uint32_t *coeffs);
+    api: yuv2rgb_kind (uint8_t *Y, uint8_t *U, uint8_t *V, int *out,
+                       int dW, uint32_t *coeffs);
 
-       A          B
-       ---        ---
-       i2 = cb    i3 = cr
-       i1 = coeff i0 = y
+        A          B
+        ---        ---
+        i2 = cb    i3 = cr
+        i1 = coeff i0 = y
 
-Where coeffs have the following layout in memory.
+  Where coeffs have the following layout in memory.
 
-uint32_t oy,oc,zero,cy,crv,rmask,cbu,bmask,cgu,cgv;
+  uint32_t oy,oc,zero,cy,crv,rmask,cbu,bmask,cgu,cgv;
 
-coeffs is a pointer to oy.
+  coeffs is a pointer to oy.
 
-The {rgb} masks are only utilized by the 565 packing algorithm. Note the data
-replication is used to simplify the internal algorithms for the dual Mac
-architecture of BlackFin.
+  the {rgb} masks are only utilized by the 565 packing algorithm. Note the data
+  replication is used to simplify the internal algorithms for the dual mac architecture
+  of BlackFin.
 
-All routines are exported with _ff_bfin_ as a symbol prefix.
+  All routines are exported with _ff_bfin_ as a symbol prefix
 
-Rough performance gain compared against -O3:
+  rough performance gain compared against -O3:
 
-2779809/1484290 187.28%
+  2779809/1484290 187.28%
 
-which translates to ~33c/pel to ~57c/pel for the reference vs 17.5
-c/pel for the optimized implementations. Not sure why there is such a
-huge variation on the reference codes on Blackfin I guess it must have
-to do with the memory system.

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list