[vlc-commits] Use the same algo for I420 and I422 way when deinterlacing using 'bob' mode .

Laurent Aimar git at videolan.org
Fri May 25 21:20:29 CEST 2012


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri May 25 16:43:46 2012 +0200| [c6a9a4c5306404ba7d854d84a7acb4b38c675b70] | committer: Laurent Aimar

Use the same algo for I420 and I422 way when deinterlacing using 'bob' mode.

The code used for I422 was a mix of bob (luma) and discard (chroma).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c6a9a4c5306404ba7d854d84a7acb4b38c675b70
---

 modules/video_filter/deinterlace/algo_basic.c  |  102 ++++++------------------
 modules/video_filter/deinterlace/algo_basic.h  |    4 +-
 modules/video_filter/deinterlace/deinterlace.c |    7 +-
 3 files changed, 28 insertions(+), 85 deletions(-)

diff --git a/modules/video_filter/deinterlace/algo_basic.c b/modules/video_filter/deinterlace/algo_basic.c
index 3dd9097..a66e043 100644
--- a/modules/video_filter/deinterlace/algo_basic.c
+++ b/modules/video_filter/deinterlace/algo_basic.c
@@ -72,8 +72,7 @@ void RenderDiscard( picture_t *p_outpic, picture_t *p_pic, int i_field )
  * RenderBob: renders a BOB picture - simple copy
  *****************************************************************************/
 
-void RenderBob( filter_t *p_filter,
-                picture_t *p_outpic, picture_t *p_pic, int i_field )
+void RenderBob( picture_t *p_outpic, picture_t *p_pic, int i_field )
 {
     int i_plane;
 
@@ -87,91 +86,36 @@ void RenderBob( filter_t *p_filter,
         p_out_end = p_out + p_outpic->p[i_plane].i_pitch
                              * p_outpic->p[i_plane].i_visible_lines;
 
-        switch( p_filter->fmt_in.video.i_chroma )
+        /* For BOTTOM field we need to add the first line */
+        if( i_field == 1 )
         {
-            case VLC_CODEC_I420:
-            case VLC_CODEC_J420:
-            case VLC_CODEC_YV12:
-                /* For BOTTOM field we need to add the first line */
-                if( i_field == 1 )
-                {
-                    vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
-                    p_in += p_pic->p[i_plane].i_pitch;
-                    p_out += p_outpic->p[i_plane].i_pitch;
-                }
-
-                p_out_end -= 2 * p_outpic->p[i_plane].i_pitch;
-
-                for( ; p_out < p_out_end ; )
-                {
-                    vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
-
-                    p_out += p_outpic->p[i_plane].i_pitch;
-
-                    vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
-
-                    p_in += 2 * p_pic->p[i_plane].i_pitch;
-                    p_out += p_outpic->p[i_plane].i_pitch;
-                }
-
-                vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
-
-                /* For TOP field we need to add the last line */
-                if( i_field == 0 )
-                {
-                    p_in += p_pic->p[i_plane].i_pitch;
-                    p_out += p_outpic->p[i_plane].i_pitch;
-                    vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
-                }
-                break;
-
-            case VLC_CODEC_I422:
-            case VLC_CODEC_J422:
-                /* For BOTTOM field we need to add the first line */
-                if( i_field == 1 )
-                {
-                    vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
-                    p_in += p_pic->p[i_plane].i_pitch;
-                    p_out += p_outpic->p[i_plane].i_pitch;
-                }
-
-                p_out_end -= 2 * p_outpic->p[i_plane].i_pitch;
+            vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
+            p_in += p_pic->p[i_plane].i_pitch;
+            p_out += p_outpic->p[i_plane].i_pitch;
+        }
 
-                if( i_plane == Y_PLANE )
-                {
-                    for( ; p_out < p_out_end ; )
-                    {
-                        vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
+        p_out_end -= 2 * p_outpic->p[i_plane].i_pitch;
 
-                        p_out += p_outpic->p[i_plane].i_pitch;
+        for( ; p_out < p_out_end ; )
+        {
+            vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
 
-                        vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
+            p_out += p_outpic->p[i_plane].i_pitch;
 
-                        p_in += 2 * p_pic->p[i_plane].i_pitch;
-                        p_out += p_outpic->p[i_plane].i_pitch;
-                    }
-                }
-                else
-                {
-                    for( ; p_out < p_out_end ; )
-                    {
-                        vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
+            vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
 
-                        p_out += p_outpic->p[i_plane].i_pitch;
-                        p_in += 2 * p_pic->p[i_plane].i_pitch;
-                    }
-                }
+            p_in += 2 * p_pic->p[i_plane].i_pitch;
+            p_out += p_outpic->p[i_plane].i_pitch;
+        }
 
-                vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
+        vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
 
-                /* For TOP field we need to add the last line */
-                if( i_field == 0 )
-                {
-                    p_in += p_pic->p[i_plane].i_pitch;
-                    p_out += p_outpic->p[i_plane].i_pitch;
-                    vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
-                }
-                break;
+        /* For TOP field we need to add the last line */
+        if( i_field == 0 )
+        {
+            p_in += p_pic->p[i_plane].i_pitch;
+            p_out += p_outpic->p[i_plane].i_pitch;
+            vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
         }
     }
 }
