connet
24th June 2005, 10:37
dear sirs, I'm using xvid 1.x, video are encoded on linux, and play on windows, I found can only decode less than 320*240 on windows, larger video will get strange image on windows, no error. and If I decode it on linux , it ok.
but if I save the video as AVI( XVID ), mediaplayer can play it ok, so, it seem that the problem is in xvidcore.dll or my decode api. xvidcore.dll is campiled by vc6.0.
any suggestion , or need adjust some parameter?
thanks.
void *dec_init(int use_assembler, int width, int height)
{
int ret;
PDECODE_INFO pdecode_info;
xvid_gbl_init_t xvid_gbl_init;
xvid_dec_create_t xvid_dec_create;
xvid_gbl_init.version = XVID_VERSION;
if(use_assembler)
#ifdef ARCH_IS_IA64
xvid_gbl_init.cpu_flags = XVID_CPU_FORCE | XVID_CPU_IA64;
#else
xvid_gbl_init.cpu_flags = 0;
#endif
else
xvid_gbl_init.cpu_flags = XVID_CPU_FORCE;
xvid_global(NULL, 0, &xvid_gbl_init, NULL);
/*------------------------------------------------------------------------
* XviD encoder initialization
*----------------------------------------------------------------------*/
/* Version */
xvid_dec_create.version = XVID_VERSION;
xvid_dec_create.width = 0;
xvid_dec_create.height = 0;
ret = xvid_decore(NULL, XVID_DEC_CREATE, &xvid_dec_create, NULL);
if (ret<0)
return NULL;
pdecode_info = (PDECODE_INFO)calloc(sizeof(DECODE_INFO), 1);
pdecode_info->handle = xvid_dec_create.handle;
return pdecode_info;
}
// I only output RGB24.
int dec_main(void *dec_handle, unsigned char *istream,
unsigned char *ostream,
int istream_size,
int *ostream_size, int color_space, int *width, int *height)
{
int ret;
char msg[256];
PDECODE_INFO pdecode_info = (PDECODE_INFO)dec_handle;
if (pdecode_info==NULL)
return 0;
// xvid_dec_stats_t xvid_dec_stats;
/* Set version */
pdecode_info->xvid_dec_frame.version = XVID_VERSION;
pdecode_info->xvid_dec_stats.version = XVID_VERSION;
/* No general flags to set */
pdecode_info->xvid_dec_frame.general = 0;
/* Input stream */
pdecode_info->xvid_dec_frame.bitstream = istream;
pdecode_info->xvid_dec_frame.length = istream_size;
/* Output frame structure */
pdecode_info->xvid_dec_frame.output.plane[0] = ostream;
pdecode_info->xvid_dec_frame.output.csp = color_space;
pdecode_info->xvid_dec_frame.output.stride[0] = *width*3;
// Application->MessageBox("dec_main", IntToStr(pdecode_info->xvid_dec_frame.output.stride[0]).c_str(), MB_OK);
ret = xvid_decore(pdecode_info->handle, XVID_DEC_DECODE, &(pdecode_info->xvid_dec_frame), &(pdecode_info->xvid_dec_stats));
*ostream_size = pdecode_info->xvid_dec_frame.length;
sprintf(msg,"istream_size=%d, *ostream_size=%d ", istream_size, *ostream_size);
// SuperEyeMain->DebugMsg(msg);
sprintf(msg,"ret=%d, pdecode_info->xvid_dec_stats.type=%d\n", ret, pdecode_info->xvid_dec_stats.type);
// SuperEyeMain->DebugMsg(msg);
if ( (ret>0) && (XVID_TYPE_VOL==pdecode_info->xvid_dec_stats.type) ) /* resize ? */
{
#if 1
pdecode_info->xvid_dec_frame.output.plane[0] = ostream;
pdecode_info->xvid_dec_frame.output.stride[0] = pdecode_info->xvid_dec_stats.data.vol.width*3;
pdecode_info->xvid_dec_frame.output.csp = color_space;
*width = pdecode_info->xvid_dec_stats.data.vol.width;
*height= pdecode_info->xvid_dec_stats.data.vol.height;
sprintf(msg, "reset width=%d height=%d \n", *width, *height );
// SuperEyeMain->DebugMsg(msg);
#endif
pdecode_info->xvid_dec_frame.bitstream = istream+ret;
pdecode_info->xvid_dec_frame.length = istream_size-ret;
ret = xvid_decore(pdecode_info->handle, XVID_DEC_DECODE, &(pdecode_info->xvid_dec_frame), &(pdecode_info->xvid_dec_stats));
}
return ret;
}
int dec_stop(void *dec_handle)
{
int ret;
PDECODE_INFO pdecode_info = (PDECODE_INFO)dec_handle;
if (pdecode_info==NULL)
return 0;
ret = xvid_decore(pdecode_info->handle, XVID_DEC_DESTROY, NULL, NULL);
return(ret);
}
but if I save the video as AVI( XVID ), mediaplayer can play it ok, so, it seem that the problem is in xvidcore.dll or my decode api. xvidcore.dll is campiled by vc6.0.
any suggestion , or need adjust some parameter?
thanks.
void *dec_init(int use_assembler, int width, int height)
{
int ret;
PDECODE_INFO pdecode_info;
xvid_gbl_init_t xvid_gbl_init;
xvid_dec_create_t xvid_dec_create;
xvid_gbl_init.version = XVID_VERSION;
if(use_assembler)
#ifdef ARCH_IS_IA64
xvid_gbl_init.cpu_flags = XVID_CPU_FORCE | XVID_CPU_IA64;
#else
xvid_gbl_init.cpu_flags = 0;
#endif
else
xvid_gbl_init.cpu_flags = XVID_CPU_FORCE;
xvid_global(NULL, 0, &xvid_gbl_init, NULL);
/*------------------------------------------------------------------------
* XviD encoder initialization
*----------------------------------------------------------------------*/
/* Version */
xvid_dec_create.version = XVID_VERSION;
xvid_dec_create.width = 0;
xvid_dec_create.height = 0;
ret = xvid_decore(NULL, XVID_DEC_CREATE, &xvid_dec_create, NULL);
if (ret<0)
return NULL;
pdecode_info = (PDECODE_INFO)calloc(sizeof(DECODE_INFO), 1);
pdecode_info->handle = xvid_dec_create.handle;
return pdecode_info;
}
// I only output RGB24.
int dec_main(void *dec_handle, unsigned char *istream,
unsigned char *ostream,
int istream_size,
int *ostream_size, int color_space, int *width, int *height)
{
int ret;
char msg[256];
PDECODE_INFO pdecode_info = (PDECODE_INFO)dec_handle;
if (pdecode_info==NULL)
return 0;
// xvid_dec_stats_t xvid_dec_stats;
/* Set version */
pdecode_info->xvid_dec_frame.version = XVID_VERSION;
pdecode_info->xvid_dec_stats.version = XVID_VERSION;
/* No general flags to set */
pdecode_info->xvid_dec_frame.general = 0;
/* Input stream */
pdecode_info->xvid_dec_frame.bitstream = istream;
pdecode_info->xvid_dec_frame.length = istream_size;
/* Output frame structure */
pdecode_info->xvid_dec_frame.output.plane[0] = ostream;
pdecode_info->xvid_dec_frame.output.csp = color_space;
pdecode_info->xvid_dec_frame.output.stride[0] = *width*3;
// Application->MessageBox("dec_main", IntToStr(pdecode_info->xvid_dec_frame.output.stride[0]).c_str(), MB_OK);
ret = xvid_decore(pdecode_info->handle, XVID_DEC_DECODE, &(pdecode_info->xvid_dec_frame), &(pdecode_info->xvid_dec_stats));
*ostream_size = pdecode_info->xvid_dec_frame.length;
sprintf(msg,"istream_size=%d, *ostream_size=%d ", istream_size, *ostream_size);
// SuperEyeMain->DebugMsg(msg);
sprintf(msg,"ret=%d, pdecode_info->xvid_dec_stats.type=%d\n", ret, pdecode_info->xvid_dec_stats.type);
// SuperEyeMain->DebugMsg(msg);
if ( (ret>0) && (XVID_TYPE_VOL==pdecode_info->xvid_dec_stats.type) ) /* resize ? */
{
#if 1
pdecode_info->xvid_dec_frame.output.plane[0] = ostream;
pdecode_info->xvid_dec_frame.output.stride[0] = pdecode_info->xvid_dec_stats.data.vol.width*3;
pdecode_info->xvid_dec_frame.output.csp = color_space;
*width = pdecode_info->xvid_dec_stats.data.vol.width;
*height= pdecode_info->xvid_dec_stats.data.vol.height;
sprintf(msg, "reset width=%d height=%d \n", *width, *height );
// SuperEyeMain->DebugMsg(msg);
#endif
pdecode_info->xvid_dec_frame.bitstream = istream+ret;
pdecode_info->xvid_dec_frame.length = istream_size-ret;
ret = xvid_decore(pdecode_info->handle, XVID_DEC_DECODE, &(pdecode_info->xvid_dec_frame), &(pdecode_info->xvid_dec_stats));
}
return ret;
}
int dec_stop(void *dec_handle)
{
int ret;
PDECODE_INFO pdecode_info = (PDECODE_INFO)dec_handle;
if (pdecode_info==NULL)
return 0;
ret = xvid_decore(pdecode_info->handle, XVID_DEC_DESTROY, NULL, NULL);
return(ret);
}