本文整理汇总了C++中xvid_encore函数的典型用法代码示例。如果您正苦于以下问题:C++ xvid_encore函数的具体用法?C++ xvid_encore怎么用?C++ xvid_encore使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xvid_encore函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mpeg4_stop
static void mpeg4_stop( struct mpeg4_encoder *en )
{
spook_log( SL_DEBUG, "mpeg4: destroying mpeg4 encoder" );
xvid_encore( en->xvid_handle, XVID_ENC_DESTROY, NULL, NULL );
en->xvid_handle = NULL;
}
示例2: FFV1_XvidInit
int FFV1_XvidInit(v4linfo *info)
{
int err;
printf("Initializing Xvid with width =%d, height = %d in YUV420P format\n",info->width,info->height);
XVID_INIT_PARAM xinit;
memset(&xinit,0,sizeof(xinit));
memset(&fr, 0, sizeof(fr));
xinit.cpu_flags = XVID_CPU_MMX;
xvid_init(NULL, 0, &xinit, NULL);
xparam.fincr = 1000;
if(info->ntsc)
xparam.fbase =29970;
else
xparam.fbase =25000;
xparam.width = info->width;
xparam.height = info->height;
xparam.min_quantizer = info->quality;
xparam.max_quantizer = info->quality;
xparam.max_key_interval = info->keydist;
err = xvid_encore(NULL, XVID_ENC_CREATE, &xparam, NULL);
if( XVID_ERR_OK!=err)
{
printf("\n Error initializing xvid !!!\n");
return 0;
}
xvid_handle=xparam.handle;
printf("Xvid successfully initialized\n");
return 1;
}
示例3: enc_stop
static int enc_stop()
{
int xerr;
xerr = xvid_encore(enc_handle, XVID_ENC_DESTROY, NULL, NULL);
return xerr;
}
示例4: CHECK_AND_FREE
void CXvidVideoEncoder::StopEncoder()
{
CHECK_AND_FREE(m_vopBuffer);
xvid_encore(m_xvidHandle, XVID_ENC_DESTROY, NULL, NULL);
m_xvidHandle = NULL;
#ifdef WRITE_RAW
fclose(m_raw_file);
#endif
}
示例5: memset
uint8_t xvidEncoderCQ::encode(
ADMImage * in,
uint8_t * out,
uint32_t * len,
uint32_t * flags)
{
XVID_ENC_FRAME xframe;
int xerr;
memset(&xframe,0,sizeof(xframe));
xframe.general = encode_flags;
xframe.motion = motion_flags;
xframe.bitstream = out;
xframe.length = -1; // this is written by the routine
xframe.image = in->data;
xframe.colorspace = XVID_CSP_YV12; // defined in <xvid.h>
xframe.intra = -1; // let the codec decide between I-frame (1) and P-frame (0)
xframe.quant = _q;
// xframe.quant = QUANTI; // is quant != 0, use a fixed quant (and ignore bitrate)
xerr = xvid_encore(_handle, XVID_ENC_ENCODE, &xframe, &xstats);
/* enc_result->is_key_frame = xframe.intra;
enc_result->quantizer = xframe.quant;
enc_result->total_bits = xframe.length * 8;
enc_result->motion_bits = xstats.hlength * 8;
enc_result->texture_bits = enc_result->total_bits - enc_result->motion_bits;
*/
xvid_res.is_key_frame = xframe.intra;
xvid_res.quantizer = xframe.quant;
xvid_res.total_bits = xframe.length * 8;
xvid_res.motion_bits = xstats.hlength * 8;
xvid_res.texture_bits = xvid_res.total_bits - xvid_res.motion_bits;
xvid_res.out_quantizer=xstats.quant;
/* This is statictical data, e.g. for 2-pass.
If you are not interested in any of this, you can use NULL instead of &xstats
*/
*len = xframe.length;
*flags=0;
if(xerr!=XVID_ERR_OK) return 0;
if( xframe.intra)
{
*flags=AVI_KEY_FRAME;
}
return 1;
}
示例6: xvid_init_encoder
static void xvid_init_encoder (enix_venc_t *this_gen, enix_stream_t *stream) {
xvid_t *this = (xvid_t *) this_gen;
XVID_ENC_PARAM xparam;
int xerr;
int width, height, frame_duration;
enix_options_t *options;
width = stream->get_property (stream, ENIX_STREAM_PROP_WIDTH);
height = stream->get_property (stream, ENIX_STREAM_PROP_HEIGHT);
frame_duration = stream->get_property (stream, ENIX_STREAM_PROP_FRAME_DURATION);
options = this->encoder.options;
#ifdef LOG
printf ("xvid: width=%02d, height=%02d\n", width, height);
#endif
this->quality = options->get_num_option (options,
"quality");
this->bitrate = options->get_num_option (options,
"bitrate");
xparam.width = width;
xparam.height = height;
xparam.fbase = 90000;
xparam.fincr = frame_duration;
xparam.rc_reaction_delay_factor = 16;
xparam.rc_averaging_period = 100;
xparam.rc_buffer = 10;
xparam.rc_bitrate = this->bitrate;
xparam.min_quantizer = 1;
xparam.max_quantizer = 31;
xparam.max_key_interval = 250;
xparam.bquant_ratio = 120;
xparam.bquant_offset = 0;
xparam.max_bframes = options->get_num_option (options,
"max_bframes");;
xparam.frame_drop_ratio = 0;
xparam.global = 0;
xerr = xvid_encore (NULL, XVID_ENC_CREATE, &xparam, NULL);
#ifdef LOG
printf ("xvid: enc_create done, xerr = %d\n", xerr);
#endif
if (xerr) {
printf ("xvid: XVID_ENC_CREATE failed.\n");
exit (1);
}
this->xvid_handle = xparam.handle;
}
示例7: xvid_encore
void Revel_XvidEncoder::Reset(void)
{
// Must call base Reset() first!
Revel_BaseEncoder::Reset();
if (m_xvidEncoderHandle != NULL)
{
int xerr = xvid_encore(m_xvidEncoderHandle, XVID_ENC_DESTROY, NULL, NULL);
m_xvidEncoderHandle = NULL;
}
}
示例8: xvid_encore
//____________________________________________
//
// Initialize the compressor
//
uint8_t
xvid4Encoder::stopEncoder (void)
{
if (_handle)
{
xvid_encore (_handle, XVID_ENC_DESTROY, NULL, NULL);
printf ("[xvid] Destroying\n");
_handle = NULL;
}
return 1;
}
示例9: printf
// *************************************************
// *************************************************
// Pass1
// *************************************************
// *************************************************
uint8_t
xvid4EncoderPass1::init (uint32_t br, uint32_t fps1000,
xvid4EncParam * param)
{
int xerr;
printf ("[xvid] Pass 1 of 2 (log: %s)\n",
(char *) param->logName);
_fps1000 = fps1000;
memcpy (&_param, param, sizeof (_param));
dump ();
// Here we go...
MMSET (xvid_enc_create);
MMSET (pass1);
xvid_enc_create.version = XVID_VERSION;
xvid_enc_create.width = _w;
xvid_enc_create.height = _h;
plugins[0].func = xvid_plugin_2pass1;
plugins[0].param = &pass1;
pass1.version = XVID_VERSION;
pass1.filename = (char *) _param.logName;
xvid_enc_create.plugins = plugins;
xvid_enc_create.num_plugins = 1;
//Framerate
xvid_enc_create.fincr = 1000;
xvid_enc_create.fbase = _fps1000;
//
createUpdate ();
// Force Qz=2 !
xerr = xvid_encore (NULL, XVID_ENC_CREATE, &xvid_enc_create, NULL);
if (xerr < 0)
{
printf ("[xvid] Init error: %d\n", xerr);
return 0;
}
_handle = xvid_enc_create.handle;
printf ("[xvid] Pass 1 init Ok\n");
return 1;
}
示例10: ADM_assert
//____________________________________________
//
// Initialize the compressor
//
uint8_t xvidEncoder::stopEncoder(void )
{
int ret;
ADM_assert(_init);
ret = xvid_encore(_handle, XVID_ENC_DESTROY, 0, 0);
_init = 0;
_handle=NULL;
if (ret == XVID_ERR_OK)
return 1;
return 0;
}
示例11: FFV1_XvidCompress
int FFV1_XvidCompress(unsigned char *in,unsigned char *out,uint32_t *outlen)
{
int ret;
MMSET(xvid_enc_frame);
MMSET(xvid_enc_stats);
xvid_enc_frame.version = XVID_VERSION;
xvid_enc_stats.version = XVID_VERSION;
xvid_enc_frame.length = 0;
xvid_enc_frame.vop_flags|=XVID_VOP_HALFPEL;
if(vinfo.quant)
xvid_enc_frame.vol_flags|=XVID_VOL_MPEGQUANT;
xvid_enc_frame.input.csp = XVID_CSP_YV12;
xvid_enc_frame.input.stride[0] = _w;
xvid_enc_frame.input.stride[1] = _w>>1;
xvid_enc_frame.input.stride[2] = _w>>1;
xvid_enc_frame.type = XVID_TYPE_AUTO;
/* Set up motion estimation flags */
xvid_enc_frame.input.plane[0] = in;
xvid_enc_frame.input.plane[2] = in+(_w*_h);
xvid_enc_frame.input.plane[1] = in+((_w*_h*5)>>2);
xvid_enc_frame.bitstream = out;
xvid_enc_frame.quant = vinfo.quality;
xvid_enc_frame.motion = X4motion_presets[vinfo.me];
if(nextIsKF)
{
xvid_enc_frame.type = XVID_TYPE_IVOP; // let the codec decide between I-frame (1) and P-frame (0)
nextIsKF=0;
}
else
{
xvid_enc_frame.type = XVID_TYPE_VOL; // let the codec decide between I-frame (1) and P-frame (0)
}
ret = xvid_encore(xvid_handle, XVID_ENC_ENCODE, &xvid_enc_frame,
&xvid_enc_stats);
*outlen = ret;
#ifdef ADM_DEBUG
printf("Outlen: %lu\n",*outlen);
#endif
return 1;
}
示例12: xvid_encode_close
/**
* Destroy the private context for the encoder.
* All buffers are freed, and the Xvid encoder context is destroyed.
*
* @param avctx AVCodecContext pointer to context
* @return Returns 0, success guaranteed
*/
static av_cold int xvid_encode_close(AVCodecContext *avctx) {
struct xvid_context *x = avctx->priv_data;
xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL);
av_freep(&avctx->extradata);
if( x->twopassbuffer != NULL ) {
av_free(x->twopassbuffer);
av_free(x->old_twopassbuffer);
}
av_free(x->twopassfile);
av_free(x->intra_matrix);
av_free(x->inter_matrix);
return 0;
}
示例13: xvid_dispose
static void xvid_dispose (enix_venc_t *this_gen) {
xvid_t *this = (xvid_t *) this_gen;
int xerr;
xerr = xvid_encore (this->xvid_handle, XVID_ENC_DESTROY, NULL, NULL);
this->xvid_handle = 0;
if (this->hints_file) {
fclose (this->hints_file);
this->hints_file = NULL;
}
free (this);
}
示例14: memset
int Revel_XvidEncoder::CreateXvidEncoder(void **encoderOut)
{
// Initialize XviD core
xvid_gbl_init_t xvid_gbl_init;
memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init));
xvid_gbl_init.version = XVID_VERSION;
xvid_gbl_init.debug = 0;
xvid_gbl_init.cpu_flags = 0;
xvid_global(NULL, XVID_GBL_INIT, &xvid_gbl_init, NULL);
// Initialize XviD encoder
xvid_enc_create_t xvid_enc_create;
memset(&xvid_enc_create, 0, sizeof(xvid_enc_create));
xvid_enc_create.version = XVID_VERSION;
xvid_enc_create.width = m_params.width;
xvid_enc_create.height = m_params.height;
xvid_enc_create.profile = XVID_PROFILE_AS_L4;
// init plugins
xvid_enc_zone_t zones[64];
const int NUM_ZONES = 0;
xvid_enc_create.zones = zones;
xvid_enc_create.num_zones = NUM_ZONES;
xvid_enc_plugin_t plugins[7];
xvid_enc_create.plugins = plugins;
xvid_enc_create.num_plugins = 0;
xvid_enc_create.num_threads = 0;
xvid_enc_create.fincr = 1;
xvid_enc_create.fbase = 24;
xvid_enc_create.max_key_interval = xvid_enc_create.fbase * 10;
xvid_enc_create.max_bframes = 0;
xvid_enc_create.bquant_ratio = 150;
xvid_enc_create.bquant_offset = 100;
xvid_enc_create.frame_drop_ratio = 0;
xvid_enc_create.global = 0;
int xerr = xvid_encore(NULL, XVID_ENC_CREATE, &xvid_enc_create, NULL);
// Retrieve the encoder instance from the structure
*encoderOut = xvid_enc_create.handle;
return xerr;
}
示例15: mpeg4_start
static void mpeg4_start( struct mpeg4_encoder *en, struct frame *f )
{
xvid_enc_create_t xvid_enc_create;
xvid_enc_plugin_t plugins[1];
xvid_plugin_single_t single;
en->reset_pending = 0;
en->width = f->width;
en->height = f->height;
memset( &xvid_enc_create, 0, sizeof( xvid_enc_create ) );
xvid_enc_create.version = XVID_VERSION;
xvid_enc_create.width = en->width;
xvid_enc_create.height = en->height;
xvid_enc_create.profile = XVID_PROFILE_ARTS_L4;
en->input->stream->get_framerate( en->input->stream,
&xvid_enc_create.fincr,
&xvid_enc_create.fbase );
spook_log( SL_DEBUG, "creating mpeg4 encoder with fincr=%d fbase=%d",
xvid_enc_create.fincr, xvid_enc_create.fbase );
xvid_enc_create.zones = NULL;
xvid_enc_create.num_zones = 0;
xvid_enc_create.plugins = plugins;
xvid_enc_create.num_plugins = 1;
xvid_enc_create.num_threads = 0;
xvid_enc_create.max_key_interval = 300;
xvid_enc_create.max_bframes = 0;
xvid_enc_create.bquant_ratio = 150;
xvid_enc_create.bquant_offset = 100;
xvid_enc_create.frame_drop_ratio = 0;
xvid_enc_create.global = 0;
memset( &single, 0, sizeof( single ) );
single.version = XVID_VERSION;
single.bitrate = en->bitrate * 1000;
plugins[0].func = xvid_plugin_single;
plugins[0].param = &single;
if( xvid_encore( NULL, XVID_ENC_CREATE,
&xvid_enc_create, NULL ) )
{
spook_log( SL_ERR, "mpeg4: unable to start XviD!" );
return;
}
en->xvid_handle = xvid_enc_create.handle;
}