Now mocomp in color
authorMarten Richter <marten.richter@freenet.de>
Sun, 8 Jul 2012 16:02:59 +0000 (18:02 +0200)
committerMarten Richter <marten.richter@freenet.de>
Sun, 8 Jul 2012 16:02:59 +0000 (18:02 +0200)
glmocoshader.cc
osdopengl.cc
videovpeogl.cc
videovpeogl.h

index cbeabce5a217fddd3c6dbe6fca02f91e7aa59e3e..11df477e35cb2c7860be0681b64e49358923f2a6 100755 (executable)
@@ -300,7 +300,7 @@ const GLchar moco_frag_shader[] =
                "  line_step=ctwo;\n"\r
                "}\n"\r
                " if (upper_half) {\n"\r
-               "  ypos_temp1=vec4(out_yblockpos_x.z,out_yblockpos_y.z,out_yblockpos_x.w,out_yblockpos_y.w);\n"\r
+               "    ypos_temp1=vec4(out_yblockpos_x.z,out_yblockpos_y.z,out_yblockpos_x.w,out_yblockpos_y.w);\n"\r
                "  } else {\n"\r
                "    ypos_temp1=vec4(out_yblockpos_x.x,out_yblockpos_y.x,out_yblockpos_x.y,out_yblockpos_y.y);\n"\r
                " }\n"\r
@@ -326,37 +326,38 @@ const GLchar moco_frag_shader[] =
                " ypos_temp2.xy*=c1over1024;\n"\r
                " ypos_temp1=texture2D(blocks,ypos_temp2.xy);\n" // now select the right data\r
                "if (subsample){\n"\r
-               "  ypos_temp2.xy=ypos_temp1.zw;\n"\r
+               "  ypos_temp3.xy=ypos_temp1.zw;\n"\r
                //"  ypos_temp2=vec2(cone,0.);\n"\r
                " }else {\n"\r
-               "  ypos_temp2.xy=ypos_temp1.xy;\n"\r
+               "  ypos_temp3.xy=ypos_temp1.xy;\n"\r
                " }\n"\r
-               " our_fragcol.r=unpack_short(ypos_temp2.rg);\n"\r
+               " our_fragcol.r=unpack_short(ypos_temp3.xy);\n"\r
 \r
                //now uv\r
                " ypos_temp3=floor(out_block_edge*acht);\n"\r
                " ypos_temp2.yw=floor(out_uvblockpos_xy.zw);\n"\r
                " ypos_temp2.xz=(ypos_temp3.x+(ypos_temp3.y+acht*(out_uvblockpos_xy.xy))*acht);\n"\r
-                               //" bool subsample=(mod(ypos_temp2.x,ctwo)>halfst);\n"\r
+               //" subsample=(mod(ypos_temp2.x,ctwo)>halfst);\n"\r
                " subsample=mod(ypos_temp3.x,ctwo)==cone;\n"\r
                " ypos_temp2.xz*=halfst;\n"\r
                " ypos_temp2*=c1over1024;\n"\r
 \r
                " ypos_temp1=texture2D(blocks,ypos_temp2.xy);\n" // now select the right data\r
                " if (subsample){\n"\r
-               "  ypos_temp2.xy=ypos_temp1.zw;\n"\r
+               "  ypos_temp3.xy=ypos_temp1.zw;\n"\r
                " }else {\n"\r
-               "  ypos_temp2.xy=ypos_temp1.xy;\n"\r
+               "  ypos_temp3.xy=ypos_temp1.xy;\n"\r
                " }\n"\r
-               " our_fragcol.g=unpack_short(ypos_temp2.rg);\n"\r
+               " our_fragcol.g=unpack_short(ypos_temp3.xy);\n"\r
 \r
                " ypos_temp1=texture2D(blocks,ypos_temp2.zw);\n" // now select the right data\r
-               " if (subsample){\n"\r
-               "  ypos_temp2.xy=ypos_temp1.zw;\n"\r
-               " }else {\n"\r
-               "  ypos_temp2.xy=ypos_temp1.xy;\n"\r
-               " }\n"\r
-               " our_fragcol.b=unpack_short(ypos_temp2.rg);\n"\r
+               //" if (subsample){\n"\r
+               "  ypos_temp3.xy=ypos_temp1.zw;\n"\r
+               //" }else {\n"\r
+               "  ypos_temp3.xy=ypos_temp1.xy;\n"\r
+               //" }\n"\r
+               " our_fragcol.b=unpack_short(ypos_temp3.rg);\n"\r
+\r
                //MOCO\r
                // decide if it is top or bottom\r
                " vec4 moco_work;\n"\r
@@ -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"\r
                " 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"\r
 \r
-               "  gl_FragColor.rgb=vec3(our_fragcol.r,halfst,halfst);\n"\r
-               " if (out_unsupported==1.) {\n"\r
-               "    gl_FragColor.gb=vec2(cone,0.0);\n"\r
-               "}else if (out_unsupported==2.) {\n"\r
-               "    gl_FragColor.gb=vec2(0.0,cone);\n"\r
-               "}\n"\r
+               "  gl_FragColor.rgb=our_fragcol.rgb;\n"\r
+//             "  gl_FragColor.rgb=vec3(our_fragcol.r,halfst,halfst);\n"\r
+//             " if (out_unsupported==1.) {\n"\r
+//             "    gl_FragColor.gb=vec2(cone,0.0);\n"\r
+//             "}else if (out_unsupported==2.) {\n"\r
+//             "    gl_FragColor.gb=vec2(0.0,cone);\n"\r
+//             "}\n"\r
 \r
 \r
                //" ypos_temp2=mix(ypos_temp1.rg,ypos_temp1.ba,step(c1over2047,mod(ypos_temp2.x,c1over1023)));\n" //activate this\r
index 9ba5a4e3d91df653f7bae1712b38f0a01135dc66..f0bc96b4ce67f524b552239bb0a1ddc712019b4f 100755 (executable)
@@ -420,7 +420,7 @@ void OsdOpenGL::threadMethod()
                        if (!frame) frame=video->getReadyOGLFrame();\r
                        if (frame) {\r
                                InternalRendering(frame);\r
-                               //MILLISLEEP(1000);\r
+                       //      MILLISLEEP(1000);\r
                                lastrendertime=getTimeMS();\r
                                video->returnOGLFrame(frame); //please recycle it\r
                                frame=NULL;\r
index 2e24791a027bfd38013e49069a01cab4586ebdca..9351e9d67d25f9ceb1eca781657bf571cf5d2de8 100755 (executable)
@@ -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 {
index f76c5c2354f6a4fdd2d4a3a36a504bdc6115d5d6..bcee74956e3c9525e1122ca4457d9420728f908f 100755 (executable)
@@ -352,6 +352,8 @@ class VideoVPEOGL : public Video, public Thread_TYPE
 #ifdef BENCHMARK_FPS\r
        unsigned int time_in_decoder;\r
        unsigned int num_frames;\r
+       unsigned int time_in_decoder_gl;\r
+       unsigned int num_frames_gl;\r
 #endif\r
 \r
     \r