changeset 79:b7b038ee3fde

backward-frame rendering by slices
author arpi_esp
date Sun, 11 Mar 2001 01:28:31 +0000
parents 8b89201970f6
children 74064c2929a1
files libmpeg2/decode.c libmpeg2/mpeg2_internal.h
diffstat 2 files changed, 35 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/libmpeg2/decode.c	Sun Mar 11 00:43:40 2001 +0000
+++ b/libmpeg2/decode.c	Sun Mar 11 01:28:31 2001 +0000
@@ -111,7 +111,6 @@
 	    frames[i].base[2] = base + frame_size;
 	    frames[i].copy = NULL;
 	    frames[i].vo = NULL;
-	    frames[i].slice=0;
 	}
 	
 	picture->forward_reference_frame=&frames[0];
@@ -123,18 +122,27 @@
 static void copy_slice (vo_frame_t * frame, uint8_t ** src){
     vo_functions_t * output = frame->vo;
     int stride[3];
-    int y=frame->slice*16;
+    int y=picture->slice<<4;
+    uint8_t* src_tmp[3];
 
     stride[0]=picture->coded_picture_width;
     stride[1]=stride[2]=stride[0]/2;
-
-    output->draw_slice (src, stride, 
-                picture->display_picture_width,
+    
+    if(frame!=picture->display_frame){
+	uint8_t** base=picture->display_frame->base;
+	src_tmp[0]=base[0]+stride[0]*y;
+	src_tmp[1]=base[1]+stride[1]*(y>>1);
+	src_tmp[2]=base[2]+stride[2]*(y>>1);
+	src=src_tmp;
+    }
+    
+    output->draw_slice (src,
+		stride, picture->display_picture_width,
 		(y+16<=picture->display_picture_height) ? 16 :
 		    picture->display_picture_height-y,
 		0, y);
 
-    ++frame->slice;
+    ++picture->slice;
 }
 
 static int in_slice_flag=0;
@@ -169,9 +177,9 @@
 		    output->draw_slice (frames[3].base, stride, 
                         picture->display_picture_width,
                         picture->display_picture_height, 0, 0);
-	       } else
+	       }// else
 #endif
-#if 1
+#if 0
 		if (picture->picture_coding_type != B_TYPE) {
             	    int stride[3];
             	    stride[0]=picture->coded_picture_width;
@@ -228,22 +236,28 @@
 //		vo_field (picture->current_frame, picture->picture_structure);
 	    } else {
 		if (picture->picture_coding_type == B_TYPE){
+		    picture->display_frame=
 		    picture->current_frame = &frames[2];
+//		    picture->current_frame->copy=copy_slice;
+		} else {
+		    picture->current_frame = picture->forward_reference_frame;
+		    picture->display_frame=
+		    picture->forward_reference_frame = picture->backward_reference_frame;
+		    picture->backward_reference_frame = picture->current_frame;
+//		    picture->current_frame->copy=NULL;
+		}
+	    }
+
+#if 1
 #ifdef MPEG12_POSTPROC
 	            if(picture->pp_options)
 			picture->current_frame->copy=NULL; else
 #endif
 		    picture->current_frame->copy=copy_slice;
-		} else {
-		    picture->current_frame = picture->forward_reference_frame;
-		    picture->forward_reference_frame = picture->backward_reference_frame;
-		    picture->backward_reference_frame = picture->current_frame;
-		    picture->current_frame->copy=NULL;
-		}
-	    }
+#endif
 	    
 	    picture->current_frame->vo=output;
-	    picture->current_frame->slice=0;
+	    picture->slice=0;
 
 	}
 
--- a/libmpeg2/mpeg2_internal.h	Sun Mar 11 00:43:40 2001 +0000
+++ b/libmpeg2/mpeg2_internal.h	Sun Mar 11 01:28:31 2001 +0000
@@ -55,7 +55,7 @@
     uint8_t * base[3];	/* pointer to 3 planes */
     void (* copy) (struct vo_frame_s * frame, uint8_t ** src);
     void* vo;
-    int slice;
+//    int slice;
 //    void (* field) (struct vo_frame_s * frame, int flags);
 //    void (* draw) (struct vo_frame_s * frame);
 //    vo_instance_t * instance;
@@ -147,6 +147,10 @@
     int display_picture_height;
     int pp_options;
     int repeat_count;
+
+    struct vo_frame_s * display_frame;
+    int slice;
+
 } picture_t;
 
 typedef struct mpeg2_config_s {