changeset 33560:16cf555989a9

Add support for converting to interleaved 3D in vf_stereo3d. Patch by Steaphan Greene [sgreene cs.binghamton.edu]
author reimar
date Sun, 19 Jun 2011 08:33:57 +0000
parents 0d4edb3f75c6
children 1ff6737f2177
files DOCS/man/en/mplayer.1 libmpcodecs/vf_stereo3d.c
diffstat 2 files changed, 41 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/man/en/mplayer.1	Sat Jun 18 21:08:29 2011 +0000
+++ b/DOCS/man/en/mplayer.1	Sun Jun 19 08:33:57 2011 +0000
@@ -7907,6 +7907,14 @@
 anaglyph yellow/blue colored (yellow filter on left eye, blue filter on right
 eye)
 .RE
+.B irl or interleave_rows_left_first
+.RS
+Interleaved rows (left eye has top row, right eye starts on next row)
+.RE
+.B irr or interleave_rows_right_first
+.RS
+Interleaved rows (right eye has top row, left eye starts on next row)
+.RE
 .B ml or mono_left
 .RS
 mono output (left eye only)
@@ -7916,6 +7924,13 @@
 mono output (right eye only)
 .RE
 .RE
+.I NOTE:
+To use either of the interleaved-rows output formats to display
+full-screen on a row-interleaved 3D display, you will need to scale the
+video to the correct size first using the "scale" filter, if it's not
+already the right size.  Typically, that is 1920x1080 stereo (so use
+e.g. "-vf scale=3840x1080,stereo3d=irl" for side-by-side encoded
+movies, for example).
 .RE
 .PD 1
 .
--- a/libmpcodecs/vf_stereo3d.c	Sat Jun 18 21:08:29 2011 +0000
+++ b/libmpcodecs/vf_stereo3d.c	Sun Jun 19 08:33:57 2011 +0000
@@ -56,6 +56,8 @@
     ABOVE_BELOW_RL,     //above-below (right eye above, left eye below)
     ABOVE_BELOW_2_LR,   //above-below with half height resolution
     ABOVE_BELOW_2_RL,   //above-below with half height resolution
+    INTERLEAVE_ROWS_LR, //row-interleave (left eye has top row)
+    INTERLEAVE_ROWS_RL, //row-interleave (right eye has top row)
     STEREO_CODE_COUNT   //no value set - TODO: needs autodetection
 } stereo_code;
 
@@ -109,6 +111,7 @@
     int ana_matrix[3][6];
     unsigned int width;
     unsigned int height;
+    unsigned int row_step;
 } const vf_priv_default = {
   {SIDE_BY_SIDE_LR},
   {ANAGLYPH_RC_DUBOIS}
@@ -135,6 +138,7 @@
     //default input values
     vf->priv->width             = width;
     vf->priv->height            = height;
+    vf->priv->row_step          = 1;
     vf->priv->in.width          = width;
     vf->priv->in.height         = height;
     vf->priv->in.off_left       = 0;
@@ -213,6 +217,18 @@
         vf->priv->out.height    = vf->priv->height * 2;
         vf->priv->out.row_left  = vf->priv->height;
         break;
+    case INTERLEAVE_ROWS_LR:
+        vf->priv->row_step      = 2;
+        vf->priv->height        = vf->priv->height / 2;
+        vf->priv->out.off_right = vf->priv->width * 3;
+        vf->priv->in.off_right += vf->priv->in.width * 3;
+        break;
+    case INTERLEAVE_ROWS_RL:
+        vf->priv->row_step      = 2;
+        vf->priv->height        = vf->priv->height / 2;
+        vf->priv->out.off_left  = vf->priv->width * 3;
+        vf->priv->in.off_left  += vf->priv->in.width * 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;
@@ -262,18 +278,20 @@
         case ABOVE_BELOW_RL:
         case ABOVE_BELOW_2_LR:
         case ABOVE_BELOW_2_RL:
+        case INTERLEAVE_ROWS_LR:
+        case INTERLEAVE_ROWS_RL:
             memcpy_pic(dmpi->planes[0] + out_off_left,
                        mpi->planes[0] + in_off_left,
                        3 * vf->priv->width,
                        vf->priv->height,
-                       dmpi->stride[0],
-                       mpi->stride[0]);
+                       dmpi->stride[0] * vf->priv->row_step,
+                       mpi->stride[0] * vf->priv->row_step);
             memcpy_pic(dmpi->planes[0] + out_off_right,
                        mpi->planes[0] + in_off_right,
                        3 * vf->priv->width,
                        vf->priv->height,
-                       dmpi->stride[0],
-                       mpi->stride[0]);
+                       dmpi->stride[0] * vf->priv->row_step,
+                       mpi->stride[0] * vf->priv->row_step);
             break;
         case MONO_L:
         case MONO_R:
@@ -395,6 +413,10 @@
     {"above_below_half_height_left_first", ABOVE_BELOW_2_LR},
     {"ab2r",                               ABOVE_BELOW_2_RL},
     {"above_below_half_height_right_first",ABOVE_BELOW_2_RL},
+    {"irl",                                INTERLEAVE_ROWS_LR},
+    {"interleave_rows_left_first",         INTERLEAVE_ROWS_LR},
+    {"irr",                                INTERLEAVE_ROWS_RL},
+    {"interleave_rows_right_first",        INTERLEAVE_ROWS_RL},
     { NULL, 0}
 };