[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[106] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2010-01-17 19:43:08
|
Revision: 106 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=106&view=rev Author: nickols_k Date: 2010-01-17 18:46:44 +0000 (Sun, 17 Jan 2010) Log Message: ----------- slice-related fixes. -ffmpeg.noslice is sometime still required for -ffmpeg.threads>1! -core.gomp is still very experimental feature Modified Paths: -------------- etc/codecs.conf mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/vd.h mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpcodecs/vd_libmpeg2.c mplayerxp/libmpdemux/stheader.h mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/mp_image.c mplayerxp/mplayer.c mplayerxp/postproc/vf.c mplayerxp/postproc/vf_scale.c mplayerxp/postproc/vf_vo.c mplayerxp/postproc/vf_yuvcsp.c Modified: etc/codecs.conf =================================================================== --- etc/codecs.conf 2010-01-17 10:28:27 UTC (rev 105) +++ etc/codecs.conf 2010-01-17 18:46:44 UTC (rev 106) @@ -65,7 +65,7 @@ videocodec mpeg12 info "MPEG 1 or 2" comment "with postprocessing" - status buggy + status working ; for versions > 0.5 format 0x10000001 ; mpeg 1 format 0x10000002 ; mpeg 2 fourcc "DVR " Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2010-01-17 10:28:27 UTC (rev 105) +++ mplayerxp/libmpcodecs/dec_video.c 2010-01-17 18:46:44 UTC (rev 106) @@ -164,14 +164,13 @@ ,o_bps); // Yeah! We got it! sh_video->inited=1; + sh_video->vf_flags=vf_query_flags(sh_video->vfilter); #ifdef _OPENMP if(enable_gomp) { - int vf_flags; smp_num_cpus=omp_get_num_procs(); - vf_flags=vf_query_flags(sh_video->vfilter); use_vf_threads=0; - MSG_DBG2("[mpdec] vf_flags=%08X num_cpus=%u\n",vf_flags,smp_num_cpus); - if(((vf_flags&MPDEC_THREAD_COND)==MPDEC_THREAD_COND) && (smp_num_cpus>1)) use_vf_threads=1; + MSG_DBG2("[mpdec] vf_flags=%08X num_cpus=%u\n",sh_video->vf_flags,smp_num_cpus); + if(((sh_video->vf_flags&MPDEC_THREAD_COND)==MPDEC_THREAD_COND) && (smp_num_cpus>1)) use_vf_threads=1; } #else MSG_V("[mpdec] GOMP was not compiled-in! Using single threaded video filtering!\n"); @@ -181,9 +180,61 @@ return 0; } +void mpcodecs_draw_image(sh_video_t* sh,mp_image_t *mpi) +{ + vf_instance_t* vf; + const unsigned h_step=16; + unsigned num_slices = mpi->h/h_step; + vf=sh->vfilter; + if(!(mpi->flags&(MP_IMGFLAG_DRAW_CALLBACK))){ + if(mpi->h%h_step) num_slices++; + if(sh->vf_flags&VF_FLAGS_SLICES) + { + unsigned j,i,y; + mp_image_t ampi[num_slices]; + static int hello_printed=0; + if(!hello_printed) { + MSG_OK("[VC] using %u threads for video filters\n",smp_num_cpus); + hello_printed=1; + } + y=0; + for(i=0;i<num_slices;i++) { + mpi_fake_slice(&i[i],mpi,y,h_step); + y+=h_step; + } +#ifdef _OPENMP + if(use_vf_threads && (num_slices>smp_num_cpus)) { + for(j=0;j<num_slices;j+=smp_num_cpus) { +#pragma omp parallel for shared(vf) private(i) + for(i=j;i<smp_num_cpus;i++) { + MSG_DBG2("Put slice[%u %u] in threads\n",ampi[i].y,ampi[i].h); + vf->put_slice(vf,&i[i]); + } + } + for(;j<num_slices;j++) { + MSG_DBG2("Put slice[%u %u] in threads\n",ampi[j].y,h_step); + vf->put_slice(vf,&i[j]); + } + } + else +#endif + { + /* execute slices instead of whole frame make faster multiple filters */ + for(i=0;i<num_slices;i++) { + MSG_DBG2("vf(%s) Put slice[%u %u] in threads\n",vf->info->name,ampi[i].y,ampi[i].h); + vf->put_slice(vf,&i[i]); + } + } + } else { + MSG_DBG2("Put whole frame\n"); + vf->put_slice(vf,mpi); + } + } +} + extern void update_subtitle(float v_pts); int decode_video(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame, float pts){ -vf_instance_t* vf; + vf_instance_t* vf; mp_image_t *mpi=NULL; unsigned int t; unsigned int t2; @@ -193,15 +244,17 @@ t=GetTimer(); vf->control(vf,VFCTRL_START_FRAME,NULL); + +sh_video->active_slices=0; mpi=mpvdec->decode(sh_video, start, in_size, drop_frame); MSG_DBG2("decvideo: decoding video %u bytes\n",in_size); +while(sh_video->active_slices!=0) usleep(0); /* ------------------------ frame decoded. -------------------- */ - #ifdef HAVE_INT_PVECTOR _ivec_empty(); #endif - if(!mpi) return 0; // error / skipped frame +mpcodecs_draw_image(sh_video,mpi); t2=GetTimer();t=t2-t; tt = t*0.000001f; @@ -217,43 +270,6 @@ update_subtitle(pts); vo_flush_pages(); -if(!(mpi->flags&(MP_IMGFLAG_DRAW_CALLBACK))){ - MSG_DBG2("Put whole frame\n"); -#ifdef _OPENMP - if(use_vf_threads) { - unsigned i,y,h_step,h; - mp_image_t ampi[smp_num_cpus]; - static int hello_printed=0; - if(!hello_printed) { - MSG_OK("[VC] using %u threads for video filters\n",smp_num_cpus); - hello_printed=1; - } - h_step = mpi->h/smp_num_cpus; - h=mpi->height; - mpi->height=h_step; - y=0; - for(i=0;i<smp_num_cpus;i++) { - ampi[i] = *mpi; - ampi[i].y = y; - ampi[i].height = h_step; - ampi[i].chroma_height = h_step >> mpi->chroma_y_shift; - y+=h_step; - } -#pragma omp parallel for shared(vf) private(i) - for(i=0;i<smp_num_cpus;i++) { - MSG_DBG2("Put slice[%u %u] in threads\n",ampi[i].y,h_step); - vf->put_slice(vf,&i[i]); - } - if(y<h) { - ampi[0].y = y; - ampi[0].height = h - ampi[0].y; - vf->put_slice(vf,&i[0]); - } - } - else -#endif - vf->put_slice(vf,mpi); -} t2=GetTimer()-t2; tt=t2*0.000001f; vout_time_usage+=tt; Modified: mplayerxp/libmpcodecs/vd.h =================================================================== --- mplayerxp/libmpcodecs/vd.h 2010-01-17 10:28:27 UTC (rev 105) +++ mplayerxp/libmpcodecs/vd.h 2010-01-17 18:46:44 UTC (rev 106) @@ -40,5 +40,7 @@ // callbacks: int mpcodecs_config_vo(sh_video_t *sh, int w, int h, void *tune); mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag,int w, int h); -void mpcodecs_draw_slice(sh_video_t *sh, mp_image_t*); +void mpcodecs_draw_slice(sh_video_t* sh, mp_image_t*); +void mpcodecs_draw_image(sh_video_t* sh, mp_image_t *mpi); + Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =================================================================== --- mplayerxp/libmpcodecs/vd_ffmpeg.c 2010-01-17 10:28:27 UTC (rev 105) +++ mplayerxp/libmpcodecs/vd_ffmpeg.c 2010-01-17 18:46:44 UTC (rev 106) @@ -42,10 +42,10 @@ static int lavc_param_threads=-1; static char *lavc_avopt = NULL; -static int enable_ffslices=-1; +static int enable_ffslices=1; static const config_t ff_options[] = { - {"slices", &enable_ffslices, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables slice-based method of frame rendering in ffmpeg decoder"}, - {"noslices", &enable_ffslices, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables slice-based method of frame rendering in ffmpeg decoder"}, + {"slices", &enable_ffslices, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables slice-based method of frame rendering in ffmpeg decoder"}, + {"noslices", &enable_ffslices, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables slice-based method of frame rendering in ffmpeg decoder"}, {"er", &lavc_param_error_resilience, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL,"specifies error resilience for ffmpeg decoders"}, {"idct", &lavc_param_idct_algo, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL,"specifies idct algorithm for ffmpeg decoders"}, {"ec", &lavc_param_error_concealment, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL,"specifies error concealment for ffmpeg decoders"}, @@ -237,13 +237,6 @@ MSG_ERR(MSGTR_OutOfMemory); return 0; } -#ifdef HAVE_GOMP - /* Note: Slices have effect on UNI-processor machines only */ - if(enable_ffslices==-1) { - if(omp_get_num_procs()>1 && enable_gomp)enable_ffslices=0; - else enable_ffslices=1; - } -#endif #ifdef CODEC_FLAG_NOT_TRUNCATED vdff_ctx->ctx->flags|= CODEC_FLAG_NOT_TRUNCATED; @@ -360,6 +353,11 @@ #endif if(sh->bih) vdff_ctx->ctx->bits_per_coded_sample= sh->bih->biBitCount; + +#ifdef _OPENMP + /* Note: Slices have effect on UNI-processor machines only */ + if(enable_ffslices && omp_get_num_procs()>1 && enable_gomp) enable_ffslices=0; +#endif if(vdff_ctx->lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND && enable_ffslices) vdff_ctx->cap_slices=1; /* enable DR1 method */ if(vdff_ctx->lavc_codec->capabilities&CODEC_CAP_DR1) vdff_ctx->cap_dr1=1; @@ -370,6 +368,8 @@ avcodec_thread_init(vdff_ctx->ctx, lavc_param_threads); MSG_STATUS("Using %i threads in FFMPEG\n",lavc_param_threads); } + if(vdff_ctx->cap_slices) + MSG_STATUS("Trying to use slice-based rendering in FFMPEG\n"); /* open it */ rc = avcodec_open(vdff_ctx->ctx, vdff_ctx->lavc_codec); if (rc < 0) { @@ -393,13 +393,13 @@ { case IMGFMT_YV12: case IMGFMT_I420: - case IMGFMT_IYUV: pp_flags = PP_FORMAT_420; - break; + case IMGFMT_IYUV: pp_flags = PP_FORMAT_420; + break; case IMGFMT_YVYU: - case IMGFMT_YUY2: pp_flags = PP_FORMAT_422; - break; - case IMGFMT_411P: pp_flags = PP_FORMAT_411; - break; + case IMGFMT_YUY2: pp_flags = PP_FORMAT_422; + break; + case IMGFMT_411P: pp_flags = PP_FORMAT_411; + break; default: { const char *fmt; @@ -608,7 +608,13 @@ mpi->stride[1]=ls; } MSG_DBG2("ff_draw_callback %i %i %i %i\n",mpi->x,mpi->y,mpi->w,mpi->h); + pthread_mutex_lock(&sh->mutex); + sh->active_slices++; + pthread_mutex_unlock(&sh->mutex); mpcodecs_draw_slice (sh, mpi); + pthread_mutex_lock(&sh->mutex); + sh->active_slices--; + pthread_mutex_unlock(&sh->mutex); } /* copypaste from demux_real.c - it should match to get it working!*/ @@ -633,7 +639,7 @@ if(len<=0) return NULL; // skipped frame vdff_ctx->ctx->hurry_up=(flags&3)?((flags&2)?2:1):0; - if(vdff_ctx->cap_slices) vdff_ctx->use_slices=(divx_quality&&npp_options)?0:vdff_ctx->ctx->hurry_up?0:1; + if(vdff_ctx->cap_slices) vdff_ctx->use_slices= !(sh->vf_flags&VF_FLAGS_SLICES)?0:vdff_ctx->ctx->hurry_up?0:1; else vdff_ctx->use_slices=0; /* if codec is capable DR1 Modified: mplayerxp/libmpcodecs/vd_libmpeg2.c =================================================================== --- mplayerxp/libmpcodecs/vd_libmpeg2.c 2010-01-17 10:28:27 UTC (rev 105) +++ mplayerxp/libmpcodecs/vd_libmpeg2.c 2010-01-17 18:46:44 UTC (rev 106) @@ -207,7 +207,8 @@ mpi->stride[0]=w; mpi->stride[1]= mpi->stride[2]=w>>1; - mpcodecs_draw_slice(sh,mpi); + mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; + mpcodecs_draw_image(sh,mpi); } // decode a frame @@ -217,7 +218,7 @@ const mpeg2_info_t *info; int state,buf; if(len<=0) return NULL; // skipped null frame - + #if 0 // append extra 'end of frame' code: ((char*)data+len)[0]=0; Modified: mplayerxp/libmpdemux/stheader.h =================================================================== --- mplayerxp/libmpdemux/stheader.h 2010-01-17 10:28:27 UTC (rev 105) +++ mplayerxp/libmpdemux/stheader.h 2010-01-17 18:46:44 UTC (rev 106) @@ -73,9 +73,12 @@ // int coded_w,coded_h; // coded size (filled by video codec) float aspect; unsigned int outfmtidx; - + /* vfilter chan */ void *vfilter; int vfilter_inited; + int vf_flags; + pthread_mutex_t mutex; + unsigned active_slices; // unsigned int bitrate; // buffers: float num_frames; // number of frames played Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2010-01-17 10:28:27 UTC (rev 105) +++ mplayerxp/libvo/video_out.c 2010-01-17 18:46:44 UTC (rev 106) @@ -397,7 +397,7 @@ video_out->control(DRI_GET_SURFACE_CAPS,&dri_cap); dri_config(dri_cap.fourcc); /* ugly workaround of swapped BGR-fourccs. Should be removed in the future */ - if(!has_dri) + if(!has_dri) { has_dri=1; dri_cap.fourcc = bswap_32(dri_cap.fourcc); @@ -555,7 +555,7 @@ return VO_FALSE; } /* video surface is bad thing for reading */ - if(mpi->flags&MP_IMGFLAG_READABLE && (dri_cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED) + if(((mpi->flags&MP_IMGFLAG_READABLE)||(mpi->type==MP_IMGTYPE_TEMP)) && (dri_cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED) { MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL mpi->flags&MP_IMGFLAG_READABLE && (dri_cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED\n"); return VO_FALSE; @@ -674,32 +674,10 @@ return VO_TRUE; } -uint32_t __FASTCALL__ vo_draw_frame(const uint8_t *src[]) +uint32_t __FASTCALL__ vo_draw_slice(const mp_image_t *mpi) { - unsigned stride[1]; - MSG_DBG3("dri_vo_dbg: vo_draw_frame\n"); - if(image_format == IMGFMT_YV12 || image_format == IMGFMT_I420 || image_format == IMGFMT_IYUV || - image_format == IMGFMT_YVU9 || image_format == IMGFMT_IF09) - MSG_WARN("dri_vo: draw_frame for planar fourcc was called, frame cannot be written\n"); - else - if(image_format == IMGFMT_RGB32 || image_format == IMGFMT_BGR32) - stride[0] = image_width*4; - else - if(image_format == IMGFMT_RGB24 || image_format == IMGFMT_BGR24) - stride[0] = image_width*3; - else - if(image_format == IMGFMT_RGB8 || image_format == IMGFMT_BGR8) - stride[0] = image_width; - else - stride[0] = image_width*2; - return vo_draw_slice(src,stride,image_width,image_height,0,0); -} - -uint32_t __FASTCALL__ vo_draw_slice(const uint8_t *src[], unsigned stride[], - unsigned w,unsigned h,unsigned x,unsigned y) -{ - unsigned i,_w[4],_h[4]; - MSG_DBG3("dri_vo_dbg: vo_draw_slice xywh=%i %i %i %i\n",x,y,w,h); + unsigned i,_w[4],_h[4],x,y; + MSG_DBG3("dri_vo_dbg: vo_draw_slice xywh=%i %i %i %i\n",mpi->x,mpi->y,mpi->w,mpi->h); if(has_dri) { uint8_t *dst[4]; @@ -709,15 +687,17 @@ { dst[i]=dri_surf[xp_frame].planes[i]+dri_off[i]; dstStride[i]=dri_cap.strides[i]; - dst[i]+=((y*dstStride[i])*vod.y_mul[i])/vod.y_div[i]; - dst[i]+=(x*vod.x_mul[i])/vod.x_div[i]; - _w[i]=(w*vod.x_mul[i])/vod.x_div[i]; - _h[i]=(h*vod.y_mul[i])/vod.y_div[i]; - ps_src[i] = src[i] + ps_off[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]; + _w[i]=(mpi->w*vod.x_mul[i])/vod.x_div[i]; + _h[i]=(mpi->h*vod.y_mul[i])/vod.y_div[i]; + y = i?(mpi->y>>mpi->chroma_y_shift):mpi->y; + x = i?(mpi->x>>mpi->chroma_x_shift):mpi->x; + ps_src[i] = mpi->planes[i]+(y*mpi->stride[i])+x+ps_off[i]; } for(i=0;i<4;i++) - if(stride[i]) - memcpy_pic(dst[i],ps_src[i],_w[i],_h[i],dstStride[i],stride[i]); + if(mpi->stride[i]) + memcpy_pic(dst[i],ps_src[i],_w[i],_h[i],dstStride[i],mpi->stride[i]); return 0; } return -1; Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2010-01-17 10:28:27 UTC (rev 105) +++ mplayerxp/libvo/video_out.h 2010-01-17 18:46:44 UTC (rev 106) @@ -173,9 +173,8 @@ extern uint32_t __FASTCALL__ vo_set_frame_num( volatile unsigned * ); 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 uint8_t *src[]); -extern uint32_t __FASTCALL__ vo_draw_slice(const uint8_t *src[], unsigned stride[], - unsigned w,unsigned h,unsigned x,unsigned y); +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); extern void vo_draw_osd(void); Modified: mplayerxp/mp_image.c =================================================================== --- mplayerxp/mp_image.c 2010-01-17 10:28:27 UTC (rev 105) +++ mplayerxp/mp_image.c 2010-01-17 18:46:44 UTC (rev 106) @@ -211,16 +211,10 @@ } } -void mpi_fake_slice(mp_image_t *dmpi,const mp_image_t *mpi,unsigned y,unsigned height) +void mpi_fake_slice(mp_image_t *dmpi,const mp_image_t *mpi,unsigned y,unsigned h) { - unsigned uv_off = (y>>mpi->chroma_y_shift); *dmpi = *mpi; - dmpi->planes[0] = mpi->planes[0] + (mpi->stride[0]*y); - dmpi->planes[1] = mpi->planes[1] + (mpi->stride[1]*uv_off); - dmpi->planes[2] = mpi->planes[2] + (mpi->stride[2]*uv_off); - dmpi->planes[3] = mpi->planes[3] + (mpi->stride[3]*uv_off); - dmpi->qscale = mpi->qscale + (mpi->qstride*y); - dmpi->y = 0; - dmpi->h = height; - dmpi->chroma_height = (height >> mpi->chroma_y_shift); + dmpi->y = y; + dmpi->h = h; + dmpi->chroma_height = h >> mpi->chroma_y_shift; } Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2010-01-17 10:28:27 UTC (rev 105) +++ mplayerxp/mplayer.c 2010-01-17 18:46:44 UTC (rev 106) @@ -1207,8 +1207,9 @@ pinfo[xp_id].current_module=NULL; } #endif - + // DVD sub: +#if 0 if(vo_flags & 0x08){ static vo_mpegpes_t packet; static vo_mpegpes_t *pkg=&packet; @@ -1218,7 +1219,9 @@ MSG_V("\rDVD sub: len=%d v_pts=%5.3f s_pts=%5.3f \n",packet.size,v_pts,d_dvdsub->pts); vo_draw_frame(&pkg); } - }else if(vo_spudec){ + }else +#endif + if(vo_spudec){ unsigned char* packet=NULL; int len,timestamp; pinfo[xp_id].current_module="spudec"; Modified: mplayerxp/postproc/vf.c =================================================================== --- mplayerxp/postproc/vf.c 2010-01-17 10:28:27 UTC (rev 105) +++ mplayerxp/postproc/vf.c 2010-01-17 18:46:44 UTC (rev 106) @@ -151,7 +151,7 @@ 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; - + if(vf->put_slice==vf_next_put_slice){ // passthru mode, if the plugin uses the fallback/default put_image() code return vf_get_image(vf->next,outfmt,mp_imgtype,mp_imgflag,w,h); @@ -187,14 +187,10 @@ mpi->type=mp_imgtype; mpi->w=w; mpi->h=h; // keep buffer allocation status & color flags only: -// mpi->flags&=~(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE|MP_IMGFLAG_DIRECT); 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); -/* this not for mpxp because draw_slice is always present */ -// if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; if(mpi->width!=w2 || mpi->height!=h){ -// printf("vf.c: MPI parameters changed! %dx%d -> %dx%d \n", mpi->width,mpi->height,w2,h); if(mpi->flags&MP_IMGFLAG_ALLOCATED){ if(mpi->width<w2 || mpi->height<h){ // need to re-allocate buffer memory: @@ -202,11 +198,9 @@ mpi->flags&=~MP_IMGFLAG_ALLOCATED; MSG_V("vf.c: have to REALLOCATE buffer memory :(\n"); } -// } else { - } { - 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; } + 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); if(!(mpi->flags&MP_IMGFLAG_ALLOCATED) && mpi->type>MP_IMGTYPE_EXPORT){ @@ -214,32 +208,32 @@ // check libvo first! if(vf->get_image) vf->get_image(vf,mpi); - if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ - // non-direct and not yet allocated image. allocate it! - - // check if codec prefer aligned stride: + if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ + // non-direct and not yet allocated image. allocate it! + + // check if codec prefer aligned stride: if(mp_imgflag&MP_IMGFLAG_PREFER_ALIGNED_STRIDE){ int align=(mpi->flags&MP_IMGFLAG_PLANAR && mpi->flags&MP_IMGFLAG_YUV) ? (8<<mpi->chroma_x_shift)-1 : 15; // -- maybe FIXME w2=((w+align)&(~align)); if(mpi->width!=w2){ - // we have to change width... check if we CAN co it: + // we have to change width... check if we CAN co it: int flags=vf->query_format(vf,outfmt,w,h); // should not fail if(!(flags&3)) MSG_WARN("??? vf_get_image{vf->query_format(outfmt)} failed!\n"); // printf("query -> 0x%X \n",flags); if(flags&VFCAP_ACCEPT_STRIDE){ - mpi->width=w2; + mpi->width=w2; mpi->chroma_width=(w2 + (1<<mpi->chroma_x_shift) - 1)>>mpi->chroma_x_shift; } } } - + // 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); + 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); } @@ -247,9 +241,9 @@ 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]) + //if(!mpi->stride[0]) mpi->stride[0]=mpi->width; - //if(!mpi->stride[1]) + //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; @@ -283,9 +277,6 @@ } } -// printf("\rVF_MPI: %p %p %p %d %d %d \n", -// mpi->planes[0],mpi->planes[1],mpi->planes[2], -// mpi->stride[0],mpi->stride[1],mpi->stride[2]); return mpi; } Modified: mplayerxp/postproc/vf_scale.c =================================================================== --- mplayerxp/postproc/vf_scale.c 2010-01-17 10:28:27 UTC (rev 105) +++ mplayerxp/postproc/vf_scale.c 2010-01-17 18:46:44 UTC (rev 106) @@ -342,6 +342,7 @@ stride[2]=mpi->stride[2]; } } + MSG_DBG2("vf_scale.put_slice was called\n"); dmpi=vf_get_image(vf->next,vf->priv->fmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE, vf->priv->w, vf->priv->h); @@ -583,12 +584,13 @@ { NULL, 0, 0} }; #endif +/* note: sclices give unstable performance */ const vf_info_t vf_info_scale = { "software scaling", "scale", "A'rpi", "", - VF_FLAGS_THREADS|VF_FLAGS_SLICES, + VF_FLAGS_THREADS, vf_open }; @@ -598,7 +600,7 @@ "fmtcvt", "A'rpi", "", - VF_FLAGS_THREADS|VF_FLAGS_SLICES, + VF_FLAGS_THREADS, vf_open }; Modified: mplayerxp/postproc/vf_vo.c =================================================================== --- mplayerxp/postproc/vf_vo.c 2010-01-17 10:28:27 UTC (rev 105) +++ mplayerxp/postproc/vf_vo.c 2010-01-17 18:46:44 UTC (rev 106) @@ -72,6 +72,7 @@ static int __FASTCALL__ control(struct vf_instance_s* vf, int request, void* data) { + MSG_DBG2("vf_control: %u\n",request); switch(request){ case VFCTRL_CHANGE_FRAME: { @@ -118,9 +119,13 @@ mp_image_t *mpi){ int retval; unsigned i; + struct vf_priv_s *priv = vf->priv; retval=vo_get_surface(mpi); - if(retval==VO_TRUE) + if(retval==VO_TRUE) { mpi->flags |= MP_IMGFLAG_FINAL|MP_IMGFLAG_DIRECT; + MSG_DBG2("vf_vo_get_image was called successfully\n"); + } + MSG_DBG2("vf_vo_get_image was called failed\n"); } static int __FASTCALL__ put_slice(struct vf_instance_s* vf, @@ -129,7 +134,7 @@ 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); - vo_draw_slice(mpi->planes,mpi->stride,mpi->w,mpi->h,mpi->x,mpi->y); + vo_draw_slice(mpi); } return 1; } Modified: mplayerxp/postproc/vf_yuvcsp.c =================================================================== --- mplayerxp/postproc/vf_yuvcsp.c 2010-01-17 10:28:27 UTC (rev 105) +++ mplayerxp/postproc/vf_yuvcsp.c 2010-01-17 18:46:44 UTC (rev 106) @@ -47,8 +47,8 @@ cb_out = vf->dmpi->planes[1]; cr_out = vf->dmpi->planes[2]; - for (i = 0; i < mpi->height; i++) - for (j = mpi->x; j < mpi->width; j++) { + for (i = 0; i < mpi->h; i++) + for (j = mpi->x; j < mpi->w; j++) { y = i+mpi->y; x = j+mpi->x; y_out[y*vf->dmpi->stride[0]+x] = clamp_y(y_in[y*mpi->stride[0]+x]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |