From 23f688ea4e64aaa277c2e9e461379624374b2fab Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Sun, 1 Jul 2012 19:55:01 +0200 Subject: [PATCH] Motion Compensation, all implemented, all buggy --- glmocoshader.cc | 173 +++++++++++++++++++++++++++++++++++++++++------- glmocoshader.h | 1 + osdopengl.cc | 2 +- videovpeogl.cc | 32 +++++---- videovpeogl.h | 2 +- 5 files changed, 172 insertions(+), 38 deletions(-) diff --git a/glmocoshader.cc b/glmocoshader.cc index a674e0f..af5a1fb 100755 --- a/glmocoshader.cc +++ b/glmocoshader.cc @@ -25,11 +25,20 @@ #define BLOCK_SIZE 64 #define BLOCK_PER_ROW 32 +// This implementation is for framed coded pictures only! +// I did not find any DVB recording with field coded pictures +// so I do not think they exist here, anyway I suspect we +// need a totally different shader in this case +// so first write the frame coded shader +// and then later add if necessary field based support. + const GLchar moco_vertex_shader[] = "attribute vec4 block_pos;\n" "attribute vec2 block_edge;\n" "attribute vec4 block_types;\n" "attribute vec2 index;\n" + "attribute vec4 PMV1;\n" + "attribute vec4 PMV2;\n" "attribute float cbp;\n" "uniform vec2 pict_scale;\n" // "attribute vec2 tex_coord;\n" @@ -37,11 +46,17 @@ const GLchar moco_vertex_shader[] = "varying vec4 out_yblockpos_y;\n" "varying vec4 out_uvblockpos_xy;\n" "varying vec2 out_block_edge;\n" - "varying vec4 out_block_types;\n" + "varying vec4 out_misc_info;\n" "varying float out_unsupported;\n" + "varying vec4 out_moco_pos;\n" + "varying vec4 out_moco_forward;\n" + "varying vec4 out_moco_backward;\n" + "const float one=1.0;\n" + "const float czero=0.0;\n" + "const float chalf=0.5;\n" "const float c1024=1024.0;\n" "const float c32=32.0;\n" // "const float c1over32=0.03125;\n" @@ -77,10 +92,10 @@ const GLchar moco_vertex_shader[] = " float m_index=index.x/*+index.y*c65536*/-one;\n" //Not Endian save " fmod_cbp_y2+=m_index;\n" //shift to the blocks " fmod_cbp_uv2+=m_index;\n" - //" out_yblockpos_x=(mod(fmod_cbp_y2,c32));\n" - //" out_uvblockpos_xy.xy=(mod(fmod_cbp_uv2,c32));\n" - //" out_yblockpos_y=floor((fmod_cbp_y2)/c32);\n" - //" out_uvblockpos_xy.zw=floor((fmod_cbp_uv2)/c32);\n" + " out_yblockpos_x=(mod(fmod_cbp_y2,c32));\n" + " out_uvblockpos_xy.xy=(mod(fmod_cbp_uv2,c32));\n" + " out_yblockpos_y=floor((fmod_cbp_y2)/c32);\n" + " out_uvblockpos_xy.zw=floor((fmod_cbp_uv2)/c32);\n" " out_yblockpos_y=floor((fmod_cbp_y2)*c1over32);\n" " out_uvblockpos_xy.zw=floor((fmod_cbp_uv2)*c1over32);\n" @@ -93,15 +108,51 @@ const GLchar moco_vertex_shader[] = " out_yblockpos_y-=sign(fmod_cbp_y-one)*c1024;\n" " out_uvblockpos_xy.zw-=sign(fmod_cbp_uv-one)*c1024;\n" - // " if (block_types.y!=0.) {\n" - // " out_unsupported=1.;\n" - // "} else {\n" - // " out_unsupported=0.;\n" - // "}\n" + // set start positions + " vec4 motion_vertical=vec4(block_types.z,block_types.z,block_types.z,block_types.z);\n" + " vec4 mod_motion_vertical=mod(motion_vertical,y_cbp);\n" + " mod_motion_vertical=sign(vec4(mod_motion_vertical.yzw,block_types.z)-mod_motion_vertical);\n" + + " out_moco_pos.xy=(block_pos.xy+block_edge.xy)*uv_cbp.x/*16*/+one;" + " out_unsupported=czero;\n" + " out_moco_pos.zw=vec2(czero,czero);\n" + " out_misc_info.y=one;\n" // this is the y step + " if (block_types.xy_cbp.z /* 4*/) {\n" + " out_moco_pos.zw=vec2(chalf,chalf);\n" + //" out_unsupported=2.;\n" + " } else if (forward_backward>y_cbp.y /* 2*/ ) {\n" //backward + " out_moco_pos.zw=vec2(czero,one);\n" + //" out_unsupported=2.;\n" + " } else {\n" //forward + " out_moco_pos.zw=vec2(one,czero);\n" + " } \n" + " if ((out_moco_pos.w+out_moco_pos.z)>y_cbp.x) {" + " out_moco_pos.zw*=chalf;\n" + " }\n" + " if (block_types.y==y_cbp.y /*2*/) {" //Frame + " out_moco_forward=vec4(PMV1.xy,PMV1.xy);\n" + " out_moco_backward=vec4(PMV1.zw,PMV1.zw);\n" + //" out_unsupported=2.;\n" + " } else if (block_types.y==y_cbp.x /*1*/) {" //Field + " out_moco_forward=vec4(PMV1.xy,PMV2.xy);\n" + " out_moco_backward=vec4(PMV1.zw,PMV2.zw);\n" + " out_moco_forward.y+=mod_motion_vertical.x;\n" + " out_moco_backward.y+=mod_motion_vertical.y;\n" + " out_moco_forward.w-=one-mod_motion_vertical.z;\n" + " out_moco_backward.w-=one-mod_motion_vertical.w;\n" + " out_misc_info.y=one;\n" // step to for field based + // " out_unsupported=2.;\n" + " } else {\n" + " out_unsupported=1.;\n" + " }\n" + " }\n" " out_block_edge=block_edge;\n" - " out_block_types=block_types;\n" + " out_misc_info.x=block_types.w;\n" " vec4 out_pos=block_pos;\n" " out_pos.xy+=block_edge;\n" " out_pos.xy*=pict_scale;\n" @@ -115,16 +166,21 @@ const GLchar moco_frag_shader[] = "uniform sampler2D blocks;\n" "uniform sampler2D forward_pic;\n" "uniform sampler2D backward_pic;\n" + "uniform vec2 pict_size;\n" "varying vec4 out_yblockpos_x;\n" "varying vec4 out_yblockpos_y;\n" "varying vec4 out_uvblockpos_xy;\n" "varying vec2 out_block_edge;\n" - "varying vec4 out_block_types;\n" // change this we need so far only the dct type + "varying vec4 out_misc_info;\n"// misc info x= DCT info, y= field based offsets "varying float out_unsupported;\n" + "varying vec4 out_moco_forward;\n" + "varying vec4 out_moco_backward;\n" + "varying vec4 out_moco_pos;\n" "const float halfst=0.5;\n" "const float ctwo=2.0;\n" "const float cone=1.0;\n" + "const float czero=0.0;\n" "const float sieben=7.0;\n" "const float acht=8.0;\n" "const float s8=1./8.;\n" @@ -139,7 +195,7 @@ const GLchar moco_frag_shader[] = "float unpack_short(vec2 income) {\n" " float temp=income.y*c65280+income.x*c255;\n" " temp-=step(cstep,temp)*c65536;\n" - " return abs(temp/c255);\n" //temporary work around + " return temp/c255;\n" "}" // "uniform sampler2D textureV;\n" // "uniform sampler2D textureY;\n" @@ -149,9 +205,10 @@ const GLchar moco_frag_shader[] = // first figure out the block num for y, first decide between up and down, fix me field //non field code " vec4 ypos_temp1;\n" + " vec4 our_fragcol=vec4(czero,czero,czero,cone);\n" " bool upper_half;\n" " float line_step;\n" - " if (out_block_types.w!=0.) {\n" //test the dct type + " if (out_misc_info.x!=0.) {\n" //test the dct type " upper_half=mod(floor(out_block_edge.y*acht),ctwo)==cone;\n" " line_step=cone;\n" "}else{\n" @@ -190,7 +247,7 @@ const GLchar moco_frag_shader[] = " }else {\n" " ypos_temp2.xy=ypos_temp1.xy;\n" " }\n" - " gl_FragColor.r=unpack_short(ypos_temp2.rg);\n" + " our_fragcol.r=unpack_short(ypos_temp2.rg);\n" //now uv " ypos_temp3=floor(out_block_edge*acht);\n" @@ -207,7 +264,7 @@ const GLchar moco_frag_shader[] = " }else {\n" " ypos_temp2.xy=ypos_temp1.xy;\n" " }\n" - " gl_FragColor.g=unpack_short(ypos_temp2.rg);\n" + " our_fragcol.g=unpack_short(ypos_temp2.rg);\n" " ypos_temp1=texture2D(blocks,ypos_temp2.zw);\n" // now select the right data " if (subsample){\n" @@ -215,9 +272,54 @@ const GLchar moco_frag_shader[] = " }else {\n" " ypos_temp2.xy=ypos_temp1.xy;\n" " }\n" - " gl_FragColor.b=unpack_short(ypos_temp2.rg);\n" - " if (out_unsupported!=0.) {\n" - " gl_FragColor.rgb=vec3(cone,cone,0.0);\n" + " our_fragcol.b=unpack_short(ypos_temp2.rg);\n" + //MOCO + // decide if it is top or bottom + " vec4 moco_work;\n" + " if (mod(floor(out_moco_pos.y),ctwo)!=cone) {\n" + " moco_work=vec4(out_moco_forward.xy,out_moco_backward.xy);\n" + "} else {\n" + " moco_work=vec4(out_moco_forward.zw,out_moco_backward.zw);\n" + "}\n" + // now we handle the y fetching + " vec4 moco_temp;\n" + " vec4 subpixel=floor(mod(moco_work,ctwo))*halfst; \n" + " moco_temp=floor(moco_work*halfst+halfst)+floor(vec4(out_moco_pos.xy,out_moco_pos.xy));\n" + " vec4 c00,c01,c10,c11;\n" + + " c00=texture2D(forward_pic,moco_temp.xy*pict_size);\n" + " c01=texture2D(forward_pic,(moco_temp.xy+vec2(czero,out_misc_info.y))*pict_size);\n" + " c10=texture2D(forward_pic,(moco_temp.xy+vec2(cone,czero))*pict_size);\n" + " c11=texture2D(forward_pic,(moco_temp.xy+vec2(cone,out_misc_info.y))*pict_size);\n" + " our_fragcol.r+=mix(mix(c00.r,c10.r,subpixel.x),mix(c01.r,c11.r,subpixel.x),subpixel.y)*out_moco_pos.z;\n" + + + " c00=texture2D(backward_pic,moco_temp.zw*pict_size);\n"//backward + " c01=texture2D(backward_pic,(moco_temp.zw+vec2(czero,out_misc_info.y))*pict_size);\n" + " c10=texture2D(backward_pic,(moco_temp.zw+vec2(cone,czero))*pict_size);\n" + " c11=texture2D(backward_pic,(moco_temp.zw+vec2(cone,out_misc_info.y))*pict_size);\n" + " our_fragcol.r+=mix(mix(c00.r,c10.r,subpixel.z),mix(c01.r,c11.r,subpixel.z),subpixel.w)*out_moco_pos.w;\n" + // now handle UV + " subpixel=floor(mod(moco_work*halfst,ctwo))*halfst; \n" + " moco_temp=(floor(moco_work*halfst*halfst)+floor(vec4(out_moco_pos.xy,out_moco_pos.xy)*halfst))*ctwo;\n" + + " c00=texture2D(forward_pic,moco_temp.xy*pict_size);\n" + " c01=texture2D(forward_pic,(moco_temp.xy+vec2(czero,ctwo*out_misc_info.y))*pict_size);\n" + " c10=texture2D(forward_pic,(moco_temp.xy+vec2(ctwo,czero))*pict_size);\n" + " c11=texture2D(forward_pic,(moco_temp.xy+vec2(ctwo,ctwo*out_misc_info.y))*pict_size);\n" + " our_fragcol.gb+=mix(mix(c00.gb,c10.gb,subpixel.x),mix(c01.gb,c11.gb,subpixel.x),subpixel.y)*out_moco_pos.z;\n" + + " c00=texture2D(backward_pic,moco_temp.zw*pict_size);\n" + " c01=texture2D(backward_pic,(moco_temp.zw+vec2(czero,ctwo*out_misc_info.y))*pict_size);\n" + " c10=texture2D(backward_pic,(moco_temp.zw+vec2(ctwo,czero))*pict_size);\n" + " 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" @@ -259,6 +361,7 @@ int GLMocoShader::init() { blocks_loc = glGetUniformLocation(shad_program, "blocks"); forward_pic_loc = glGetUniformLocation(shad_program, "forward_pic"); backward_pic_loc = glGetUniformLocation(shad_program, "backward_pic"); + pict_size_loc = glGetUniformLocation(shad_program, "pict_size"); // frame_sampler_locY = glGetUniformLocation(shad_program, "textureY"); // Log::getInstance()->log("OSD", Log::WARN, "uniform location %x %x",frame_sampler_locY,glGetError()); @@ -349,10 +452,10 @@ int GLMocoShader::uploadDataBlocks(short* blocks,unsigned int num_blocks, XvMCMa GL_RGBA,GL_UNSIGNED_BYTE, blocks); // Log::getInstance()->log("GLMocoShader", Log::WARN, "uploadDataBlocks mark2 glerror %x",glGetError()); - glTexSubImage2D(GL_TEXTURE_2D,0,0,height+1, - (num_blocks%BLOCK_PER_ROW)>>1,1, + glTexSubImage2D(GL_TEXTURE_2D,0,0,height, + ((num_blocks%BLOCK_PER_ROW)>>1)*BLOCK_SIZE,1, GL_RGBA,GL_UNSIGNED_BYTE, - blocks); + blocks+height*BLOCK_PER_ROW*BLOCK_SIZE); //Log::getInstance()->log("GLMocoShader", Log::WARN, "uploadDataBlocks mark2 glerror %x",glGetError()); @@ -466,6 +569,8 @@ int GLMocoShader::doMoCo(VPEOGLFrame *target,VPEOGLFrame *forward,VPEOGLFrame *b glUniform2fv(loc_pict_scale,1,(const GLfloat*)&pict_scale); + const GLfloat pict_size[]={ 1./((float)target->width),1./((float)target->height)}; + glUniform2fv(pict_size_loc,1,(const GLfloat*)&pict_size); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,triangles); //Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark5 glerror %x",glGetError()); @@ -489,6 +594,14 @@ int GLMocoShader::doMoCo(VPEOGLFrame *target,VPEOGLFrame *forward,VPEOGLFrame *b glVertexAttribPointer(4, 2, GL_UNSIGNED_SHORT, GL_FALSE,sizeof(XvMCMacroBlock), (const void *) &(helperp->index)); glEnableVertexAttribArray(4); + glVertexAttribPointer(5, 4, GL_SHORT, GL_FALSE,sizeof(XvMCMacroBlock), (const void *) &(helperp->PMV[0][0][0])); + glEnableVertexAttribArray(5); + + glVertexAttribPointer(6, 4, GL_SHORT, GL_FALSE,sizeof(XvMCMacroBlock), (const void *) &(helperp->PMV[1][0][0])); + glEnableVertexAttribArray(6); + + + glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D,data_blocks); @@ -498,7 +611,9 @@ int GLMocoShader::doMoCo(VPEOGLFrame *target,VPEOGLFrame *forward,VPEOGLFrame *b glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE); + if (forward) { + Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo forward %x",forward->textures[0]); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D,forward->textures[0]); glUniform1i(forward_pic_loc,1); @@ -506,18 +621,22 @@ int GLMocoShader::doMoCo(VPEOGLFrame *target,VPEOGLFrame *forward,VPEOGLFrame *b glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE); + } if (backward) { glActiveTexture(GL_TEXTURE2); - glBindTexture(GL_TEXTURE_2D,backward->textures[1]); + Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo backward %x",backward->textures[0]); + glBindTexture(GL_TEXTURE_2D,backward->textures[0]); glUniform1i(backward_pic_loc,2); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE); + } + glDrawElements(GL_TRIANGLE_STRIP, valid_macro_blocks*6, GL_UNSIGNED_SHORT, NULL); @@ -545,6 +664,11 @@ int GLMocoShader::doMoCo(VPEOGLFrame *target,VPEOGLFrame *forward,VPEOGLFrame *b glBindBuffer(GL_ARRAY_BUFFER,0); glBindFramebuffer(GL_FRAMEBUFFER, 0); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, 0); + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, 0); + glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, 0); //Log::getInstance()->log("GLMocoShader", Log::WARN, "doMoCo mark8 glerror %x",glGetError()); } else { @@ -599,6 +723,9 @@ int GLMocoShader::BindAttributes() glBindAttribLocation(shad_program,2,"block_types"); glBindAttribLocation(shad_program,3,"cbp"); glBindAttribLocation(shad_program,4,"index"); + glBindAttribLocation(shad_program,5,"PMV1"); + glBindAttribLocation(shad_program,6,"PMV2"); + //glBindAttribLocation(shad_program,1,"tex_coord"); return 1; } diff --git a/glmocoshader.h b/glmocoshader.h index bb4eba8..66b9256 100755 --- a/glmocoshader.h +++ b/glmocoshader.h @@ -50,6 +50,7 @@ protected: GLint blocks_loc; GLint forward_pic_loc; GLint backward_pic_loc; + GLint pict_size_loc; unsigned int valid_macro_blocks; diff --git a/osdopengl.cc b/osdopengl.cc index 4784aef..b425ffc 100755 --- a/osdopengl.cc +++ b/osdopengl.cc @@ -420,7 +420,7 @@ void OsdOpenGL::threadMethod() if (!frame) frame=video->getReadyOGLFrame(); if (frame) { InternalRendering(frame); - MILLISLEEP(1500); + // MILLISLEEP(1500); lastrendertime=getTimeMS(); video->returnOGLFrame(frame); //please recycle it frame=NULL; diff --git a/videovpeogl.cc b/videovpeogl.cc index 4715ce9..3b80eaa 100755 --- a/videovpeogl.cc +++ b/videovpeogl.cc @@ -276,7 +276,7 @@ int VideoVPEOGL::AllocateYUV400OglTexture(VPEOGLFrame* outframe,int width,int he return 1; } -int VideoVPEOGL::AllocateYUV444OglTexture(VPEOGLFrame* outframe,int width,int height) +int VideoVPEOGL::AllocateYUV444OglTexture(VPEOGLFrame* outframe,int width,int height,int stride) { Log::getInstance()->log("Video", Log::NOTICE, "Allocate ogl texture 444"); // Y @@ -292,7 +292,7 @@ int VideoVPEOGL::AllocateYUV444OglTexture(VPEOGLFrame* outframe,int width,int he outframe->type=2; outframe->height=height; outframe->width=width; - outframe->stride=width; // does not make any sense otherwiese + outframe->stride=stride;// does not make any sense otherwise, just to prevent reallocating return 1; } @@ -448,7 +448,7 @@ void VideoVPEOGL::threadMethod() if (decoding_mode==VPE_NO_XVMC) { if (!AllocateYUV400OglTexture(out_frame,width,height,dec_frame_libav_uploading->linesize[0])) failed=true; } else { - if (!AllocateYUV444OglTexture(out_frame,width,height)) failed=true; //We use a YUV 444 texture in this case + if (!AllocateYUV444OglTexture(out_frame,width,height,dec_frame_libav_uploading->linesize[0])) failed=true; //We use a YUV 444 texture in this case // the shaders are easier to implement } } @@ -486,17 +486,17 @@ void VideoVPEOGL::threadMethod() Log::getInstance()->log("Video", Log::WARN, "Pictnum %d Forward %d Backward %d pict_type%d",pix_fmt->p_surface, pix_fmt->p_past_surface,pix_fmt->p_future_surface,dec_frame_libav_uploading->pict_type); - if (((int)pix_fmt->p_future_surface)!=0 && ogl_forward_ref_frame_num!=((int)pix_fmt->p_future_surface)) + if (((int)pix_fmt->p_future_surface)!=0 && ogl_backward_ref_frame_num!=((int)pix_fmt->p_future_surface)) { //Now determine the frame, that fits ogl_frame_mutex.Lock(); for (int i=0;ipict_num==((int)pix_fmt->p_future_surface)) { - ogl_backward_ref_frame=ogl_forward_ref_frame; //mpeg life time axioms - ogl_backward_ref_frame_num=ogl_forward_ref_frame_num; - ogl_forward_ref_frame=all_ogl_frames[i]; - ogl_forward_ref_frame_num=(int)pix_fmt->p_future_surface; + ogl_forward_ref_frame=ogl_backward_ref_frame; //mpeg life time axioms + ogl_forward_ref_frame_num=ogl_backward_ref_frame_num; + ogl_backward_ref_frame=all_ogl_frames[i]; + ogl_backward_ref_frame_num=(int)pix_fmt->p_future_surface; break; } } @@ -506,15 +506,15 @@ void VideoVPEOGL::threadMethod() } - if (((int)pix_fmt->p_past_surface)!=0 && ogl_backward_ref_frame_num!=((int)pix_fmt->p_past_surface)) + if (((int)pix_fmt->p_past_surface)!=0 && ogl_forward_ref_frame_num!=((int)pix_fmt->p_past_surface)) { //Now determine the frame, that fits ogl_frame_mutex.Lock(); for (int i=0;ipict_num==((int)pix_fmt->p_past_surface)) { - ogl_backward_ref_frame=all_ogl_frames[i]; - ogl_backward_ref_frame_num=(int)pix_fmt->p_past_surface; // This should not happen, or for DMV, who knows + ogl_forward_ref_frame=all_ogl_frames[i]; + ogl_forward_ref_frame_num=(int)pix_fmt->p_past_surface; // This should not happen, or for DMV, who knows break; } } @@ -533,7 +533,9 @@ void VideoVPEOGL::threadMethod() } out_frame->pict_num=((VPE_FrameBuf*)dec_frame_libav_uploading->base[0])->pict_num; - moco_shader->doMoCo(out_frame,ogl_forward_ref_frame,ogl_backward_ref_frame); + + 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); // Excute motion compensation } @@ -1551,7 +1553,11 @@ enum PixelFormat VideoVPEOGL::get_format_libav(struct AVCodecContext *s, const e void VideoVPEOGL::draw_horiz_band_libav(struct AVCodecContext *s, const AVFrame *src, int offset[4], int y, int type, int height) { if ((y+height)==src->height) { - //Log::getInstance()->log("Video", Log::NOTICE, "draw_horiz_band %d %d %d %d!",y,type,height,((xvmc_pix_fmt *)src->data[2])->p_surface); + /* Log::getInstance()->log("Video", Log::NOTICE, "draw_horiz_band %d %d %d %d %d!",y,type,height,((xvmc_pix_fmt *)src->data[2])->p_surface, + ((xvmc_pix_fmt *)src->data[2])->picture_structure);*/ + if (((xvmc_pix_fmt *)src->data[2])->picture_structure!=3) { + Log::getInstance()->log("Video", Log::ERR, "Non frame pict supported! Yet! Please send sample to authors!"); exit(0); + } ((VideoVPEOGL*)Video::getInstance())->add_dec_frame_upload_only(s,src); } diff --git a/videovpeogl.h b/videovpeogl.h index 3d72ae7..4357df2 100755 --- a/videovpeogl.h +++ b/videovpeogl.h @@ -332,7 +332,7 @@ class VideoVPEOGL : public Video, public Thread_TYPE Mutex ogl_frame_mutex; int AllocateYUV400OglTexture(VPEOGLFrame* outframe,int width,int height,int stride); - int AllocateYUV444OglTexture(VPEOGLFrame* outframe,int width,int height); + int AllocateYUV444OglTexture(VPEOGLFrame* outframe,int width,int height,int stride); virtual void threadMethod(); virtual void threadPostStopCleanup(); -- 2.39.5