[FFmpeg-devel] Colorspace conversion patch causing strange build error

Umar Qureshey umar at janteq.com
Tue Jul 9 23:43:56 CEST 2013


Hi,
I am working on adding colorspace conversion using hardware in the freescale i.MX6 SoCs.  As a preliminary, I have made the following very minor changes in ffmpeg/libswscale:

diff -Naur -x '*.orig' ./libswscale-pristine/arm/Makefile ./libswscale-umar/arm/Makefile
--- ./libswscale-pristine/arm/Makefile	1969-12-31 16:00:00.000000000 -0800
+++ ./libswscale-umar/arm/Makefile	2013-07-09 08:26:00.000000000 -0700
@@ -0,0 +1 @@
+OBJS += arm/yuv2rgb_imx6.o                                         \
diff -Naur -x '*.orig' ./libswscale-pristine/arm/yuv2rgb_imx6.c ./libswscale-umar/arm/yuv2rgb_imx6.c
--- ./libswscale-pristine/arm/yuv2rgb_imx6.c	1969-12-31 16:00:00.000000000 -0800
+++ ./libswscale-umar/arm/yuv2rgb_imx6.c	2013-07-09 12:09:05.422036513 -0700
@@ -0,0 +1,40 @@
+#include <inttypes.h>
+#include <stdlib.h>
+
+#include "libavutil/attributes.h"
+#include "libswscale/swscale.h"
+#include "libswscale/swscale_internal.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+static int imx6_yuv420_to_rgb565le(SwsContext *c, uint8_t *src[], int srcStride[],
+                           int srcSliceY, int srcSliceH,
+                           uint8_t *dst[], int dstStride[])
+{
+    /* IPU magic goes here. */
+    
+    return srcSliceH;
+}
+
+
+
+av_cold SwsFunc ff_yuv2rgb_get_func_ptr_arm_imx6(SwsContext *c)
+{
+    //Open the Image Processing Unit.
+    c->fd_ipu = open("/dev/mxc_ipu", O_RDWR, 0);
+    if (c->fd_ipu < 0) 
+    {
+            av_log(c, AV_LOG_ERROR, "open ipu dev fail\n");
+            return 0;
+    }
+
+    if ((c->srcFormat == AV_PIX_FMT_YUV420P) && (c->dstFormat == AV_PIX_FMT_RGB565LE))
+    {
+        av_log(c, AV_LOG_INFO,
+               "i.MX6 accelerated YUV420P -> RGB565LE\n");
+        return imx6_yuv420_to_rgb565le;
+    }
+    return 0;
+}
diff -Naur -x '*.orig' ./libswscale-pristine/swscale_internal.h ./libswscale-umar/swscale_internal.h
--- ./libswscale-pristine/swscale_internal.h	2013-07-09 11:31:17.000000000 -0700
+++ ./libswscale-umar/swscale_internal.h	2013-07-09 09:52:47.000000000 -0700
@@ -59,6 +59,11 @@
 #   define APCK_SIZE 16
 #endif
 
+//UQ 7/9/13  i.MX6 support
+#ifdef ARCH_ARM
+#include <linux/ipu.h>
+#endif
+
 struct SwsContext;
 
 typedef int (*SwsFunc)(struct SwsContext *context, const uint8_t *src[],
@@ -474,6 +479,11 @@
     DECLARE_ALIGNED(8, uint64_t, sparc_coeffs)[10];
 #endif
     int use_mmx_vfilter;
+//UQ 7/9/13  ARM but it's i.MX6 only stuff
+#if ARCH_ARM
+    int fd_ipu;
+    struct ipu_task task;
+#endif
 
 /* pre defined color-spaces gamma */
 #define XYZ_GAMMA (2.6f)
@@ -604,6 +614,8 @@
 SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c);
 SwsFunc ff_yuv2rgb_get_func_ptr_bfin(SwsContext *c);
 void ff_bfin_get_unscaled_swscale(SwsContext *c);
+/* UQ 7/3/13  Added for imx6. */
+SwsFunc ff_yuv2rgb_get_func_ptr_arm_imx6(SwsContext *c);
 
 #if FF_API_SWS_FORMAT_NAME
 /**
diff -Naur -x '*.orig' ./libswscale-pristine/yuv2rgb.c ./libswscale-umar/yuv2rgb.c
--- ./libswscale-pristine/yuv2rgb.c	2013-07-09 11:31:17.000000000 -0700
+++ ./libswscale-umar/yuv2rgb.c	2013-07-03 12:09:48.000000000 -0700
@@ -616,6 +616,9 @@
         t = ff_yuv2rgb_init_altivec(c);
     else if (ARCH_BFIN)
         t = ff_yuv2rgb_get_func_ptr_bfin(c);
+    /* UQ 7/3/13  Adding Freescale i.MX6 IPU support for colorspace conversion. */
+    else if (ARCH_ARM)  //TODO: change this to platform like ARM_IMX6
+        t = ff_yuv2rgb_get_func_ptr_arm_imx6(c);
 
     if (t)
         return t;


However, this gives me a strange error:
make -C ffmpeg libpostproc/libpostproc.a
make[1]: Entering directory `/mnt/veriton/umar/umar_stuff/MPlayer-latest-svn/mplayer/ffmpeg'
make[1]: Leaving directory `/mnt/veriton/umar/umar_stuff/MPlayer-latest-svn/mplayer/ffmpeg'
make -C ffmpeg libavfilter/libavfilter.a
make[1]: Entering directory `/mnt/veriton/umar/umar_stuff/MPlayer-latest-svn/mplayer/ffmpeg'
make[1]: Leaving directory `/mnt/veriton/umar/umar_stuff/MPlayer-latest-svn/mplayer/ffmpeg'
make -C ffmpeg libavformat/libavformat.a
make[1]: Entering directory `/mnt/veriton/umar/umar_stuff/MPlayer-latest-svn/mplayer/ffmpeg'
make[1]: Leaving directory `/mnt/veriton/umar/umar_stuff/MPlayer-latest-svn/mplayer/ffmpeg'
make -C ffmpeg libavcodec/libavcodec.a
make[1]: Entering directory `/mnt/veriton/umar/umar_stuff/MPlayer-latest-svn/mplayer/ffmpeg'
make[1]: Leaving directory `/mnt/veriton/umar/umar_stuff/MPlayer-latest-svn/mplayer/ffmpeg'
make -C ffmpeg libswscale/libswscale.a
make[1]: Entering directory `/mnt/veriton/umar/umar_stuff/MPlayer-latest-svn/mplayer/ffmpeg'
CC	libswscale/input.o
libswscale/input.c: In function 'rgb16_32ToY_c_template':
libswscale/input.c:267:1: error: expected identifier before 'unsigned'
libswscale/input.c: In function 'rgb16_32ToUV_c_template':
libswscale/input.c:294:1: error: expected identifier before 'unsigned'
libswscale/input.c: In function 'rgb16_32ToUV_half_c_template':
libswscale/input.c:326:1: error: expected identifier before 'unsigned'
libswscale/input.c:327:1: error: expected identifier before 'unsigned'
make[1]: *** [libswscale/input.o] Error 1
make[1]: Leaving directory `/mnt/veriton/umar/umar_stuff/MPlayer-latest-svn/mplayer/ffmpeg'
make: *** [ffmpeg/libswscale/libswscale.a] Error 2

I have looked at the offending lines of code and I don't see any issues.  My guess is that something having to do with the variadic defines in input.c  is screwing things up.  

Any help appreciated.
Thanks.



More information about the ffmpeg-devel mailing list