From 7c51933043faf6fdaf48a827bc04949e92b7f118 Mon Sep 17 00:00:00 2001 From: arpi_esp Date: Sun, 11 Mar 2001 01:28:31 +0000 Subject: backward-frame rendering by slices git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@80 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpeg2/decode.c | 44 +++++++++++++++++++++++++++++--------------- libmpeg2/mpeg2_internal.h | 6 +++++- 2 files changed, 34 insertions(+), 16 deletions(-) (limited to 'libmpeg2') diff --git a/libmpeg2/decode.c b/libmpeg2/decode.c index 451050d0bb..b5779b0139 100644 --- a/libmpeg2/decode.c +++ b/libmpeg2/decode.c @@ -111,7 +111,6 @@ void mpeg2_allocate_image_buffers (picture_t * picture) 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 @@ void mpeg2_allocate_image_buffers (picture_t * picture) 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 @@ static int parse_chunk (vo_functions_t * output, int code, uint8_t * buffer) 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 @@ static int parse_chunk (vo_functions_t * output, int code, uint8_t * buffer) // vo_field (picture->current_frame, picture->picture_structure); } else { if (picture->picture_coding_type == B_TYPE){ + picture->display_frame= picture->current_frame = &frames[2]; -#ifdef MPEG12_POSTPROC - if(picture->pp_options) - picture->current_frame->copy=NULL; else -#endif - picture->current_frame->copy=copy_slice; +// 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; +// 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; +#endif picture->current_frame->vo=output; - picture->current_frame->slice=0; + picture->slice=0; } diff --git a/libmpeg2/mpeg2_internal.h b/libmpeg2/mpeg2_internal.h index 8eb3e924da..cb79406a38 100644 --- a/libmpeg2/mpeg2_internal.h +++ b/libmpeg2/mpeg2_internal.h @@ -55,7 +55,7 @@ typedef struct vo_frame_s { 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 @@ typedef struct picture_s { 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 { -- cgit v1.2.3