--- orginal/crystalhd.c	2010-12-24 09:08:07.000000000 +0100
+++ new/crystalhd.c	2010-12-24 09:14:13.000000000 +0100
@@ -55,6 +55,8 @@
 static int        OpenDecoder  ( vlc_object_t * );
 static void       CloseDecoder ( vlc_object_t * );
 
+static BC_DTS_PROC_OUT proc_out_prev;
+
 vlc_module_begin ()
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_VCODEC )
@@ -69,6 +71,7 @@
  *****************************************************************************/
 static picture_t *DecodeBlock   ( decoder_t *p_dec, block_t **pp_block );
 static void crystal_CopyPicture ( picture_t *, BC_DTS_PROC_OUT* );
+static void crystal_CopyPicture_interlaced ( picture_t *, BC_DTS_PROC_OUT*, BC_DTS_PROC_OUT*, bool );
 static int crystal_insert_sps_pps(decoder_t *, uint8_t *, uint32_t);
 
 /*****************************************************************************
@@ -233,6 +236,8 @@
     /* Set callbacks */
     p_dec->pf_decode_video = DecodeBlock;
 
+	memset( &proc_out_prev, 0, sizeof(BC_DTS_PROC_OUT) );
+
     msg_Info( p_dec, "Opened CrystalHD hardware with success" );
     return VLC_SUCCESS;
 
@@ -252,6 +257,14 @@
     decoder_t *p_dec = (decoder_t *)p_this;
     decoder_sys_t *p_sys = p_dec->p_sys;
 
+	if (proc_out_prev.Ybuff)
+	{
+		free(proc_out_prev.Ybuff);
+		proc_out_prev.Ybuff = NULL;
+	}
+
+	memset( &proc_out_prev, 0, sizeof(BC_DTS_PROC_OUT) );
+
     if( DtsFlushInput( p_sys->bcm_handle, 2 ) != BC_STS_SUCCESS )
         goto error;
     if( DtsStopDecoder( p_sys->bcm_handle ) != BC_STS_SUCCESS )
@@ -269,6 +282,7 @@
     free( p_sys );
 }
 
+
 /****************************************************************************
  * DecodeBlock: the whole thing
  ****************************************************************************/
@@ -323,7 +337,7 @@
     proc_out.PicInfo.height = p_dec->fmt_out.video.i_height;
     proc_out.YbuffSz        = p_dec->fmt_out.video.i_width * p_dec->fmt_out.video.i_height  / 2;
     proc_out.Ybuff          = malloc( proc_out.YbuffSz  * 4);               // Allocate in bytes
-    proc_out.PoutFlags      = BC_POUT_FLAGS_SIZE;                           //FIXME why?
+    proc_out.PoutFlags      = BC_POUT_FLAGS_SIZE;                        //FIXME why?
 
 #ifdef DEBUG_CRYSTALHD
     msg_Dbg( p_dec, "%i, %i",  p_dec->fmt_out.video.i_width, p_dec->fmt_out.video.i_height );
@@ -347,11 +361,45 @@
                 break;
             }
 
-            p_pic = decoder_NewPicture( p_dec );
-            if( !p_pic )
-                break;
+			if (proc_out.PicInfo.flags&VDEC_FLAG_INTERLACED_SRC)
+			{
+				if (!proc_out_prev.Ybuff)
+				{
+					proc_out_prev = proc_out;
+					return NULL;
+				}
+				
+				bool bottom;
+
+				if (proc_out_prev.PoutFlags&BC_POUT_FLAGS_FLD_BOT) 
+				{
+					bottom = TRUE;	
+				}
+				else
+				{
+					bottom = FALSE;
+				}
+
+				p_pic = decoder_NewPicture( p_dec );
+            	if( !p_pic )
+                	break;
+
+				crystal_CopyPicture_interlaced( p_pic, &proc_out_prev, &proc_out, bottom );
+
+				free(proc_out_prev.Ybuff);
+				proc_out_prev.Ybuff = NULL;
+
+			}
+			else
+			{
+				p_pic = decoder_NewPicture( p_dec );
+            	if( !p_pic )
+                	break;
 
-            crystal_CopyPicture( p_pic, &proc_out );
+				crystal_CopyPicture( p_pic, &proc_out );
+			}
+
+            
             p_pic->date = proc_out.PicInfo.timeStamp > 0 ? FROM_BC_PTS(proc_out.PicInfo.timeStamp) : VLC_TS_INVALID;
             //p_pic->date += 100 * 1000;
 #ifdef DEBUG_CRYSTALHD
@@ -439,6 +487,36 @@
         vlc_memcpy( p_dst, p_src, p_out->PicInfo.width * 2); // Copy in bytes
 }
 
+static void crystal_CopyPicture_interlaced( picture_t *p_pic, BC_DTS_PROC_OUT* p_out, BC_DTS_PROC_OUT* p_out2, bool bottom)
+{
+    int i_dst_stride;
+    uint8_t *p_dst, *p_dst_end;
+    uint8_t *p_src = p_out->Ybuff;
+
+	p_pic->b_progressive = FALSE;
+	p_pic->b_top_field_first = !bottom;
+	p_pic->i_nb_fields = 2;
+
+    p_dst         = p_pic->p[0].p_pixels;
+    i_dst_stride  = p_pic->p[0].i_pitch;
+    p_dst_end     = p_dst  + (i_dst_stride * p_out->PicInfo.height);
+
+
+	if (bottom) p_dst += i_dst_stride;
+	
+	for( ; p_dst < p_dst_end; p_dst += i_dst_stride * 2, p_src += (p_out->PicInfo.width * 2))
+    	vlc_memcpy( p_dst, p_src, p_out->PicInfo.width * 2);
+	
+	p_dst = p_pic->p[0].p_pixels;
+	p_src = p_out2->Ybuff;
+	
+	if (!bottom) p_dst += i_dst_stride;
+
+	for( ; p_dst < p_dst_end; p_dst += i_dst_stride * 2, p_src += (p_out2->PicInfo.width * 2))
+    	vlc_memcpy( p_dst, p_src, p_out2->PicInfo.width * 2);
+	
+}
+
 /* Parse the SPS/PPS Metadata to feed the decoder for avc1 */
 static int crystal_insert_sps_pps(decoder_t *p_dec, uint8_t *p_buf, uint32_t i_buf_size)
 {
@@ -512,3 +590,4 @@
     p_sys->p_sps_pps_buf = NULL;
     return VLC_ENOMEM;
 }
+
