dec_frame_libav_uploading=NULL;
dec_frame_libav_decoding=NULL;
ogl_frame_outside=false;
- decoding_mode=VPE_NO_XVMC;
- //decoding_mode=VPE_XVMC_MOCOMP;
+ //decoding_mode=VPE_NO_XVMC;
+ decoding_mode=VPE_XVMC_MOCOMP;
+ framebuf_framenum=0;
#endif
#ifdef BENCHMARK_FPS
unsigned int want_sizes[4]={0,0,0,0};
AVPicture pict;
bool normal_pixs=false;
+ int num_blocks=0;
+ int num_dct_blocks=0;
+
int s_a[4];
//reget logic from mplayer
if (pic->opaque && pic->data[0] && (!pic->buffer_hints ||pic->buffer_hints & FF_BUFFER_HINTS_REUSABLE )){
}
} else {
- //TODE set linesizes!
- Log::getInstance()->log("Video", Log::ERR, "Not implemented");
- return -1;
+ //TODO set linesizes!
+
+ num_blocks=((c->width+15)/16)*((c->height+15)/16);
+ num_dct_blocks=num_blocks*6; //6 blocks per macroblock
+
+ want_sizes[2]=sizeof(xvmc_pix_fmt);
+ want_sizes[1]=sizeof(short)*num_dct_blocks*8*8;
+ want_sizes[0]=sizeof(XvMCMacroBlock)*num_blocks;
+ pict.linesize[0]=pict.linesize[1]=pict.linesize[2]=pict.linesize[3]=0;
}
VPE_FrameBuf *frame_buf=((VideoVPEOGL*)Video::getInstance())->getFrameBuf(want_sizes);
+
//Log::getInstance()->log("Video", Log::NOTICE, "get buffer %x",frame_buf);
if (!frame_buf) {
Log::getInstance()->log("Video", Log::ERR, "Getting buffer libav failed");
return -1;
}
+
+
//populate pict
pic->type=FF_BUFFER_TYPE_USER; // we are controlling the buffers
int hchr_shift,vchr_shift;
pic->sample_aspect_ratio=c->sample_aspect_ratio;
pic->reordered_opaque= c->reordered_opaque;
pic->age=INT_MAX;
+ if (!normal_pixs) {
+ xvmc_pix_fmt *pix_xvmc=(xvmc_pix_fmt *)pic->data[2];
+ pix_xvmc->xvmc_id=AV_XVMC_ID;
+ pix_xvmc->data_blocks=(short*)pic->data[1];
+ pix_xvmc->mv_blocks=(XvMCMacroBlock*)pic->data[0];
+ pix_xvmc->allocated_mv_blocks=num_blocks;
+ pix_xvmc->allocated_data_blocks=num_dct_blocks;
+ if (c->pix_fmt==PIX_FMT_XVMC_MPEG2_IDCT) pix_xvmc->idct=1;
+ else pix_xvmc->idct=0;
+ pix_xvmc->unsigned_intra=0; // let see what happens
+ pix_xvmc->p_surface=(XvMCSurface*)frame_buf->pict_num;
+ pix_xvmc->start_mv_blocks_num=0;
+ pix_xvmc->filled_mv_blocks_num=0;
+ pix_xvmc->next_free_data_block_num=0;
+ //that is all folks
+
+
+ }
return 0;
current->size[x]=size[x];
}
}
+ framebuf_framenum++;
+ current->pict_num=framebuf_framenum; //This is used for tracking reference frames through the conversion pipeline
return current;
}
extern "C" {\r
\r
#include <libavcodec/avcodec.h>\r
+#include <libavcodec/xvmc.h>\r
#include <libavformat/avformat.h>\r
#include <libavutil/imgutils.h>\r
}\r
{ //This is a frame bulibaver, nothing fancy just plain memory\r
void *data[4];\r
unsigned int size[4];\r
+ unsigned int pict_num;\r
};\r
\r
#endif\r
void lockFrameBufUpload(VPE_FrameBuf* data);\r
void releaseFrameBufUpload(VPE_FrameBuf* data);\r
\r
+ unsigned int framebuf_framenum;\r
+\r
Mutex vpe_framebuf_mutex;\r
\r
\r