[MPlayer-dev-eng] [PATCH] view stereoscopic videos

Gordon Schmidt gordon.schmidt at s2000.tu-chemnitz.de
Mon Feb 1 17:19:21 CET 2010


Hi,

an optimized red/cyan filter has been added, which should produce less  
ghosting effects. It's from this paper (page 4):
http://research.csc.ncsu.edu/stereographics/ei03.pdf
I had to adjust the last line of the matrix a little bit, because it  
wouldn't sum up to 1 (or to 1024 in my case).

I've also adjusted the coding style. Hopefully there are no mistakes  
left this time.

On Fri, Jan 29, 2010 at 07:46:18PM +0100, Torsten Mohr wrote:
> it is awesome that you wrote 3D support for MPlayer.
>
> Actually, 3D was the reason why i joined this mailing list.  I have  
> a Hyundai W220S that can output 3D.  Each line has a different  
> polarisation so with polarisation glasses you can see the odd lines  
> with the left eye and the even lines with the right eye (or vice  
> versa, don't remember).
> I wrote a 3D still image viewer for it (and anaglyph still images),  
> it is located at:
>
> http://sourceforge.net/projects/zyk/
Nice image viewer. I will have a look at your anaglyph filters, when i  
find the time to it.

> Do you see a way of supporting monitors like these?
I could add an interlaced output, but you wouldn't be able to scale  
afterwards.
So please use the method Reimar Döffinger suggested instead.


Regards
Gordon
-------------- next part --------------
Index: libmpcodecs/vf_stereo3d.c
===================================================================
--- libmpcodecs/vf_stereo3d.c	(revision 0)
+++ libmpcodecs/vf_stereo3d.c	(revision 0)
@@ -0,0 +1,460 @@
+/*
+ * Copyright (C) 2010 Gordon Schmidt <gordon.schmidt at s2000.tu-chemnitz.de>
+ *
+ * This file is part of MPlayer.
+ *
+ * MPlayer 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.
+ *
+ * MPlayer 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+//==includes==//
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "config.h"
+#include "mp_msg.h"
+#include "help_mp.h"
+
+#include "img_format.h"
+#include "mp_image.h"
+#include "vf.h"
+
+#include "libavutil/common.h"
+#include "libvo/fastmemcpy.h"
+
+//==macros==//
+#define ANA_R(RL,GL,BL,RR,GR,BR)    (av_clip_uint8(((vf->priv->ana_matrix[0]  * RL \
+                   + vf->priv->ana_matrix[1]  * GL + vf->priv->ana_matrix[2]  * BL \
+                   + vf->priv->ana_matrix[3]  * RR + vf->priv->ana_matrix[4]  * GR \
+                   + vf->priv->ana_matrix[5]  * BR) >> 10)))
+
+#define ANA_G(RL,GL,BL,RR,GR,BR)    (av_clip_uint8(((vf->priv->ana_matrix[6]  * RL \
+                   + vf->priv->ana_matrix[7]  * GL + vf->priv->ana_matrix[8]  * BL \
+                   + vf->priv->ana_matrix[9]  * RR + vf->priv->ana_matrix[10] * GR \
+                   + vf->priv->ana_matrix[11] * BR) >> 10)))
+
+#define ANA_B(RL,GL,BL,RR,GR,BR)    (av_clip_uint8(((vf->priv->ana_matrix[12] * RL \
+                   + vf->priv->ana_matrix[13] * GL + vf->priv->ana_matrix[14] * BL \
+                   + vf->priv->ana_matrix[15] * RR + vf->priv->ana_matrix[16] * GR \
+                   + vf->priv->ana_matrix[17] * BR) >> 10)))
+
+//==types==//
+typedef enum stereo_code {
+    NOT_SET,            //no value set - TODO: needs autodetection
+    SIDE_BY_SIDE_LR,    //side by side parallel (left eye left, right eye right)
+    SIDE_BY_SIDE_RL,    //side by side crosseye (right eye left, left eye right)
+    ABOVE_BELOW_LR,     //above-below (left eye above, right eye below)
+    ABOVE_BELOW_RL,     //above-below (right eye above, left eye below)
+    ABOVE_BELOW_2_LR,   //above-below with half height resolution (left eye above, right eye below)
+    ABOVE_BELOW_2_RL,   //above-below with half height resolution (right eye above, left eye below)
+    ANAGLYPH_DUBOIS_RC, //color anaglyph red/cyan optimized with the least squares projection of dubois (red filter on left eye, cyan filter on right eye)
+    ANAGLYPH_COLOR_RC,  //color anaglyph red/cyan (red filter on left eye, cyan filter on right eye)
+    ANAGLYPH_HALF_RC,   //half color anaglyph red/cyan (red filter on left eye, cyan filter on right eye)
+    ANAGLYPH_GRAY_RC,   //gray anaglyph red/cyan (red filter on left eye, cyan filter on right eye)
+    ANAGLYPH_COLOR_GM,  //color anaglyph green/magenta (green filter on left eye, magenta filter on right eye)
+    ANAGLYPH_HALF_GM,   //half color anaglyph green/magenta (green filter on left eye, magenta filter on right eye)
+    ANAGLYPH_GRAY_GM,   //gray anaglyph green/magenta (green filter on left eye, magenta filter on right eye)
+    ANAGLYPH_COLOR_YB,  //color anaglyph yellow/blue (yellow filter on left eye, blue filter on right eye)
+    ANAGLYPH_HALF_YB,   //half color anaglyph yellow/blue (yellow filter on left eye, blue filter on right eye)
+    ANAGLYPH_GRAY_YB,   //gray anaglyph yellow/blue (yellow filter on left eye, blue filter on right eye)
+    MONO_L,             //mono output for debugging (left eye only)
+    MONO_R              //mono output for debugging (right eye only)
+} stereo_code;
+
+typedef struct component {
+    unsigned int width;
+    unsigned int height;
+    unsigned int off_left;
+    unsigned int off_right;
+    unsigned int stride;
+    unsigned int hres;
+    stereo_code  fmt;
+} component;
+
+//==global variables==//
+struct vf_priv_s {
+    int ana_matrix[18];
+    unsigned int width;
+    unsigned int height;
+    component in;
+    component out;
+};
+
+extern int opt_screen_size_x;
+extern int opt_screen_size_y;
+
+//==functions==//
+static int config(struct vf_instance_s *vf, int width, int height, int d_width,
+                  int d_height, unsigned int flags, unsigned int outfmt)
+{
+    if ((0 != width % 4) && (0 != height % 4)) {
+        mp_msg(MSGT_VFILTER, MSGL_WARN, "[stereo3d] invalid height or width\n");
+        return 0;
+    }
+    //default input values
+    vf->priv->width             = width;
+    vf->priv->height            = height;
+    vf->priv->in.width          = width;
+    vf->priv->in.height         = height;
+    vf->priv->in.hres           = 1;
+    vf->priv->in.off_left       = 0;
+    vf->priv->in.off_right      = 0;
+    vf->priv->in.stride         = vf->priv->width * 3;
+
+    //check input format
+    switch (vf->priv->in.fmt) {
+    case SIDE_BY_SIDE_LR:
+        vf->priv->width             = width / 2;
+        vf->priv->in.off_right      = vf->priv->width * 3;
+        vf->priv->in.stride         = vf->priv->width * 6;
+        break;
+    case SIDE_BY_SIDE_RL:
+        vf->priv->width             = width / 2;
+        vf->priv->in.off_left       = vf->priv->width * 3;
+        vf->priv->in.stride         = vf->priv->width * 6;
+        break;
+    case ABOVE_BELOW_LR:
+        vf->priv->height            = height / 2;
+        vf->priv->in.off_right      = vf->priv->width * vf->priv->height * 3;
+        break;
+    case ABOVE_BELOW_RL:
+        vf->priv->height            = height / 2;
+        vf->priv->in.off_left       = vf->priv->width * vf->priv->height * 3;
+        break;
+    case ABOVE_BELOW_2_LR:
+        vf->priv->in.hres           = 2;
+        vf->priv->in.off_right      = vf->priv->width * vf->priv->height / 2 * 3;
+        break;
+    case ABOVE_BELOW_2_RL:
+        vf->priv->in.hres           = 2;
+        vf->priv->in.off_left       = vf->priv->width * vf->priv->height / 2 * 3;
+        break;
+    default:
+        mp_msg(MSGT_VFILTER, MSGL_WARN, "[stereo3d] stereo format of input is not supported\n");
+        return 0;
+        break;
+    }
+    //default output values
+    vf->priv->out.width         = vf->priv->width;
+    vf->priv->out.height        = vf->priv->height;
+    vf->priv->out.hres          = 1;
+    vf->priv->out.off_left      = 0;
+    vf->priv->out.off_right     = 0;
+    vf->priv->out.stride        = vf->priv->width * 3;
+
+    //check output format
+    switch (vf->priv->out.fmt) {
+    case SIDE_BY_SIDE_LR:
+        vf->priv->out.width         = vf->priv->width * 2;
+        vf->priv->out.off_right     = vf->priv->width * 3;
+        vf->priv->out.stride        = vf->priv->width * 6;
+        break;
+    case SIDE_BY_SIDE_RL:
+        vf->priv->out.width         = vf->priv->width * 2;
+        vf->priv->out.off_left      = vf->priv->width * 3;
+        vf->priv->out.stride        = vf->priv->width * 6;
+        break;
+    case ABOVE_BELOW_LR:
+        vf->priv->out.height        = vf->priv->height * 2;
+        vf->priv->out.off_right     = vf->priv->width * vf->priv->height * 3;
+        break;
+    case ABOVE_BELOW_RL:
+        vf->priv->out.height        = vf->priv->height * 2;
+        vf->priv->out.off_left      = vf->priv->width * vf->priv->height * 3;
+        break;
+    case ABOVE_BELOW_2_LR:
+        vf->priv->out.hres          = 2;
+        vf->priv->out.off_right     = vf->priv->width * vf->priv->height / 2 * 3;
+        break;
+    case ABOVE_BELOW_2_RL:
+        vf->priv->out.hres          = 2;
+        vf->priv->out.off_left      = vf->priv->width * vf->priv->height / 2 * 3;
+        break;
+    case MONO_R:
+        //same as MONO_L only needs switching of input offsets 
+        vf->priv->in.off_left       = vf->priv->in.off_right;
+        //nobreak;
+    case MONO_L:
+        //use default settings
+        break;
+    case ANAGLYPH_COLOR_RC:
+        vf->priv->ana_matrix[0]     = 1024;
+        vf->priv->ana_matrix[10]    = 1024;
+        vf->priv->ana_matrix[17]    = 1024;
+        break;
+    case ANAGLYPH_HALF_RC:
+        vf->priv->ana_matrix[0]     = 306;
+        vf->priv->ana_matrix[1]     = 601;
+        vf->priv->ana_matrix[2]     = 117;
+        vf->priv->ana_matrix[10]    = 1024;
+        vf->priv->ana_matrix[17]    = 1024;
+        break;
+    case ANAGLYPH_GRAY_RC:
+        vf->priv->ana_matrix[0]     = 306;
+        vf->priv->ana_matrix[1]     = 601;
+        vf->priv->ana_matrix[2]     = 117;
+        vf->priv->ana_matrix[9]     = 306;
+        vf->priv->ana_matrix[10]    = 601;
+        vf->priv->ana_matrix[11]    = 117;
+        vf->priv->ana_matrix[15]    = 306;
+        vf->priv->ana_matrix[16]    = 601;
+        vf->priv->ana_matrix[17]    = 117;
+        break;
+    case ANAGLYPH_DUBOIS_RC:
+        vf->priv->ana_matrix[0]     =  467;
+        vf->priv->ana_matrix[1]     =  513;
+        vf->priv->ana_matrix[2]     =  181;
+        vf->priv->ana_matrix[3]     =  -45;
+        vf->priv->ana_matrix[4]     =  -90;
+        vf->priv->ana_matrix[5]     =   -2;
+        vf->priv->ana_matrix[6]     =  -41;
+        vf->priv->ana_matrix[7]     =  -39;
+        vf->priv->ana_matrix[8]     =  -16;
+        vf->priv->ana_matrix[9]     =  388;
+        vf->priv->ana_matrix[10]    =  751;
+        vf->priv->ana_matrix[11]    =  -19;
+        vf->priv->ana_matrix[12]    =  -15;
+        vf->priv->ana_matrix[13]    =  -21;
+        vf->priv->ana_matrix[14]    =   -6;
+        vf->priv->ana_matrix[15]    =  -74;
+        vf->priv->ana_matrix[16]    = -116;
+        vf->priv->ana_matrix[17]    = 1256;
+        break;
+    case ANAGLYPH_COLOR_GM:
+        vf->priv->ana_matrix[3]     = 1024;
+        vf->priv->ana_matrix[7]     = 1024;
+        vf->priv->ana_matrix[17]    = 1024;
+        break;
+    case ANAGLYPH_HALF_GM:
+        vf->priv->ana_matrix[3]     = 1024;
+        vf->priv->ana_matrix[6]     = 306;
+        vf->priv->ana_matrix[7]     = 601;
+        vf->priv->ana_matrix[8]     = 117;
+        vf->priv->ana_matrix[17]    = 1024;
+        break;
+    case ANAGLYPH_GRAY_GM:
+        vf->priv->ana_matrix[3]     = 306;
+        vf->priv->ana_matrix[4]     = 601;
+        vf->priv->ana_matrix[5]     = 117;
+        vf->priv->ana_matrix[6]     = 306;
+        vf->priv->ana_matrix[7]     = 601;
+        vf->priv->ana_matrix[8]     = 117;
+        vf->priv->ana_matrix[15]    = 306;
+        vf->priv->ana_matrix[16]    = 601;
+        vf->priv->ana_matrix[17]    = 117;
+        break;
+    case ANAGLYPH_COLOR_YB:
+        vf->priv->ana_matrix[3]     = 1024;
+        vf->priv->ana_matrix[10]    = 1024;
+        vf->priv->ana_matrix[14]    = 1024;
+        break;
+    case ANAGLYPH_HALF_YB:
+        vf->priv->ana_matrix[3]     = 1024;
+        vf->priv->ana_matrix[10]    = 1024;
+        vf->priv->ana_matrix[12]    = 306;
+        vf->priv->ana_matrix[13]    = 601;
+        vf->priv->ana_matrix[14]    = 117;
+        break;
+    case ANAGLYPH_GRAY_YB:
+        vf->priv->ana_matrix[3]     = 306;
+        vf->priv->ana_matrix[4]     = 601;
+        vf->priv->ana_matrix[5]     = 117;
+        vf->priv->ana_matrix[9]     = 306;
+        vf->priv->ana_matrix[10]    = 601;
+        vf->priv->ana_matrix[11]    = 117;
+        vf->priv->ana_matrix[12]    = 306;
+        vf->priv->ana_matrix[13]    = 601;
+        vf->priv->ana_matrix[14]    = 117;
+        break;
+    default:
+        mp_msg(MSGT_VFILTER, MSGL_WARN, "[stereo3d] stereo format of output is not supported\n");
+        return 0;
+        break;
+    }
+    if (!opt_screen_size_x && !opt_screen_size_y) {
+        d_width     = d_width  * vf->priv->out.width  / width;
+        d_height    = d_height * vf->priv->out.height / height;
+    }
+    return vf_next_config(vf, vf->priv->out.width, vf->priv->out.height, d_width, d_height, flags, outfmt);
+}
+
+static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts)
+{
+    mp_image_t *dmpi;
+    if (vf->priv->in.fmt == vf->priv->out.fmt) { //nothing to do
+        dmpi = mpi; 
+    } else {
+        dmpi = vf_get_image(vf->next, IMGFMT_RGB24, MP_IMGTYPE_TEMP, 0, vf->priv->out.width, vf->priv->out.height);
+        dmpi->h = vf->priv->out.height;
+        dmpi->width = vf->priv->out.width;
+        switch (vf->priv->out.fmt) {
+        case SIDE_BY_SIDE_LR:
+        case SIDE_BY_SIDE_RL:
+        case ABOVE_BELOW_LR:
+        case ABOVE_BELOW_RL:
+        case ABOVE_BELOW_2_LR:
+        case ABOVE_BELOW_2_RL:
+            for (int i = 0; i < vf->priv->in.hres; i++)
+            {
+                memcpy_pic(dmpi->planes[0] + vf->priv->out.off_left + (i * vf->priv->out.stride),  mpi->planes[0] + vf->priv->in.off_left,  3 * vf->priv->width, vf->priv->height / (vf->priv->in.hres * vf->priv->out.hres), vf->priv->out.stride * vf->priv->in.hres, vf->priv->in.stride * vf->priv->out.hres);
+                memcpy_pic(dmpi->planes[0] + vf->priv->out.off_right + (i * vf->priv->out.stride), mpi->planes[0] + vf->priv->in.off_right, 3 * vf->priv->width, vf->priv->height / (vf->priv->in.hres * vf->priv->out.hres), vf->priv->out.stride * vf->priv->in.hres, vf->priv->in.stride * vf->priv->out.hres);
+            }
+            break;
+        case MONO_L:
+        case MONO_R:
+            for (int i = 0; i < vf->priv->in.hres; i++)
+            {
+                memcpy_pic(dmpi->planes[0] + (i * vf->priv->out.stride), mpi->planes[0] + vf->priv->in.off_left,  3 * vf->priv->width, vf->priv->height / vf->priv->in.hres, vf->priv->out.stride * vf->priv->in.hres, vf->priv->in.stride);
+            }
+            break;
+        case ANAGLYPH_COLOR_RC:
+        case ANAGLYPH_HALF_RC:
+        case ANAGLYPH_GRAY_RC:
+        case ANAGLYPH_DUBOIS_RC:
+        case ANAGLYPH_COLOR_GM:
+        case ANAGLYPH_HALF_GM:
+        case ANAGLYPH_GRAY_GM:
+        case ANAGLYPH_COLOR_YB:
+        case ANAGLYPH_HALF_YB:
+        case ANAGLYPH_GRAY_YB: {
+            int x,y,rl,gl,bl,rr,gr,br,il,ir,o;
+            for (y = 0; y < vf->priv->out.height; y++) {
+                o   = vf->priv->out.stride * y;
+                il  = vf->priv->in.off_left  + (y / vf->priv->in.hres) * vf->priv->in.stride;
+                ir  = vf->priv->in.off_right + (y / vf->priv->in.hres) * vf->priv->in.stride;
+                for (x = 0; x < vf->priv->out.width; x++) {
+                    rl  = mpi->planes[0][il    ];
+                    gl  = mpi->planes[0][il + 1];
+                    bl  = mpi->planes[0][il + 2];
+                    rr  = mpi->planes[0][ir    ];
+                    gr  = mpi->planes[0][ir + 1];
+                    br  = mpi->planes[0][ir + 2];
+                    dmpi->planes[0][o    ]  = ANA_R(rl, gl, bl, rr, gr, br);
+                    dmpi->planes[0][o + 1]  = ANA_G(rl, gl, bl, rr, gr, br);
+                    dmpi->planes[0][o + 2]  = ANA_B(rl, gl, bl, rr, gr, br);
+                    il  += 3;
+                    ir  += 3;
+                    o   += 3;
+                }
+            }
+            break;
+        }
+        default:
+            mp_msg(MSGT_VFILTER, MSGL_WARN, "[stereo3d] stereo format of output is not supported\n");
+            return 0;
+            break;
+        }
+    }
+    return vf_next_put_image(vf, dmpi, pts);
+}
+
+static int query_format(struct vf_instance_s *vf, unsigned int fmt)
+{
+    switch (fmt)
+    case IMGFMT_RGB24:
+        return vf_next_query_format(vf, fmt);
+    return 0;
+}
+
+static stereo_code get_arg(char *arg)
+{
+    stereo_code return_value = NOT_SET;
+    if (arg) {
+        if ((0 == strcmp( arg, "sbsl")) || (0 == strcmp(arg, "side_by_side_left_first"))) {
+            return_value = SIDE_BY_SIDE_LR;
+        } else if((0 == strcmp(arg, "sbsr")) || (0 == strcmp(arg, "side_by_side_right_first"))) {
+            return_value = SIDE_BY_SIDE_RL;
+        } else if((0 == strcmp(arg, "abl")) || (0 == strcmp(arg, "above_below_left_first"))) {
+            return_value = ABOVE_BELOW_LR;
+        } else if((0 == strcmp(arg, "abr")) || (0 == strcmp(arg, "above_below_right_first"))) {
+            return_value = ABOVE_BELOW_RL;
+        } else if((0 == strcmp(arg, "ab2l")) || (0 == strcmp(arg, "above_below_half_height_left_first"))) {
+            return_value = ABOVE_BELOW_2_LR;
+        } else if((0 == strcmp(arg, "ab2r")) || (0 == strcmp(arg, "above_below_half_height_right_first"))) {
+            return_value = ABOVE_BELOW_2_RL;
+        } else if((0 == strcmp(arg, "acrc")) || (0 == strcmp(arg, "anaglyph_color_red_cyan"))) {
+            return_value = ANAGLYPH_COLOR_RC;
+        } else if((0 == strcmp(arg, "ahrc")) || (0 == strcmp(arg, "anaglyph_half_color_red_cyan"))) {
+            return_value = ANAGLYPH_HALF_RC;
+        } else if((0 == strcmp(arg, "agrc")) || (0 == strcmp(arg, "anaglyph_gray_red_cyan"))) {
+            return_value = ANAGLYPH_GRAY_RC;
+        } else if((0 == strcmp(arg, "adrc")) || (0 == strcmp(arg, "anaglyph_dubois_red_cyan"))) {
+            return_value = ANAGLYPH_DUBOIS_RC;
+        } else if((0 == strcmp(arg, "acgm")) || (0 == strcmp(arg, "anaglyph_color_green_magenta"))) {
+            return_value = ANAGLYPH_COLOR_GM;
+        } else if((0 == strcmp(arg, "ahgm")) || (0 == strcmp(arg, "anaglyph_half_color_green_magenta"))) {
+            return_value = ANAGLYPH_HALF_GM;
+        } else if((0 == strcmp(arg, "aggm")) || (0 == strcmp(arg, "anaglyph_gray_green_magenta"))) {
+            return_value = ANAGLYPH_GRAY_GM;
+        } else if((0 == strcmp(arg, "acyb")) || (0 == strcmp(arg, "anaglyph_color_yellow_blue"))) {
+            return_value = ANAGLYPH_COLOR_YB;
+        } else if((0 == strcmp(arg, "ahyb")) || (0 == strcmp(arg, "anaglyph_half_color_yellow_blue"))) {
+            return_value = ANAGLYPH_HALF_YB;
+        } else if((0 == strcmp(arg, "agyb")) || (0 == strcmp(arg, "anaglyph_gray_yellow_blue"))) {
+            return_value = ANAGLYPH_GRAY_YB;
+        } else if((0 == strcmp(arg, "ml")) || (0 == strcmp(arg, "mono_left"))) {
+            return_value = MONO_L;
+        } else if((0 == strcmp(arg, "mr")) || (0 == strcmp(arg, "mono_right"))) {
+            return_value = MONO_R;
+        }
+    }
+    return return_value;
+}
+
+static void uninit(struct vf_instance_s *vf)
+{
+    //uninit priv    
+    if (vf->priv)
+    {
+        free(vf->priv);
+    }
+}
+
+static int open(vf_instance_t *vf, char *args)
+{
+    //init priv
+    vf->priv = malloc(sizeof(struct vf_priv_s));
+    if (!vf->priv) {
+        return 0;
+    }
+    memset(&vf->priv->ana_matrix[0], 0, sizeof(vf->priv->ana_matrix));
+    vf->priv->in.fmt    = NOT_SET;
+    vf->priv->out.fmt   = NOT_SET;
+    vf->config          = config;
+    vf->uninit          = uninit;
+    vf->put_image       = put_image;
+  	vf->query_format    = query_format;
+    vf->default_reqs    = VFCAP_ACCEPT_STRIDE;
+    if (args) {
+        char *arg;
+        //input code
+        arg = strtok(args, ": \0\n");
+        vf->priv->in.fmt = get_arg(arg);
+        //output code
+        arg = strtok(NULL, ": \0\n");
+        vf->priv->out.fmt = get_arg(arg);
+    }
+    return 1;
+}
+
+//==info struct==//
+const vf_info_t vf_info_stereo3d = {
+    "stereoscopic 3d view",
+    "stereo3d",
+    "Gordon Schmidt",
+    "view stereoscopic videos",
+    open,
+    NULL
+};
Index: libmpcodecs/vf.c
===================================================================
--- libmpcodecs/vf.c	(revision 30481)
+++ libmpcodecs/vf.c	(working copy)
@@ -118,6 +118,7 @@
 extern const vf_info_t vf_info_blackframe;
 extern const vf_info_t vf_info_geq;
 extern const vf_info_t vf_info_ow;
+extern const vf_info_t vf_info_stereo3d;
 
 // list of available filters:
 static const vf_info_t* const filter_list[]={
@@ -211,6 +212,7 @@
     &vf_info_yadif,
     &vf_info_blackframe,
     &vf_info_ow,
+    &vf_info_stereo3d,
     NULL
 };
 
Index: Makefile
===================================================================
--- Makefile	(revision 30481)
+++ Makefile	(working copy)
@@ -453,6 +453,7 @@
               libmpcodecs/vf_smartblur.c \
               libmpcodecs/vf_softpulldown.c \
               libmpcodecs/vf_softskip.c \
+              libmpcodecs/vf_stereo3d.c \
               libmpcodecs/vf_swapuv.c \
               libmpcodecs/vf_telecine.c \
               libmpcodecs/vf_test.c \
Index: DOCS/man/en/mplayer.1
===================================================================
--- DOCS/man/en/mplayer.1	(revision 30481)
+++ DOCS/man/en/mplayer.1	(working copy)
@@ -7470,8 +7470,97 @@
 .IPs <threshold>
 Threshold below which a pixel value is considered black (default: 32).
 .RE
+.PD 1
 .
 .TP
+.B stereo3d[=in:out]
+Stereo3d converts between different stereoscopic image formats.
+.RSs
+.IPs <in>
+Stereoscopic image format of input. Possible values:
+.RS
+.B sbsl or side_by_side_left_first
+.RS
+side by side parallel (left eye left, right eye right)
+.RE
+.B sbsr or side_by_side_right_first
+.RS
+side by side crosseye (right eye left, left eye right)
+.RE
+.B abl or above_below_left_first
+.RS
+above-below (left eye above, right eye below)
+.RE
+.B abl or above_below_right_first
+.RS
+above-below (right eye above, left eye below)
+.RE
+.B ab2l or above_below_half_height_left_first
+.RS
+above-below with half height resolution (left eye above, right eye below)
+.RE
+.B ab2r or above_below_half_height_right_first
+.RS
+above-below with half height resolution (right eye above, left eye below)
+.RE
+.RE
+.IPs <out>
+Stereoscopic image format of output. Possible values are all the input formats
+as well as:
+.RS
+.B adrc or anaglyph_dubois_red_cyan
+.RS
+anaglyph color red/cyan optimized with the least squares projection of dubois (red filter on left eye, cyan filter on right eye)    
+.RE
+.B acrc or anaglyph_color_red_cyan
+.RS
+anaglyph color red/cyan (red filter on left eye, cyan filter on right eye)    
+.RE
+.B ahrc or anaglyph_half_color_red_cyan
+.RS
+anaglyph half color red/cyan (red filter on left eye, cyan filter on right eye)    
+.RE
+.B agrc or anaglyph_gray_red_cyan
+.RS
+anaglyph gray red/cyan (red filter on left eye, cyan filter on right eye)    
+.RE
+.B acgm or anaglyph_color_green_magenta
+.RS
+anaglyph color green/magenta (green filter on left eye, magenta filter on right eye)    
+.RE
+.B ahgm or anaglyph_half_color_green_magenta
+.RS
+anaglyph half color green/magenta (green filter on left eye, magenta filter on right eye)    
+.RE
+.B aggm or anaglyph_gray_green_magenta
+.RS
+anaglyph gray green/magenta (green filter on left eye, magenta filter on right eye)    
+.RE
+.B acyb or anaglyph_color_yellow_blue
+.RS
+anaglyph color yellow/blue (yellow filter on left eye, blue filter on right eye)    
+.RE
+.B ahyb or anaglyph_half_color_yellow_blue
+.RS
+anaglyph half color yellow/blue (yellow filter on left eye, blue filter on right eye)    
+.RE
+.B agyb or anaglyph_gray_yellow_blue
+.RS
+anaglyph gray yellow/blue (yellow filter on left eye, blue filter on right eye)    
+.RE
+.B ml or mono_left
+.RS
+mono output (left eye only)
+.RE
+.B mr or mono_right
+.RS
+mono output (right eye only)
+.RE
+.RE
+.RE
+.PD 1
+.
+.TP
 .B gradfun[=strength[:radius]]
 Fix the banding artifacts that are sometimes introduced into nearly flat
 regions by truncation to 8bit colordepth.
Index: DOCS/man/de/mplayer.1
===================================================================
--- DOCS/man/de/mplayer.1	(revision 30481)
+++ DOCS/man/de/mplayer.1	(working copy)
@@ -7543,9 +7543,96 @@
 Schwellenwert, unter dem ein Pixelwert als schwarz angenommen wird
 (Standard: 32).
 .RE
+.PD 1
 .
+.TP
+.B stereo3d[=in:out]
+Stereo3d wandelt zwischen verschiedenen stereoskopischen Bildformaten um.
+.RSs
+.IPs <in>
+Stereoskopisches Eingabeformat. Mögliche Werte:
+.RS
+.B sbsl oder side_by_side_left_first
+.RS
+nebeneinander parallel (linkes Auge links, rechtes Auge rechts)
+.RE
+.B sbsr oder side_by_side_right_first
+.RS
+nebeneinander gekreuzt (rechtes Auge links, linkes Auge rechts)
+.RE
+.B abl oder above_below_left_first
+.RS
+oben-unten (linkes Auge oben, rechtes Auge unten)
+.RE
+.B abl oder above_below_right_first
+.RS
+oben-unten (rechtes Auge oben, linkes Auge unten)
+.RE
+.B ab2l oder above_below_half_height_left_first
+.RS
+oben-unten mit halber Höhenauflösung (linkes Auge oben, rechtes Auge unten)
+.RE
+.B ab2r oder above_below_half_height_right_first
+.RS
+oben-unten mit halber Höhenauflösung (rechtes Auge oben, linkes Auge unten)
+.RE
+.RE
+.IPs <out>
+Stereoskopisches Ausgabeformat. Mögliche Werte sind alle Eingabeformate, sowie:
+.RS
+.B adrc oder anaglyph_dubios_red_cyan
+.RS
+anaglyph farbig red/cyan optimiert mit der Least-Squares-Projektion von Dubois (roter Filter auf dem linken Auge, cyan Filter auf dem rechten Auge)
+.RE
+.B acrc oder anaglyph_color_red_cyan
+.RS
+anaglyph farbig rot/cyan (roter Filter auf dem linken Auge, cyan Filter auf dem rechten Auge)
+.RE
+.B ahrc oder anaglyph_half_color_red_cyan
+.RS
+anaglyph halbfarbig rot/cyan (roter Filter auf dem linken Auge, cyan Filter auf dem rechten Auge)
+.RE
+.B agrc oder anaglyph_gray_red_cyan
+.RS
+anaglyph grau rot/cyan (roter Filter auf dem linken Auge, cyan Filter auf dem rechten Auge)    
+.RE
+.B acgm oder anaglyph_color_green_magenta
+.RS
+anaglyph farbig grün/magenta (grüner Filter auf dem linken Auge, magenta Filter auf dem rechten Auge)    
+.RE
+.B ahgm oder anaglyph_half_color_green_magenta
+.RS
+anaglyph halbfarbig grün/magenta (grüner Filter auf dem linken Auge, magenta Filter auf dem rechten Auge)    
+.RE
+.B aggm oder anaglyph_gray_green_magenta
+.RS
+anaglyph grau grüen/magenta (grüner Filter auf dem linken Auge, magenta Filter auf dem rechten Auge)    
+.RE
+.B acyb oder anaglyph_color_yellow_blue
+.RS
+anaglyph farbig gelb/blau (gelber Filter auf dem linken Auge, blauer Filter auf dem rechten Auge)    
+.RE
+.B ahyb oder anaglyph_half_color_yellow_blue
+.RS
+anaglyph halbfarbig gelb/blau (gelber Filter auf dem linken Auge, blauer Filter auf dem rechten Auge)
+.RE
+.B agyb oder anaglyph_gray_yellow_blue
+.RS
+anaglyph grau gelb/blau (gelber Filter auf dem linken Auge, blauer Filter auf dem rechten Auge)    
+.RE
+.B ml oder mono_left
+.RS
+mono Ausgabe (nur linkes Auge)
+.RE
+.B mr oder mono_right
+.RS
+mono Ausgabe (nur rechtes Auge)
+.RE
+.RE
+.RE
 .
 .
+.
 .SH "ALLGEMEINE ENCODING-OPTIONEN (NUR BEI MENCODER)"
 .
 .TP


More information about the MPlayer-dev-eng mailing list