From 3340283ffc2b2a8d7f39b9ef9a5be761a6cac485 Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Sun, 8 Jul 2012 18:02:59 +0200 Subject: [PATCH] Now mocomp in color --- glmocoshader.cc | 42 ++++++++++++++++++++++-------------------- osdopengl.cc | 2 +- videovpeogl.cc | 15 +++++++++++++++ videovpeogl.h | 2 ++ 4 files changed, 40 insertions(+), 21 deletions(-) diff --git a/glmocoshader.cc b/glmocoshader.cc index cbeabce..11df477 100755 --- a/glmocoshader.cc +++ b/glmocoshader.cc @@ -300,7 +300,7 @@ const GLchar moco_frag_shader[] = " line_step=ctwo;\n" "}\n" " if (upper_half) {\n" - " ypos_temp1=vec4(out_yblockpos_x.z,out_yblockpos_y.z,out_yblockpos_x.w,out_yblockpos_y.w);\n" + " ypos_temp1=vec4(out_yblockpos_x.z,out_yblockpos_y.z,out_yblockpos_x.w,out_yblockpos_y.w);\n" " } else {\n" " ypos_temp1=vec4(out_yblockpos_x.x,out_yblockpos_y.x,out_yblockpos_x.y,out_yblockpos_y.y);\n" " }\n" @@ -326,37 +326,38 @@ const GLchar moco_frag_shader[] = " ypos_temp2.xy*=c1over1024;\n" " ypos_temp1=texture2D(blocks,ypos_temp2.xy);\n" // now select the right data "if (subsample){\n" - " ypos_temp2.xy=ypos_temp1.zw;\n" + " ypos_temp3.xy=ypos_temp1.zw;\n" //" ypos_temp2=vec2(cone,0.);\n" " }else {\n" - " ypos_temp2.xy=ypos_temp1.xy;\n" + " ypos_temp3.xy=ypos_temp1.xy;\n" " }\n" - " our_fragcol.r=unpack_short(ypos_temp2.rg);\n" + " our_fragcol.r=unpack_short(ypos_temp3.xy);\n" //now uv " ypos_temp3=floor(out_block_edge*acht);\n" " ypos_temp2.yw=floor(out_uvblockpos_xy.zw);\n" " ypos_temp2.xz=(ypos_temp3.x+(ypos_temp3.y+acht*(out_uvblockpos_xy.xy))*acht);\n" - //" bool subsample=(mod(ypos_temp2.x,ctwo)>halfst);\n" + //" subsample=(mod(ypos_temp2.x,ctwo)>halfst);\n" " subsample=mod(ypos_temp3.x,ctwo)==cone;\n" " ypos_temp2.xz*=halfst;\n" " ypos_temp2*=c1over1024;\n" " ypos_temp1=texture2D(blocks,ypos_temp2.xy);\n" // now select the right data " if (subsample){\n" - " ypos_temp2.xy=ypos_temp1.zw;\n" + " ypos_temp3.xy=ypos_temp1.zw;\n" " }else {\n" - " ypos_temp2.xy=ypos_temp1.xy;\n" + " ypos_temp3.xy=ypos_temp1.xy;\n" " }\n" - " our_fragcol.g=unpack_short(ypos_temp2.rg);\n" + " our_fragcol.g=unpack_short(ypos_temp3.xy);\n" " ypos_temp1=texture2D(blocks,ypos_temp2.zw);\n" // now select the right data - " if (subsample){\n" - " ypos_temp2.xy=ypos_temp1.zw;\n" - " }else {\n" - " ypos_temp2.xy=ypos_temp1.xy;\n" - " }\n" - " our_fragcol.b=unpack_short(ypos_temp2.rg);\n" + //" if (subsample){\n" + " ypos_temp3.xy=ypos_temp1.zw;\n" + //" }else {\n" + " ypos_temp3.xy=ypos_temp1.xy;\n" + //" }\n" + " our_fragcol.b=unpack_short(ypos_temp3.rg);\n" + //MOCO // decide if it is top or bottom " vec4 moco_work;\n" @@ -399,12 +400,13 @@ const GLchar moco_frag_shader[] = " c11=texture2D(backward_pic,(moco_temp.zw+vec2(ctwo,ctwo*out_misc_info.y))*pict_size);\n" " our_fragcol.gb+=mix(mix(c00.gb,c10.gb,subpixel.z),mix(c01.gb,c11.gb,subpixel.z),subpixel.w)*out_moco_pos.w;\n" - " gl_FragColor.rgb=vec3(our_fragcol.r,halfst,halfst);\n" - " if (out_unsupported==1.) {\n" - " gl_FragColor.gb=vec2(cone,0.0);\n" - "}else if (out_unsupported==2.) {\n" - " gl_FragColor.gb=vec2(0.0,cone);\n" - "}\n" + " gl_FragColor.rgb=our_fragcol.rgb;\n" +// " gl_FragColor.rgb=vec3(our_fragcol.r,halfst,halfst);\n" +// " if (out_unsupported==1.) {\n" +// " gl_FragColor.gb=vec2(cone,0.0);\n" +// "}else if (out_unsupported==2.) {\n" +// " gl_FragColor.gb=vec2(0.0,cone);\n" +// "}\n" //" ypos_temp2=mix(ypos_temp1.rg,ypos_temp1.ba,step(c1over2047,mod(ypos_temp2.x,c1over1023)));\n" //activate this diff --git a/osdopengl.cc b/osdopengl.cc index 9ba5a4e..f0bc96b 100755 --- a/osdopengl.cc +++ b/osdopengl.cc @@ -420,7 +420,7 @@ void OsdOpenGL::threadMethod() if (!frame) frame=video->getReadyOGLFrame(); if (frame) { InternalRendering(frame); - //MILLISLEEP(1000); + // MILLISLEEP(1000); lastrendertime=getTimeMS(); video->returnOGLFrame(frame); //please recycle it frame=NULL; diff --git a/videovpeogl.cc b/videovpeogl.cc index 2e24791..9351e9d 100755 --- a/videovpeogl.cc +++ b/videovpeogl.cc @@ -62,6 +62,8 @@ VideoVPEOGL::VideoVPEOGL() #ifdef BENCHMARK_FPS time_in_decoder=0; num_frames=0; + time_in_decoder_gl=0; + num_frames_gl=0; #endif } @@ -527,6 +529,9 @@ void VideoVPEOGL::threadMethod() xvmc_pix_fmt * pix_fmt=(xvmc_pix_fmt *)dec_frame_libav_uploading_framebuf->data[2]; if (moco_shader && pix_fmt) { +#ifdef BENCHMARK_FPS + int cur_time=getTimeMS(); +#endif moco_shader->uploadDataBlocks(pix_fmt->data_blocks,pix_fmt->next_free_data_block_num, pix_fmt->mv_blocks , pix_fmt->filled_mv_blocks_num ); // Log::getInstance()->log("Video", Log::WARN, "Pictnum %d Forward %d Backward %d ",pix_fmt->p_surface, @@ -604,6 +609,16 @@ void VideoVPEOGL::threadMethod() moco_shader->doMoCo(out_frame,(((int)pix_fmt->p_past_surface)!=0)? ogl_forward_ref_frame:NULL, (((int)pix_fmt->p_future_surface)!=0)? ogl_backward_ref_frame:NULL); +#ifdef BENCHMARK_FPS + time_in_decoder_gl+=getTimeMS()-cur_time; + num_frames_gl++; + if ((num_frames_gl%100)==0) { + float fps=1000./(float)(time_in_decoder_gl); + fps*=((float)num_frames_gl); + Log::getInstance()->log("Video", Log::NOTICE, "Current GL Decoding FPS %g", fps); + } +#endif + //Log::getInstance()->log("Video", Log::WARN, "Pictnum mark4"); // Excute motion compensation } else { diff --git a/videovpeogl.h b/videovpeogl.h index f76c5c2..bcee749 100755 --- a/videovpeogl.h +++ b/videovpeogl.h @@ -352,6 +352,8 @@ class VideoVPEOGL : public Video, public Thread_TYPE #ifdef BENCHMARK_FPS unsigned int time_in_decoder; unsigned int num_frames; + unsigned int time_in_decoder_gl; + unsigned int num_frames_gl; #endif -- 2.39.2