[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.84, Wed Sep 25 23:37:08 2002 UTC
# Line 102  Line 102 
102   * Encoder creation   * Encoder creation
103   *   *
104   * This function creates an Encoder instance, it allocates all necessary   * This function creates an Encoder instance, it allocates all necessary
105   * image buffers (reference, current and bframes) and initialize the internal   * image buffers (reference, current) and initialize the internal xvid
106   * xvid encoder paremeters according to the XVID_ENC_PARAM input parameter.   * encoder paremeters according to the XVID_ENC_PARAM input parameter.
107   *   *
108   * 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
109   * and cleaning code.   * and cleaning code.
# Line 257  Line 257 
257          image_null(&pEnc->reference->image);          image_null(&pEnc->reference->image);
258          image_null(&pEnc->vInterH);          image_null(&pEnc->vInterH);
259          image_null(&pEnc->vInterV);          image_null(&pEnc->vInterV);
         image_null(&pEnc->vInterVf);  
260          image_null(&pEnc->vInterHV);          image_null(&pEnc->vInterHV);
         image_null(&pEnc->vInterHVf);  
261    
262  #ifdef _DEBUG_PSNR  #ifdef _DEBUG_PSNR
263          if (image_create          if (image_create
# Line 284  Line 282 
282                   pEnc->mbParam.edged_height) < 0)                   pEnc->mbParam.edged_height) < 0)
283                  goto xvid_err_memory3;                  goto xvid_err_memory3;
284          if (image_create          if (image_create
                 (&pEnc->vInterVf, pEnc->mbParam.edged_width,  
                  pEnc->mbParam.edged_height) < 0)  
                 goto xvid_err_memory3;  
         if (image_create  
285                  (&pEnc->vInterHV, pEnc->mbParam.edged_width,                  (&pEnc->vInterHV, pEnc->mbParam.edged_width,
286                   pEnc->mbParam.edged_height) < 0)                   pEnc->mbParam.edged_height) < 0)
287                  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;  
288    
289          pParam->handle = (void *) pEnc;          pParam->handle = (void *) pEnc;
290    
# Line 328  Line 318 
318                                    pEnc->mbParam.edged_height);                                    pEnc->mbParam.edged_height);
319          image_destroy(&pEnc->vInterV, pEnc->mbParam.edged_width,          image_destroy(&pEnc->vInterV, pEnc->mbParam.edged_width,
320                                    pEnc->mbParam.edged_height);                                    pEnc->mbParam.edged_height);
         image_destroy(&pEnc->vInterVf, pEnc->mbParam.edged_width,  
                                   pEnc->mbParam.edged_height);  
321          image_destroy(&pEnc->vInterHV, pEnc->mbParam.edged_width,          image_destroy(&pEnc->vInterHV, pEnc->mbParam.edged_width,
322                                    pEnc->mbParam.edged_height);                                    pEnc->mbParam.edged_height);
         image_destroy(&pEnc->vInterHVf, pEnc->mbParam.edged_width,  
                                   pEnc->mbParam.edged_height);  
323    
324    xvid_err_memory2:    xvid_err_memory2:
325          xvid_free(pEnc->current->mbs);          xvid_free(pEnc->current->mbs);
# Line 375  Line 361 
361                                    pEnc->mbParam.edged_height);                                    pEnc->mbParam.edged_height);
362          image_destroy(&pEnc->vInterV, pEnc->mbParam.edged_width,          image_destroy(&pEnc->vInterV, pEnc->mbParam.edged_width,
363                                    pEnc->mbParam.edged_height);                                    pEnc->mbParam.edged_height);
         image_destroy(&pEnc->vInterVf, pEnc->mbParam.edged_width,  
                                   pEnc->mbParam.edged_height);  
364          image_destroy(&pEnc->vInterHV, pEnc->mbParam.edged_width,          image_destroy(&pEnc->vInterHV, pEnc->mbParam.edged_width,
365                                    pEnc->mbParam.edged_height);                                    pEnc->mbParam.edged_height);
         image_destroy(&pEnc->vInterHVf, pEnc->mbParam.edged_width,  
                                   pEnc->mbParam.edged_height);  
366    
367  #ifdef _DEBUG_PSNR  #ifdef _DEBUG_PSNR
368          image_destroy(&pEnc->sOriginal, pEnc->mbParam.edged_width,          image_destroy(&pEnc->sOriginal, pEnc->mbParam.edged_width,
# Line 560  Line 542 
542          emms();          emms();
543    
544          if (pFrame->quant == 0) {          if (pFrame->quant == 0) {
545                  RateControlUpdate(&pEnc->rate_control, pEnc->current->quant,                  RateControlUpdate(&pEnc->rate_control, (int16_t)pEnc->current->quant,
546                                                    pFrame->length, pFrame->intra);                                                    pFrame->length, pFrame->intra);
547          }          }
548  #ifdef _DEBUG_PSNR  #ifdef _DEBUG_PSNR
# Line 889  Line 871 
871          DECLARE_ALIGNED_MATRIX(qcoeff, 6, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(qcoeff, 6, 64, int16_t, CACHE_LINE);
872    
873          int iLimit;          int iLimit;
874          int x, y, k;          unsigned int x, y;
875          int iSearchRange;          int iSearchRange;
876          int bIntra;          int bIntra;
877    
# Line 898  Line 880 
880    
881          start_timer();          start_timer();
882          image_setedges(pRef, pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,          image_setedges(pRef, pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,
883                                     pEnc->mbParam.width, pEnc->mbParam.height,                                     pEnc->mbParam.width, pEnc->mbParam.height);
                                    pEnc->current->global_flags & XVID_INTERLACING);  
884          stop_edges_timer();          stop_edges_timer();
885    
886          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 981 
981                                  CodeIntraMB(pEnc, pMB);                                  CodeIntraMB(pEnc, pMB);
982                                  MBTransQuantIntra(&pEnc->mbParam, pEnc->current, pMB, x, y,                                  MBTransQuantIntra(&pEnc->mbParam, pEnc->current, pMB, x, y,
983                                                                    dct_codes, qcoeff);                                                                    dct_codes, qcoeff);
                         }  
984    
985                          start_timer();                          start_timer();
986                          MBPrediction(pEnc->current, x, y, pEnc->mbParam.mb_width, qcoeff);                          MBPrediction(pEnc->current, x, y, pEnc->mbParam.mb_width, qcoeff);
987                          stop_prediction_timer();                          stop_prediction_timer();
988                            }
989    
990                          if (pMB->mode == MODE_INTRA || pMB->mode == MODE_INTRA_Q) {                          if (pMB->mode == MODE_INTRA || pMB->mode == MODE_INTRA_Q) {
991                                  pEnc->sStat.kblks++;                                  pEnc->sStat.kblks++;

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

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