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

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


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri May 25 16:38:01 2012 +0200| [67e3c15bda9f3cf3be729771a7b24ff12f9ff3b1] | committer: Laurent Aimar

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

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

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

 modules/video_filter/deinterlace/algo_basic.c  |   50 +++---------------------
 modules/video_filter/deinterlace/algo_basic.h  |    4 +-
 modules/video_filter/deinterlace/deinterlace.c |   13 +++---
 modules/video_filter/deinterlace/deinterlace.h |    4 +-
 4 files changed, 12 insertions(+), 59 deletions(-)

diff --git a/modules/video_filter/deinterlace/algo_basic.c b/modules/video_filter/deinterlace/algo_basic.c
index 3436356..3dd9097 100644
--- a/modules/video_filter/deinterlace/algo_basic.c
+++ b/modules/video_filter/deinterlace/algo_basic.c
@@ -42,8 +42,7 @@
  * RenderDiscard: only keep TOP or BOTTOM field, discard the other.
  *****************************************************************************/
 
-void RenderDiscard( filter_t *p_filter,
-                    picture_t *p_outpic, picture_t *p_pic, int i_field )
+void RenderDiscard( picture_t *p_outpic, picture_t *p_pic, int i_field )
 {
     int i_plane;
 
@@ -51,7 +50,6 @@ void RenderDiscard( filter_t *p_filter,
     for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
     {
         uint8_t *p_in, *p_out_end, *p_out;
-        int i_increment;
 
         p_in = p_pic->p[i_plane].p_pixels
                    + i_field * p_pic->p[i_plane].i_pitch;
@@ -60,50 +58,12 @@ void RenderDiscard( 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( ; p_out < p_out_end ; )
         {
-        case VLC_CODEC_I420:
-        case VLC_CODEC_J420:
-        case VLC_CODEC_YV12:
-
-            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;
-                p_in += 2 * p_pic->p[i_plane].i_pitch;
-            }
-            break;
-
-        case VLC_CODEC_I422:
-        case VLC_CODEC_J422:
-
-            i_increment = 2 * p_pic->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 += p_outpic->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 += i_increment;
-                }
-            }
-            else
-            {
-                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;
-                    p_in += i_increment;
-                }
-            }
-            break;
+            vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
 
-        default:
-            break;
+            p_out += p_outpic->p[i_plane].i_pitch;
+            p_in += 2 * 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 4923948..cd1634f 100644
--- a/modules/video_filter/deinterlace/algo_basic.h
+++ b/modules/video_filter/deinterlace/algo_basic.h
@@ -44,15 +44,13 @@ struct picture_t;
  *
  * For a 2x (framerate-doubling) near-equivalent, see RenderBob().
  *
- * @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 Keep which field? 0 = top field, 1 = bottom field.
  * @see RenderBob()
  * @see Deinterlace()
  */
-void RenderDiscard( filter_t *p_filter,
-                    picture_t *p_outpic, picture_t *p_pic, int i_field );
+void RenderDiscard( picture_t *p_outpic, picture_t *p_pic, int i_field );
 
 /**
  * RenderBob: basic framerate doubler.
diff --git a/modules/video_filter/deinterlace/deinterlace.c b/modules/video_filter/deinterlace/deinterlace.c
index 60b5f45..dcdacf5 100644
--- a/modules/video_filter/deinterlace/deinterlace.c
+++ b/modules/video_filter/deinterlace/deinterlace.c
@@ -135,8 +135,7 @@ static const char *const ppsz_filter_options[] = {
  * SetFilterMethod: setup the deinterlace method to use.
  *****************************************************************************/
 
-void SetFilterMethod( filter_t *p_filter, const char *psz_method,
-                      vlc_fourcc_t i_chroma )
+void SetFilterMethod( filter_t *p_filter, const char *psz_method )
 {
     filter_sys_t *p_sys = p_filter->p_sys;
 
@@ -202,12 +201,9 @@ void SetFilterMethod( filter_t *p_filter, const char *psz_method,
     }
     else if( !strcmp( psz_method, "discard" ) )
     {
-        const bool b_i422 = i_chroma == VLC_CODEC_I422 ||
-                            i_chroma == VLC_CODEC_J422;
-
         p_sys->i_mode = DEINTERLACE_DISCARD;
         p_sys->b_double_rate = false;
-        p_sys->b_half_height = !b_i422;
+        p_sys->b_half_height = true;
         p_sys->b_use_frame_history = false;
     }
     else
@@ -257,6 +253,7 @@ void GetOutputFormat( filter_t *p_filter,
         case DEINTERLACE_YADIF2X:
         case DEINTERLACE_PHOSPHOR:
         case DEINTERLACE_IVTC:
+        case DEINTERLACE_DISCARD:
             p_dst->i_chroma = p_src->i_chroma;
             break;
         default:
@@ -459,7 +456,7 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
     switch( p_sys->i_mode )
     {
         case DEINTERLACE_DISCARD:
-            RenderDiscard( p_filter, p_dst[0], p_pic, 0 );
+            RenderDiscard( p_dst[0], p_pic, 0 );
             break;
 
         case DEINTERLACE_BOB:
@@ -700,7 +697,7 @@ int Open( vlc_object_t *p_this )
                        p_filter->p_cfg );
 
     char *psz_mode = var_GetNonEmptyString( p_filter, FILTER_CFG_PREFIX "mode" );
-    SetFilterMethod( p_filter, psz_mode, p_filter->fmt_in.video.i_chroma );
+    SetFilterMethod( p_filter, psz_mode );
     free( psz_mode );
 
     if( p_sys->i_mode == DEINTERLACE_PHOSPHOR )
diff --git a/modules/video_filter/deinterlace/deinterlace.h b/modules/video_filter/deinterlace/deinterlace.h
index 844a59d..a0b55ce 100644
--- a/modules/video_filter/deinterlace/deinterlace.h
+++ b/modules/video_filter/deinterlace/deinterlace.h
@@ -130,11 +130,9 @@ struct filter_sys_t
  *
  * @param p_filter The filter instance.
  * @param psz_method Desired method. See mode_list for available choices.
- * @param i_chroma Input chroma. Set this to p_filter->fmt_in.video.i_chroma.
  * @see mode_list
  */
-void SetFilterMethod( filter_t *p_filter, const char *psz_method,
-                      vlc_fourcc_t i_chroma );
+void SetFilterMethod( filter_t *p_filter, const char *psz_method );
 
 /**
  * Get the output video format of the chosen deinterlace method



More information about the vlc-commits mailing list