diff --git a/modules/video_filter/deinterlace/algo_basic.h b/modules/video_filter/deinterlace/algo_basic.h
index cd1634f..059135c 100644
--- a/modules/video_filter/deinterlace/algo_basic.h
+++ b/modules/video_filter/deinterlace/algo_basic.h
@@ -59,15 +59,13 @@ void RenderDiscard( picture_t *p_outpic, picture_t *p_pic, int i_field );
  *
  * For a 1x (non-doubling) near-equivalent, see RenderDiscard().
  *
- * @param p_filter The filter instance. Must be non-NULL.
  * @param p_outpic Output frame. Must be allocated by caller.
  * @param p_pic Input frame. Must exist.
  * @param i_field Render which field? 0 = top field, 1 = bottom field.
  * @see RenderLinear()
  * @see Deinterlace()
  */
-void RenderBob( filter_t *p_filter,
-                picture_t *p_outpic, picture_t *p_pic, int i_field );
+void RenderBob( picture_t *p_outpic, picture_t *p_pic, int i_field );
 
 /**
  * RenderLinear: Bob with linear interpolation.
diff --git a/modules/video_filter/deinterlace/deinterlace.c b/modules/video_filter/deinterlace/deinterlace.c
index dcdacf5..43983e5 100644
--- a/modules/video_filter/deinterlace/deinterlace.c
+++ b/modules/video_filter/deinterlace/deinterlace.c
@@ -254,6 +254,7 @@ void GetOutputFormat( filter_t *p_filter,
         case DEINTERLACE_PHOSPHOR:
         case DEINTERLACE_IVTC:
         case DEINTERLACE_DISCARD:
+        case DEINTERLACE_BOB:
             p_dst->i_chroma = p_src->i_chroma;
             break;
         default:
@@ -460,11 +461,11 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
             break;
 
         case DEINTERLACE_BOB:
-            RenderBob( p_filter, p_dst[0], p_pic, !b_top_field_first );
+            RenderBob( p_dst[0], p_pic, !b_top_field_first );
             if( p_dst[1] )
-                RenderBob( p_filter, p_dst[1], p_pic, b_top_field_first );
+                RenderBob( p_dst[1], p_pic, b_top_field_first );
             if( p_dst[2] )
-                RenderBob( p_filter, p_dst[2], p_pic, !b_top_field_first );
+                RenderBob( p_dst[2], p_pic, !b_top_field_first );
             break;;
 
         case DEINTERLACE_LINEAR:



More information about the vlc-commits mailing list