[cvs] / xvidcore / src / encoder.c Repository:
ViewVC logotype

Diff of /xvidcore/src/encoder.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.79, Wed Sep 4 21:43:46 2002 UTC revision 1.86, Sat Oct 19 12:20:33 2002 UTC
# Line 3  Line 3 
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
# Line 102  Line 104 
104   * Encoder creation   * Encoder creation
105   *   *
106   * This function creates an Encoder instance, it allocates all necessary   * This function creates an Encoder instance, it allocates all necessary
107   * image buffers (reference, current and bframes) and initialize the internal   * image buffers (reference, current) and initialize the internal xvid
108   * xvid encoder paremeters according to the XVID_ENC_PARAM input parameter.   * encoder paremeters according to the XVID_ENC_PARAM input parameter.
109   *   *
110   * The code seems to be very long but is very basic, mainly memory allocation   * The code seems to be very long but is very basic, mainly memory allocation
111   * and cleaning code.   * and cleaning code.
# Line 257  Line 259 
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
# Line 284  Line 284 
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    
# Line 328  Line 320 
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);
# Line 375  Line 363 
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,
# Line 560  Line 544 
544          emms();          emms();
545    
546          if (pFrame->quant == 0) {          if (pFrame->quant == 0) {
547                  RateControlUpdate(&pEnc->rate_control, pEnc->current->quant,                  RateControlUpdate(&pEnc->rate_control, (int16_t)pEnc->current->quant,
548                                                    pFrame->length, pFrame->intra);                                                    pFrame->length, pFrame->intra);
549          }          }
550  #ifdef _DEBUG_PSNR  #ifdef _DEBUG_PSNR
# Line 889  Line 873 
873          DECLARE_ALIGNED_MATRIX(qcoeff, 6, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(qcoeff, 6, 64, int16_t, CACHE_LINE);
874    
875          int iLimit;          int iLimit;
876          int x, y, k;          unsigned int x, y;
877          int iSearchRange;          int iSearchRange;
878          int bIntra;          int bIntra;
879    
# Line 898  Line 882 
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;
# Line 1000  Line 983 
983                                  CodeIntraMB(pEnc, pMB);                                  CodeIntraMB(pEnc, pMB);
984                                  MBTransQuantIntra(&pEnc->mbParam, pEnc->current, pMB, x, y,                                  MBTransQuantIntra(&pEnc->mbParam, pEnc->current, pMB, x, y,
985                                                                    dct_codes, qcoeff);                                                                    dct_codes, qcoeff);
                         }  
986    
987                          start_timer();                          start_timer();
988                          MBPrediction(pEnc->current, x, y, pEnc->mbParam.mb_width, qcoeff);                          MBPrediction(pEnc->current, x, y, pEnc->mbParam.mb_width, qcoeff);
989                          stop_prediction_timer();                          stop_prediction_timer();
990                            }
991    
992                          if (pMB->mode == MODE_INTRA || pMB->mode == MODE_INTRA_Q) {                          if (pMB->mode == MODE_INTRA || pMB->mode == MODE_INTRA_Q) {
993                                  pEnc->sStat.kblks++;                                  pEnc->sStat.kblks++;

Legend:
Removed from v.1.79  
changed lines
  Added in v.1.86

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4