116 |
|
|
117 |
|
|
118 |
int |
int |
119 |
enc_create(xvid_enc_create_t * create, xvid_enc_rc_t * rc) |
enc_create(xvid_enc_create_t * create) |
120 |
{ |
{ |
121 |
Encoder *pEnc; |
Encoder *pEnc; |
122 |
int n; |
int n; |
123 |
|
|
124 |
if (XVID_MAJOR(create->version) != 1 || (rc && XVID_MAJOR(rc->version) != 1)) /* v1.x.x */ |
if (XVID_MAJOR(create->version) != 1) /* v1.x.x */ |
125 |
return XVID_ERR_VERSION; |
return XVID_ERR_VERSION; |
126 |
|
|
127 |
if (create->width%2 || create->height%2) |
if (create->width%2 || create->height%2) |
597 |
xvid_free(pEnc->temp_dquants); |
xvid_free(pEnc->temp_dquants); |
598 |
} |
} |
599 |
|
|
600 |
|
|
601 |
|
if (pEnc->num_plugins>0) |
602 |
|
{ |
603 |
|
xvid_plg_destroy_t pdestroy; |
604 |
|
memset(&pdestroy, 0, sizeof(xvid_plg_destroy_t)); |
605 |
|
|
606 |
|
pdestroy.version = XVID_VERSION; |
607 |
|
pdestroy.num_frames = pEnc->m_framenum; |
608 |
|
|
609 |
for (i=0; i<pEnc->num_plugins;i++) { |
for (i=0; i<pEnc->num_plugins;i++) { |
610 |
if (pEnc->plugins[i].func) { |
if (pEnc->plugins[i].func) { |
611 |
pEnc->plugins[i].func(pEnc->plugins[i].param, XVID_PLG_DESTROY, 0, 0); |
pEnc->plugins[i].func(pEnc->plugins[i].param, XVID_PLG_DESTROY, &pdestroy, 0); |
612 |
} |
} |
613 |
} |
} |
614 |
xvid_free(pEnc->plugins); |
xvid_free(pEnc->plugins); |
615 |
|
} |
616 |
|
|
617 |
xvid_free(pEnc); |
xvid_free(pEnc); |
618 |
|
|
1007 |
* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */ |
* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */ |
1008 |
|
|
1009 |
pEnc->current->fincr = pEnc->mbParam.fincr>0 ? pEnc->mbParam.fincr : frame->fincr; |
pEnc->current->fincr = pEnc->mbParam.fincr>0 ? pEnc->mbParam.fincr : frame->fincr; |
1010 |
|
inc_frame_num(pEnc); |
1011 |
pEnc->current->vol_flags = pEnc->mbParam.vol_flags; |
pEnc->current->vol_flags = pEnc->mbParam.vol_flags; |
1012 |
pEnc->current->vop_flags = frame->vop_flags; |
pEnc->current->vop_flags = frame->vop_flags; |
1013 |
pEnc->current->motion_flags = frame->motion; |
pEnc->current->motion_flags = frame->motion; |
1014 |
pEnc->current->fcode = pEnc->mbParam.m_fcode; |
pEnc->current->fcode = pEnc->mbParam.m_fcode; |
1015 |
pEnc->current->bcode = pEnc->mbParam.m_fcode; |
pEnc->current->bcode = pEnc->mbParam.m_fcode; |
1016 |
|
|
1017 |
|
|
1018 |
if ((xFrame->vop_flags & XVID_CHROMAOPT)) { |
if ((xFrame->vop_flags & XVID_CHROMAOPT)) { |
1019 |
image_chroma_optimize(&pEnc->current->image, |
image_chroma_optimize(&pEnc->current->image, |
1020 |
pEnc->mbParam.width, pEnc->mbParam.height, pEnc->mbParam.edged_width); |
pEnc->mbParam.width, pEnc->mbParam.height, pEnc->mbParam.edged_width); |
1058 |
} |
} |
1059 |
} |
} |
1060 |
|
|
|
inc_frame_num(pEnc); |
|
1061 |
pEnc->iFrameNum++; |
pEnc->iFrameNum++; |
1062 |
|
|
1063 |
if ((pEnc->current->vop_flags & XVID_DEBUG)) { |
if ((pEnc->current->vop_flags & XVID_DEBUG)) { |