[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[118] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2010-01-22 15:41:53
|
Revision: 118 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=118&view=rev Author: nickols_k Date: 2010-01-22 15:41:46 +0000 (Fri, 22 Jan 2010) Log Message: ----------- let mp_image knows number of XP-frame where it will be rendered Modified Paths: -------------- mplayerxp/dec_ahead.c mplayerxp/libmpcodecs/vd.c mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/mp_image.c mplayerxp/mp_image.h mplayerxp/postproc/vf.c mplayerxp/postproc/vf_menu.c mplayerxp/postproc/vf_vo.c Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2010-01-21 18:27:56 UTC (rev 117) +++ mplayerxp/dec_ahead.c 2010-01-22 15:41:46 UTC (rev 118) @@ -248,7 +248,7 @@ MSG_DBG2("Sync mpeg pts %f\n", mpeg_timer); } else mpeg_timer+=duration; } - vo_set_frame_num(&dec_ahead_locked_frame); + vo_set_decoding_frame_num(&dec_ahead_locked_frame); /* ----------- compute frame dropping ------------- */ LOCK_VDEC_ACTIVE(); ada_active_frame= abs_dec_ahead_active_frame; Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2010-01-21 18:27:56 UTC (rev 117) +++ mplayerxp/libmpcodecs/vd.c 2010-01-22 15:41:46 UTC (rev 118) @@ -270,8 +270,11 @@ // returns NULL or allocated mp_image_t* // Note: buffer allocation may be moved to mpcodecs_config_vo() later... mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag,int w, int h){ + MSG_DBG2("mpcodecs_get_image(vf_%s,%i,%i,%i,%i) was called\n",((vf_instance_t *)(sh->vfilter))->info->name,mp_imgtype,mp_imgflag,w,h); mp_image_t* mpi=vf_get_image(sh->vfilter,sh->codec->outfmt[sh->outfmtidx],mp_imgtype,mp_imgflag,w,h); mpi->x=mpi->y=0; + if(mpi->xp_idx==XP_IDX_INVALID) + MSG_WARN("[mpcodecs_get_image] Incorrect mpi->xp_idx. Be ready for segfault!\n"); return mpi; } Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =================================================================== --- mplayerxp/libmpcodecs/vd_ffmpeg.c 2010-01-21 18:27:56 UTC (rev 117) +++ mplayerxp/libmpcodecs/vd_ffmpeg.c 2010-01-22 15:41:46 UTC (rev 118) @@ -87,6 +87,8 @@ AVCodec *lavc_codec; AVCodecContext *ctx; AVFrame *lavc_picture; + mp_image_t* mpi; + unsigned long long frame_number; /* total frame number since begin of movie */ int b_age; int ip_age[2]; int qp_stat[32]; @@ -225,6 +227,7 @@ vdff_ctx=malloc(sizeof(priv_t)); memset(vdff_ctx,0,sizeof(priv_t)); sh->context = vdff_ctx; + vdff_ctx->frame_number=-2; vdff_ctx->lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh->codec->dll_name); if(!vdff_ctx->lavc_codec){ MSG_ERR(MSGTR_MissingLAVCcodec,sh->codec->dll_name); @@ -577,9 +580,14 @@ { sh_video_t *sh=s->opaque; priv_t *vdff_ctx=sh->context; - mp_image_t *mpi; + mp_image_t *mpi=vdff_ctx->mpi; + unsigned long long int total_frame; + unsigned orig_idx = mpi->xp_idx; + /* sync-point*/ + if(src->pict_type==FF_I_TYPE) vdff_ctx->frame_number = src->coded_picture_number; + total_frame = vdff_ctx->frame_number; if(vdff_ctx->use_dr1) { MSG_DBG2("Ignoring draw_slice due dr1\n"); return; } /* we may call vo_start_slice() here */ - mpi=mpcodecs_get_image(sh,MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_DRAW_CALLBACK|MP_IMGFLAG_DIRECT,s->width,s->height); +// mpi=mpcodecs_get_image(sh,MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_DRAW_CALLBACK|MP_IMGFLAG_DIRECT,s->width,s->height); mpi->stride[0]=src->linesize[0]; mpi->stride[1]=src->linesize[1]; @@ -609,9 +617,33 @@ mpi->stride[2]=mpi->stride[1]; mpi->stride[1]=ls; } - MSG_DBG2("ff_draw_callback[%ux%u] %i %i %i %i\n",mpi->width,mpi->height,mpi->x,mpi->y,mpi->w,mpi->h); +#if 0 + /* handle IPB-frames here */ + if(total_frame!=src->coded_picture_number) { + unsigned long long int tf = total_frame; + /* we can do only 1 step forward */ + if(total_frame<src->coded_picture_number) + mpi->xp_idx = vo_get_decoding_next_frame(mpi->xp_idx); + else + while(tf>src->coded_picture_number) { + mpi->xp_idx = vo_get_decoding_prev_frame(mpi->xp_idx); + tf--; + } + } +#endif + MSG_DBG2("ff_draw_callback<%u->%u:%u:%u-%s>[%ux%u] %i %i %i %i\n", + orig_idx,mpi->xp_idx,(unsigned)total_frame,src->coded_picture_number, + src->pict_type==FF_BI_TYPE?"bi": + src->pict_type==FF_SP_TYPE?"sp": + src->pict_type==FF_SI_TYPE?"si": + src->pict_type==FF_S_TYPE?"s": + src->pict_type==FF_B_TYPE?"b": + src->pict_type==FF_P_TYPE?"p": + src->pict_type==FF_I_TYPE?"i":"??" + ,mpi->width,mpi->height,mpi->x,mpi->y,mpi->w,mpi->h); __MP_ATOMIC(sh->active_slices++); mpcodecs_draw_slice (sh, mpi); + mpi->xp_idx = orig_idx; __MP_ATOMIC(sh->active_slices--); } @@ -630,8 +662,6 @@ int ret,has_b_frames; priv_t *vdff_ctx=sh->context; mp_image_t* mpi=NULL; - void *next_put_slice; - vf_instance_t *vf; vdff_ctx->ctx->opaque=sh; if(len<=0) return NULL; // skipped frame @@ -644,24 +674,17 @@ if sh->vfilter==vf_vo (DR1 is meaningless into temp buffer) It always happens with (vidix+bus mastering), (if (disp_w%16==0)) with xv */ - vf=sh->vfilter; - next_put_slice=NULL; - while(vf) - { - /* exclude vf_aspect and similar */ - if(vf->put_slice != vf_next_put_slice && vf->next) next_put_slice=vf->put_slice; - vf=vf->next; - } has_b_frames=vdff_ctx->ctx->has_b_frames|| sh->format==0x10000001 || /* mpeg1 may have b frames */ vdff_ctx->lavc_codec->id==CODEC_ID_SVQ3|| 1; mpi= mpcodecs_get_image(sh,has_b_frames?MP_IMGTYPE_IPB:MP_IMGTYPE_IP,MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE|MP_IMGFLAG_READABLE|MP_IMGFLAG_PRESERVE, 16,16); - if(vdff_ctx->cap_dr1 && + if(!(vdff_ctx->cap_dr1 && vdff_ctx->lavc_codec->id != CODEC_ID_H264 && - !next_put_slice && mpi->flags&MP_IMGFLAG_DIRECT) - vdff_ctx->use_dr1=1; + vdff_ctx->use_slices && mpi->flags&MP_IMGFLAG_DIRECT && !has_b_frames)) + vdff_ctx->use_slices=0; + if(vdff_ctx->use_slices) vdff_ctx->use_dr1=0; if( sh->format == mmioFOURCC('R', 'V', '1', '0') || sh->format == mmioFOURCC('R', 'V', '1', '3') || sh->format == mmioFOURCC('R', 'V', '2', '0') @@ -694,6 +717,8 @@ if(!(flags&3) && vdff_ctx->use_slices) { mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_DRAW_CALLBACK|MP_IMGFLAG_DIRECT,sh->disp_w, sh->disp_h); + vdff_ctx->mpi = mpi; + vdff_ctx->frame_number++; vdff_ctx->ctx->draw_horiz_band=draw_slice; } else vdff_ctx->ctx->draw_horiz_band=NULL; /* skip draw_slice on framedropping */ Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2010-01-21 18:27:56 UTC (rev 117) +++ mplayerxp/libvo/video_out.c 2010-01-22 15:41:46 UTC (rev 118) @@ -527,6 +527,7 @@ int width_less_stride; MSG_DBG2("dri_vo_dbg: vo_get_surface type=%X flg=%X\n",mpi->type,mpi->flags); width_less_stride = 0; + mpi->xp_idx = xp_frame; if(mpi->flags & MP_IMGFLAG_PLANAR) { width_less_stride = mpi->w <= dri_cap.strides[0] && @@ -644,16 +645,30 @@ return VO_TRUE; } -uint32_t __FASTCALL__ vo_get_frame_num( volatile unsigned * fr ) +uint32_t __FASTCALL__ vo_get_decoding_frame_num( volatile unsigned * fr ) { *fr = has_dri ? xp_frame : 0; - MSG_DBG3("dri_vo_dbg: %u=vo_get_frame_num\n",*fr); + MSG_DBG3("dri_vo_dbg: %u=vo_get_decoding_frame_num\n",*fr); return VO_TRUE; } -uint32_t __FASTCALL__ vo_set_frame_num( volatile unsigned * fr ) +unsigned __FASTCALL__ vo_get_decoding_next_frame( unsigned idx ) { - MSG_DBG3("dri_vo_dbg: vo_set_frame_num(%u)\n",*fr); + unsigned rval; + rval = has_dri ? (idx+1)%dri_nframes : 0; + return rval; +} + +unsigned __FASTCALL__ vo_get_decoding_prev_frame( unsigned idx ) +{ + unsigned rval; + rval = has_dri ? (idx-1+dri_nframes)%dri_nframes : 0; + return rval; +} + +uint32_t __FASTCALL__ vo_set_decoding_frame_num( volatile unsigned * fr ) +{ + MSG_DBG2("dri_vo_dbg: vo_set_decoding_frame_num(%u) for decoding to\n",*fr); xp_frame = *fr; dri_has_thread = 1; return VO_TRUE; @@ -666,14 +681,6 @@ return VO_TRUE; } -uint32_t __FASTCALL__ vo_set_active_frame( volatile unsigned * fr) -{ - MSG_DBG3("dri_vo_dbg: vo_set_active_frame(%u)\n",*fr); - active_frame = *fr; - vo_change_frame(); - return VO_TRUE; -} - uint32_t __FASTCALL__ vo_draw_slice(const mp_image_t *mpi) { unsigned i,_w[4],_h[4],x,y; @@ -684,9 +691,10 @@ const uint8_t *ps_src[4]; int dstStride[4]; int finalize=vo_is_final(); + unsigned idx = mpi->xp_idx; for(i=0;i<4;i++) { - dst[i]=dri_surf[xp_frame].planes[i]+dri_off[i]; + dst[i]=dri_surf[idx].planes[i]+dri_off[i]; dstStride[i]=dri_cap.strides[i]; dst[i]+=((mpi->y*dstStride[i])*vod.y_mul[i])/vod.y_div[i]; dst[i]+=(mpi->x*vod.x_mul[i])/vod.x_div[i]; @@ -711,7 +719,7 @@ void vo_change_frame(void) { - MSG_DBG3("dri_vo_dbg: vo_change_frame [active_frame=%u]\n",active_frame); + MSG_DBG2("dri_vo_dbg: vo_change_frame [active_frame=%u]\n",active_frame); if(vo_doublebuffering || (dri_cap.caps & DRI_CAP_VIDEO_MMAPED)!=DRI_CAP_VIDEO_MMAPED) { video_out->change_frame(active_frame); Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2010-01-21 18:27:56 UTC (rev 117) +++ mplayerxp/libvo/video_out.h 2010-01-22 15:41:46 UTC (rev 118) @@ -169,11 +169,11 @@ extern uint32_t __FASTCALL__ vo_get_surface( mp_image_t* mpi ); extern int vo_check_events( void ); extern uint32_t __FASTCALL__ vo_get_num_frames( unsigned * ); -extern uint32_t __FASTCALL__ vo_get_frame_num( volatile unsigned * ); -extern uint32_t __FASTCALL__ vo_set_frame_num( volatile unsigned * ); +extern uint32_t __FASTCALL__ vo_get_decoding_frame_num( volatile unsigned * ); +extern uint32_t __FASTCALL__ vo_set_decoding_frame_num( volatile unsigned * ); +extern unsigned __FASTCALL__ vo_get_decoding_next_frame( unsigned idx ); +extern unsigned __FASTCALL__ vo_get_decoding_prev_frame( unsigned idx ); extern uint32_t __FASTCALL__ vo_get_active_frame( volatile unsigned * ); -extern uint32_t __FASTCALL__ vo_set_active_frame( volatile unsigned * ); -extern uint32_t __FASTCALL__ vo_draw_frame(const mp_image_t *mpi); extern uint32_t __FASTCALL__ vo_draw_slice(const mp_image_t *mpi); extern void vo_change_frame(void); extern void vo_flush_pages(void); Modified: mplayerxp/mp_image.c =================================================================== --- mplayerxp/mp_image.c 2010-01-21 18:27:56 UTC (rev 117) +++ mplayerxp/mp_image.c 2010-01-22 15:41:46 UTC (rev 118) @@ -1,4 +1,3 @@ - #include "mp_config.h" #include <stdio.h> @@ -143,10 +142,11 @@ mpi->bpp=0; } -mp_image_t* new_mp_image(int w,int h){ +mp_image_t* new_mp_image(unsigned w,unsigned h,unsigned xp_idx){ mp_image_t* mpi=(mp_image_t*)malloc(sizeof(mp_image_t)); if(!mpi) return NULL; // error! memset(mpi,0,sizeof(mp_image_t)); + mpi->xp_idx = xp_idx; mpi->width=mpi->w=w; mpi->height=mpi->h=h; return mpi; @@ -161,10 +161,15 @@ free(mpi); } -mp_image_t* alloc_mpi(int w, int h, unsigned int fmt) { - mp_image_t* mpi = new_mp_image(w,h); +mp_image_t* alloc_mpi(unsigned w, unsigned h, unsigned int fmt,unsigned xp_idx) { + mp_image_t* mpi = new_mp_image(w,h,xp_idx); mp_image_setfmt(mpi,fmt); + mpi_alloc_planes(mpi); + return mpi; +} + +void mpi_alloc_planes(mp_image_t *mpi) { // IF09 - allocate space for 4. plane delta info - unused if (mpi->imgfmt == IMGFMT_IF09) { @@ -192,8 +197,6 @@ if(!mpi->stride[0]) mpi->stride[0]=mpi->width*mpi->bpp/8; } mpi->flags|=MP_IMGFLAG_ALLOCATED; - - return mpi; } void copy_mpi(mp_image_t *dmpi,const mp_image_t *mpi) { Modified: mplayerxp/mp_image.h =================================================================== --- mplayerxp/mp_image.h 2010-01-21 18:27:56 UTC (rev 117) +++ mplayerxp/mp_image.h 2010-01-22 15:41:46 UTC (rev 118) @@ -4,68 +4,48 @@ //--------- codec's requirements (filled by the codec/vf) --------- //--- buffer content restrictions: -// set if buffer content shouldn't be modified: -#define MP_IMGFLAG_PRESERVE 0x01 -// set if buffer content will be READ for next frame's MC: (I/P mpeg frames) -#define MP_IMGFLAG_READABLE 0x02 +#define MP_IMGFLAG_PRESERVE 0x00001 // set if buffer content shouldn't be modified: +#define MP_IMGFLAG_READABLE 0x00002 // set if buffer content will be READ for next frame's MC: (I/P mpeg frames) //--- buffer width/stride/plane restrictions: (used for direct rendering) // stride _have_to_ be aligned to MB boundary: [for DR restrictions] -#define MP_IMGFLAG_ACCEPT_ALIGNED_STRIDE 0x04 /* no flag - should be neg value of MP_IMGFLAG_ACCEPT_STRIDE */ +#define MP_IMGFLAG_ACCEPT_ALIGNED_STRIDE 0x00004 /* no flag - should be neg value of MP_IMGFLAG_ACCEPT_STRIDE */ // stride should be aligned to MB boundary: [for buffer allocation] -#define MP_IMGFLAG_PREFER_ALIGNED_STRIDE 0x08 /* sould be no flag - everything prefer aligned strides */ -// codec accept any stride (>=width): -#define MP_IMGFLAG_ACCEPT_STRIDE 0x10 -// codec accept any width (width*bpp=stride -> stride%bpp==0) (>=width): -#define MP_IMGFLAG_ACCEPT_WIDTH 0x20 +#define MP_IMGFLAG_PREFER_ALIGNED_STRIDE 0x00008 /* sould be no flag - everything prefer aligned strides */ +#define MP_IMGFLAG_ACCEPT_STRIDE 0x00010 // codec accept any stride (>=width): +#define MP_IMGFLAG_ACCEPT_WIDTH 0x00020 // codec accept any width (width*bpp=stride -> stride%bpp==0) (>=width): //--- for planar formats only: // uses only stride[0], and stride[1]=stride[2]=stride[0]>>mpi->chroma_x_shift -#define MP_IMGFLAG_COMMON_STRIDE 0x40 /* UNUSED */ +#define MP_IMGFLAG_COMMON_STRIDE 0x00040 /* UNUSED */ // uses only planes[0], and calculates planes[1,2] from width,height,imgfmt -#define MP_IMGFLAG_COMMON_PLANE 0x80 /* UNUSED */ -#define MP_IMGFLAGMASK_RESTRICTIONS 0xFF +#define MP_IMGFLAG_COMMON_PLANE 0x00080 /* UNUSED */ +#define MP_IMGFLAGMASK_RESTRICTIONS 0x000FF //--------- color info (filled by mp_image_setfmt() ) ----------- -// set if number of planes > 1 -#define MP_IMGFLAG_PLANAR 0x100 -// set if it's YUV colorspace -#define MP_IMGFLAG_YUV 0x200 -// set if it's swapped (BGR or YVU) plane/byteorder -#define MP_IMGFLAG_SWAPPED 0x400 -// using palette for RGB data -#define MP_IMGFLAG_RGB_PALETTE 0x800 -#define MP_IMGFLAGMASK_COLORS 0xF00 +#define MP_IMGFLAG_PLANAR 0x00100 // set if number of planes > 1 +#define MP_IMGFLAG_YUV 0x00200 // set if it's YUV colorspace +#define MP_IMGFLAG_SWAPPED 0x00400 // set if it's swapped (BGR or YVU) plane/byteorder +#define MP_IMGFLAG_RGB_PALETTE 0x00800 // using palette for RGB data +#define MP_IMGFLAGMASK_COLORS 0x00F00 // codec uses drawing/rendering callbacks (draw_slice()-like thing, DR method 2) // [the codec will set this flag if it supports callbacks, and the vo _may_ // clear it in get_image() if draw_slice() not implemented] -#define MP_IMGFLAG_DRAW_CALLBACK 0x1000 -// set if it's in video buffer/memory: [set by vo/vf's get_image() !!!] -#define MP_IMGFLAG_DIRECT 0x2000 -// set if buffer is allocated (used in destination images): -#define MP_IMGFLAG_ALLOCATED 0x4000 +#define MP_IMGFLAG_DRAW_CALLBACK 0x01000 +#define MP_IMGFLAG_DIRECT 0x02000 // set if it's in video buffer/memory: [set by vo/vf's get_image() !!!] +#define MP_IMGFLAG_ALLOCATED 0x04000 // set if buffer is allocated (used in destination images): +#define MP_IMGFLAG_TYPE_DISPLAYED 0x08000 // buffer type was printed (do NOT set this flag - it's for INTERNAL USE!!!) +#define MP_IMGFLAG_FINAL 0x10000 // buffer is video memory +#define MP_IMGFLAG_RENDERED 0x20000 // final buffer was already painted +#define MP_IMGFLAG_FINALIZED 0x40000 // indicates final step of image processing from CPU side!!! -// buffer type was printed (do NOT set this flag - it's for INTERNAL USE!!!) -#define MP_IMGFLAG_TYPE_DISPLAYED 0x8000 -// buffer is video memory -#define MP_IMGFLAG_FINAL 0x10000 -// final buffer was already painted -#define MP_IMGFLAG_RENDERED 0x20000 -// indicates final step of image processing from CPU side!!! -#define MP_IMGFLAG_FINALIZED 0x40000 +/* codec doesn't support any form of direct rendering - it has own buffer */ +#define MP_IMGTYPE_EXPORT 0 // allocation. so we just export its buffer pointers: +#define MP_IMGTYPE_STATIC 1 // codec requires a static WO buffer, but it does only partial updates later: +#define MP_IMGTYPE_TEMP 2 // codec just needs some WO memory, where it writes/copies the whole frame to: +#define MP_IMGTYPE_IP 3 // I+P type, requires 2+ independent static R/W buffers +#define MP_IMGTYPE_IPB 4 // I+P+B type, requires 2+ independent static R/W and 1+ temp WO buffers -// codec doesn't support any form of direct rendering - it has own buffer -// allocation. so we just export its buffer pointers: -#define MP_IMGTYPE_EXPORT 0 -// codec requires a static WO buffer, but it does only partial updates later: -#define MP_IMGTYPE_STATIC 1 -// codec just needs some WO memory, where it writes/copies the whole frame to: -#define MP_IMGTYPE_TEMP 2 -// I+P type, requires 2+ independent static R/W buffers -#define MP_IMGTYPE_IP 3 -// I+P+B type, requires 2+ independent static R/W and 1+ temp WO buffers -#define MP_IMGTYPE_IPB 4 - #define MP_MAX_PLANES 4 #define MP_IMGFIELD_ORDERED 0x01 @@ -76,35 +56,38 @@ #define MP_IMGFIELD_INTERLACED 0x20 #include <stdlib.h> +#include <limits.h> +#define XP_IDX_INVALID UINT_MAX typedef struct mp_image_s { - unsigned int flags; - unsigned char type; - unsigned char bpp; // bits/pixel. NOT depth! for RGB it will be n*8 - unsigned int imgfmt; - int width,height; // stored dimensions - int x,y,w,h; // slice dimensions - unsigned char* planes[MP_MAX_PLANES]; - unsigned int stride[MP_MAX_PLANES]; - char * qscale; - int qstride; - int pict_type; // 0->unknown, 1->I, 2->P, 3->B - int fields; - int qscale_type; // 0->mpeg1/4/h263, 1->mpeg2 - int num_planes; + unsigned xp_idx; /* index of xp_frame associated with this image */ + unsigned int flags; + unsigned char type; + unsigned char bpp; // bits/pixel. NOT depth! for RGB it will be n*8 + unsigned int imgfmt; + unsigned width,height; // stored dimensions + int x,y,w,h; // slice dimensions + unsigned num_planes; + unsigned char* planes[MP_MAX_PLANES]; + unsigned int stride[MP_MAX_PLANES]; + char * qscale; + unsigned qstride; + unsigned qscale_type; // 0->mpeg1/4/h263, 1->mpeg2 + unsigned pict_type; // 0->unknown, 1->I, 2->P, 3->B + unsigned fields; /* these are only used by planar formats Y,U(Cb),V(Cr) */ - int chroma_width; - int chroma_height; - int chroma_x_shift; // horizontal - int chroma_y_shift; // vertical - /* for private use by filter or vo driver (to store buffer id or dmpi) */ - void* priv; + int chroma_width; + int chroma_height; + int chroma_x_shift; // horizontal + int chroma_y_shift; // vertical + void* priv; /* for private use by filter or vo driver (to store buffer id or dmpi) */ } mp_image_t; extern void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt); -extern mp_image_t* new_mp_image(int w,int h); +extern mp_image_t* new_mp_image(unsigned w,unsigned h,unsigned xp_idx); extern void free_mp_image(mp_image_t* mpi); -extern mp_image_t* alloc_mpi(int w, int h, unsigned int fmt); +extern mp_image_t* alloc_mpi(unsigned w, unsigned h, unsigned int fmt,unsigned xp_idx); +extern void mpi_alloc_planes(mp_image_t *mpi); extern void copy_mpi(mp_image_t *dmpi,const mp_image_t *mpi); extern void mpi_fake_slice(mp_image_t *dmpi,const mp_image_t *mpi,unsigned y,unsigned height); Modified: mplayerxp/postproc/vf.c =================================================================== --- mplayerxp/postproc/vf.c 2010-01-21 18:27:56 UTC (rev 117) +++ mplayerxp/postproc/vf.c 2010-01-22 15:41:46 UTC (rev 118) @@ -151,34 +151,36 @@ mp_image_t* __FASTCALL__ vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h){ mp_image_t* mpi=NULL; int w2=(mp_imgflag&MP_IMGFLAG_ACCEPT_ALIGNED_STRIDE)?((w+15)&(~15)):w; + unsigned xp_idx=XP_IDX_INVALID; + MSG_DBG2("vf_get_image(%s,0x%X,0x%X,0x%X,0x%X,0x%X) was called\n",vf->info->name,outfmt,mp_imgtype,mp_imgflag,w,h); if(vf->put_slice==vf_next_put_slice){ - // passthru mode, if the plugin uses the fallback/default put_image() code + MSG_DBG2("passthru mode to %s\n",vf->next->info->name); return vf_get_image(vf->next,outfmt,mp_imgtype,mp_imgflag,w,h); } // Note: we should call libvo first to check if it supports direct rendering // and if not, then fallback to software buffers: switch(mp_imgtype){ case MP_IMGTYPE_EXPORT: - if(!vf->imgctx.export_images[0]) vf->imgctx.export_images[0]=new_mp_image(w2,h); + if(!vf->imgctx.export_images[0]) vf->imgctx.export_images[0]=new_mp_image(w2,h,xp_idx); mpi=vf->imgctx.export_images[0]; break; case MP_IMGTYPE_STATIC: - if(!vf->imgctx.static_images[0]) vf->imgctx.static_images[0]=new_mp_image(w2,h); + if(!vf->imgctx.static_images[0]) vf->imgctx.static_images[0]=new_mp_image(w2,h,xp_idx); mpi=vf->imgctx.static_images[0]; break; case MP_IMGTYPE_TEMP: - if(!vf->imgctx.temp_images[0]) vf->imgctx.temp_images[0]=new_mp_image(w2,h); + if(!vf->imgctx.temp_images[0]) vf->imgctx.temp_images[0]=new_mp_image(w2,h,xp_idx); mpi=vf->imgctx.temp_images[0]; break; case MP_IMGTYPE_IPB: if(!(mp_imgflag&MP_IMGFLAG_READABLE)){ // B frame: - if(!vf->imgctx.temp_images[0]) vf->imgctx.temp_images[0]=new_mp_image(w2,h); + if(!vf->imgctx.temp_images[0]) vf->imgctx.temp_images[0]=new_mp_image(w2,h,xp_idx); mpi=vf->imgctx.temp_images[0]; break; } case MP_IMGTYPE_IP: - if(!vf->imgctx.static_images[vf->imgctx.static_idx]) vf->imgctx.static_images[vf->imgctx.static_idx]=new_mp_image(w2,h); + if(!vf->imgctx.static_images[vf->imgctx.static_idx]) vf->imgctx.static_images[vf->imgctx.static_idx]=new_mp_image(w2,h,xp_idx); mpi=vf->imgctx.static_images[vf->imgctx.static_idx]; vf->imgctx.static_idx^=1; break; @@ -190,23 +192,26 @@ mpi->flags&=MP_IMGFLAG_ALLOCATED|MP_IMGFLAG_TYPE_DISPLAYED|MP_IMGFLAGMASK_COLORS; // accept restrictions & draw_slice flags only: mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK); + MSG_DBG2("vf_get_image fills mpi structure. flags=0x%X\n",mpi->flags); if(mpi->width!=w2 || mpi->height!=h){ if(mpi->flags&MP_IMGFLAG_ALLOCATED){ if(mpi->width<w2 || mpi->height<h){ // need to re-allocate buffer memory: free(mpi->planes[0]); mpi->flags&=~MP_IMGFLAG_ALLOCATED; - MSG_V("vf.c: have to REALLOCATE buffer memory :(\n"); + MSG_DBG2("vf.c: have to REALLOCATE buffer memory :(\n"); } } mpi->width=w2; mpi->chroma_width=(w2 + (1<<mpi->chroma_x_shift) - 1)>>mpi->chroma_x_shift; mpi->height=h; mpi->chroma_height=(h + (1<<mpi->chroma_y_shift) - 1)>>mpi->chroma_y_shift; } if(!mpi->bpp) mp_image_setfmt(mpi,outfmt); + MSG_DBG2("vf_get_image setfmt. flags=0x%X\n",mpi->flags); if(!(mpi->flags&MP_IMGFLAG_ALLOCATED) && mpi->type>MP_IMGTYPE_EXPORT){ // check libvo first! if(vf->get_image) vf->get_image(vf,mpi); + MSG_DBG2("[vf->get_image] returns xp_idx=%u\n",mpi->xp_idx); if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ // non-direct and not yet allocated image. allocate it! @@ -228,35 +233,16 @@ } } } - - // IF09 - allocate space for 4. plane delta info - unused - if (mpi->imgfmt == IMGFMT_IF09) - { - mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8+ - mpi->chroma_width*mpi->chroma_height); - /* export delta table */ - mpi->planes[3]=mpi->planes[0]+(mpi->width*mpi->height)+2*(mpi->chroma_width*mpi->chroma_height); - } - else - mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8); - if(mpi->flags&MP_IMGFLAG_PLANAR){ - // YV12/I420/YVU9/IF09. feel free to add other planar formats here... - //if(!mpi->stride[0]) - mpi->stride[0]=mpi->width; - //if(!mpi->stride[1]) - mpi->stride[1]=mpi->stride[2]=mpi->chroma_width; - // YV12,I420/IYUV,YVU9,IF09 (Y,V,U) - mpi->planes[2]=mpi->planes[0]+mpi->width*mpi->height; - mpi->planes[1]=mpi->planes[2]+mpi->chroma_width*mpi->chroma_height; - } else { - //if(!mpi->stride[0]) - mpi->stride[0]=mpi->width*mpi->bpp/8; - } + + mpi_alloc_planes(mpi); // printf("clearing img!\n"); - vf_mpi_clear(mpi,0,0,mpi->width,mpi->height); - mpi->flags|=MP_IMGFLAG_ALLOCATED; +// vf_mpi_clear(mpi,0,0,mpi->width,mpi->height); } } + else { + MSG_DBG2("vf_get_image forces xp_idx retrieving\n"); + vo_get_decoding_frame_num(&mpi->xp_idx); + } if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK) if(vf->start_slice) vf->start_slice(vf,mpi); if(!(mpi->flags&MP_IMGFLAG_TYPE_DISPLAYED)){ @@ -277,6 +263,7 @@ } } + MSG_DBG2("vf_get_image returns xp_idx=%i\n",mpi->xp_idx); return mpi; } Modified: mplayerxp/postproc/vf_menu.c =================================================================== --- mplayerxp/postproc/vf_menu.c 2010-01-21 18:27:56 UTC (rev 117) +++ mplayerxp/postproc/vf_menu.c 2010-01-22 15:41:46 UTC (rev 118) @@ -172,7 +172,7 @@ pause_mpi = NULL; } if(!pause_mpi) - pause_mpi = alloc_mpi(mpi->w,mpi->h,mpi->imgfmt); + pause_mpi = alloc_mpi(mpi->w,mpi->h,mpi->imgfmt,XP_IDX_INVALID); copy_mpi(pause_mpi,mpi); mp_input_queue_cmd(mp_input_parse_cmd("pause")); go2pause = 2; Modified: mplayerxp/postproc/vf_vo.c =================================================================== --- mplayerxp/postproc/vf_vo.c 2010-01-21 18:27:56 UTC (rev 117) +++ mplayerxp/postproc/vf_vo.c 2010-01-22 15:41:46 UTC (rev 118) @@ -135,7 +135,7 @@ if(!vo_config_count) return 0; // vo not configured? if(!(mpi->flags & MP_IMGFLAG_FINAL) || (vf->sh->vfilter==vf && !(mpi->flags & MP_IMGFLAG_RENDERED))) { - MSG_DBG2("vf_vo_draw_slice was called %u %u %u %u\n",mpi->x,mpi->y,mpi->w,mpi->h); + MSG_DBG2("vf_vo_put_slice was called(%u): %u %u %u %u\n",mpi->xp_idx,mpi->x,mpi->y,mpi->w,mpi->h); vo_draw_slice(mpi); } return 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |