3 |
* XVID MPEG-4 VIDEO CODEC |
* XVID MPEG-4 VIDEO CODEC |
4 |
* - Encoder main module - |
* - Encoder main module - |
5 |
* |
* |
6 |
* Copyright(C) 2002 Michael Militzer |
* Copyright(C) 2002 Michael Militzer <isibaar@xvid.org> |
7 |
|
* 2002 Peter Ross <pross@xvid.org> |
8 |
|
* 2002 Daniel Smith <danielsmith@astroboymail.com> |
9 |
* |
* |
10 |
* This program is an implementation of a part of one or more MPEG-4 |
* This program is an implementation of a part of one or more MPEG-4 |
11 |
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
30 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
31 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
32 |
* |
* |
33 |
* $Id: encoder.c,v 1.83 2002-09-12 18:53:35 edgomez Exp $ |
* $Id: encoder.c,v 1.86 2002-10-19 12:20:33 edgomez Exp $ |
34 |
* |
* |
35 |
****************************************************************************/ |
****************************************************************************/ |
36 |
|
|
259 |
image_null(&pEnc->reference->image); |
image_null(&pEnc->reference->image); |
260 |
image_null(&pEnc->vInterH); |
image_null(&pEnc->vInterH); |
261 |
image_null(&pEnc->vInterV); |
image_null(&pEnc->vInterV); |
|
image_null(&pEnc->vInterVf); |
|
262 |
image_null(&pEnc->vInterHV); |
image_null(&pEnc->vInterHV); |
|
image_null(&pEnc->vInterHVf); |
|
263 |
|
|
264 |
#ifdef _DEBUG_PSNR |
#ifdef _DEBUG_PSNR |
265 |
if (image_create |
if (image_create |
284 |
pEnc->mbParam.edged_height) < 0) |
pEnc->mbParam.edged_height) < 0) |
285 |
goto xvid_err_memory3; |
goto xvid_err_memory3; |
286 |
if (image_create |
if (image_create |
|
(&pEnc->vInterVf, pEnc->mbParam.edged_width, |
|
|
pEnc->mbParam.edged_height) < 0) |
|
|
goto xvid_err_memory3; |
|
|
if (image_create |
|
287 |
(&pEnc->vInterHV, pEnc->mbParam.edged_width, |
(&pEnc->vInterHV, pEnc->mbParam.edged_width, |
288 |
pEnc->mbParam.edged_height) < 0) |
pEnc->mbParam.edged_height) < 0) |
289 |
goto xvid_err_memory3; |
goto xvid_err_memory3; |
|
if (image_create |
|
|
(&pEnc->vInterHVf, pEnc->mbParam.edged_width, |
|
|
pEnc->mbParam.edged_height) < 0) |
|
|
goto xvid_err_memory3; |
|
290 |
|
|
291 |
pParam->handle = (void *) pEnc; |
pParam->handle = (void *) pEnc; |
292 |
|
|
320 |
pEnc->mbParam.edged_height); |
pEnc->mbParam.edged_height); |
321 |
image_destroy(&pEnc->vInterV, pEnc->mbParam.edged_width, |
image_destroy(&pEnc->vInterV, pEnc->mbParam.edged_width, |
322 |
pEnc->mbParam.edged_height); |
pEnc->mbParam.edged_height); |
|
image_destroy(&pEnc->vInterVf, pEnc->mbParam.edged_width, |
|
|
pEnc->mbParam.edged_height); |
|
323 |
image_destroy(&pEnc->vInterHV, pEnc->mbParam.edged_width, |
image_destroy(&pEnc->vInterHV, pEnc->mbParam.edged_width, |
324 |
pEnc->mbParam.edged_height); |
pEnc->mbParam.edged_height); |
|
image_destroy(&pEnc->vInterHVf, pEnc->mbParam.edged_width, |
|
|
pEnc->mbParam.edged_height); |
|
325 |
|
|
326 |
xvid_err_memory2: |
xvid_err_memory2: |
327 |
xvid_free(pEnc->current->mbs); |
xvid_free(pEnc->current->mbs); |
363 |
pEnc->mbParam.edged_height); |
pEnc->mbParam.edged_height); |
364 |
image_destroy(&pEnc->vInterV, pEnc->mbParam.edged_width, |
image_destroy(&pEnc->vInterV, pEnc->mbParam.edged_width, |
365 |
pEnc->mbParam.edged_height); |
pEnc->mbParam.edged_height); |
|
image_destroy(&pEnc->vInterVf, pEnc->mbParam.edged_width, |
|
|
pEnc->mbParam.edged_height); |
|
366 |
image_destroy(&pEnc->vInterHV, pEnc->mbParam.edged_width, |
image_destroy(&pEnc->vInterHV, pEnc->mbParam.edged_width, |
367 |
pEnc->mbParam.edged_height); |
pEnc->mbParam.edged_height); |
|
image_destroy(&pEnc->vInterHVf, pEnc->mbParam.edged_width, |
|
|
pEnc->mbParam.edged_height); |
|
368 |
|
|
369 |
#ifdef _DEBUG_PSNR |
#ifdef _DEBUG_PSNR |
370 |
image_destroy(&pEnc->sOriginal, pEnc->mbParam.edged_width, |
image_destroy(&pEnc->sOriginal, pEnc->mbParam.edged_width, |
882 |
|
|
883 |
start_timer(); |
start_timer(); |
884 |
image_setedges(pRef, pEnc->mbParam.edged_width, pEnc->mbParam.edged_height, |
image_setedges(pRef, pEnc->mbParam.edged_width, pEnc->mbParam.edged_height, |
885 |
pEnc->mbParam.width, pEnc->mbParam.height, |
pEnc->mbParam.width, pEnc->mbParam.height); |
|
pEnc->current->global_flags & XVID_INTERLACING); |
|
886 |
stop_edges_timer(); |
stop_edges_timer(); |
887 |
|
|
888 |
pEnc->mbParam.m_rounding_type = 1 - pEnc->mbParam.m_rounding_type; |
pEnc->mbParam.m_rounding_type = 1 - pEnc->mbParam.m_rounding_type; |