[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.32, Wed May 1 13:00:01 2002 UTC revision 1.36, Thu May 9 00:15:50 2002 UTC
# Line 32  Line 32 
32   *   *
33   *  History   *  History
34   *   *
35     *  08.05.2002 fix some problem in DEBUG mode;
36     *             MinChen <chenm001@163.com>
37   *  14.04.2002 added FrameCodeB()   *  14.04.2002 added FrameCodeB()
38   *   *
39   *  $Id$   *  $Id$
# Line 264  Line 266 
266  #ifdef BFRAMES  #ifdef BFRAMES
267    
268          // TODO: handle malloc() == NULL          // TODO: handle malloc() == NULL
269          pEnc->max_bframes = pParam->max_bframes;          pEnc->mbParam.max_bframes = pParam->max_bframes;
270          pEnc->bquant_ratio = pParam->bquant_ratio;          pEnc->bquant_ratio = pParam->bquant_ratio;
271          if (pEnc->max_bframes > 0)          if (pEnc->mbParam.max_bframes > 0)
272          {          {
273                  int n;                  int n;
274    
275                  pEnc->bframes = malloc(pEnc->max_bframes * sizeof(FRAMEINFO *));                  pEnc->bframes = malloc(pEnc->mbParam.max_bframes * sizeof(FRAMEINFO *));
276    
277                  for (n = 0; n < pEnc->max_bframes; n++)                  for (n = 0; n < pEnc->mbParam.max_bframes; n++)
278                  {                  {
279                          pEnc->bframes[n] = malloc(sizeof(FRAMEINFO));                          pEnc->bframes[n] = malloc(sizeof(FRAMEINFO));
280                          pEnc->bframes[n]->mbs = malloc(sizeof(MACROBLOCK) * pEnc->mbParam.mb_width * pEnc->mbParam.mb_height);                          pEnc->bframes[n]->mbs = malloc(sizeof(MACROBLOCK) * pEnc->mbParam.mb_width * pEnc->mbParam.mb_height);
# Line 316  Line 318 
318    
319  // =================================================================  // =================================================================
320  #ifdef BFRAMES  #ifdef BFRAMES
321          if (pEnc->max_bframes > 0)          if (pEnc->mbParam.max_bframes > 0)
322          {          {
323                  int n;                  int n;
324                  for (n = 0; n < pEnc->max_bframes; n++)                  for (n = 0; n < pEnc->mbParam.max_bframes; n++)
325                  {                  {
326                          image_destroy(&pEnc->bframes[n]->image, pEnc->mbParam.edged_width, pEnc->mbParam.edged_height);                          image_destroy(&pEnc->bframes[n]->image, pEnc->mbParam.edged_width, pEnc->mbParam.edged_height);
327                          free(pEnc->bframes[n]->mbs);                          free(pEnc->bframes[n]->mbs);
# Line 327  Line 329 
329                  }                  }
330                  free(pEnc->bframes);                  free(pEnc->bframes);
331          }          }
332  #endif BFRAMES  #endif
333  //====================================================================  //====================================================================
334    
335          image_destroy(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.edged_height);          image_destroy(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.edged_height);
# Line 365  Line 367 
367          Bitstream bs;          Bitstream bs;
368          uint32_t bits;          uint32_t bits;
369    
370    #ifdef _DEBUG
371            float psnr;
372            char temp[128];
373    #endif
374    
375          ENC_CHECK(pEnc);          ENC_CHECK(pEnc);
376          ENC_CHECK(pFrame);          ENC_CHECK(pFrame);
377    
# Line 433  Line 440 
440          SWAP(pEnc->current, pEnc->reference);          SWAP(pEnc->current, pEnc->reference);
441    
442          pEnc->current->quant = (pFrame->quant == 0) ? RateControlGetQ(0) : pFrame->quant;          pEnc->current->quant = (pFrame->quant == 0) ? RateControlGetQ(0) : pFrame->quant;
443    
444            if(pEnc->current->quant < 1)
445                    pEnc->current->quant = 1;
446    
447            if(pEnc->current->quant > 31)
448                    pEnc->current->quant = 31;
449    
450          pEnc->current->global_flags = pFrame->general;          pEnc->current->global_flags = pFrame->general;
451          pEnc->current->motion_flags = pFrame->motion;          pEnc->current->motion_flags = pFrame->motion;
452          pEnc->current->seconds = pEnc->mbParam.m_seconds;          pEnc->current->seconds = pEnc->mbParam.m_seconds;
# Line 450  Line 464 
464          stop_conv_timer();          stop_conv_timer();
465    
466  #ifdef _DEBUG  #ifdef _DEBUG
467          image_copy(&pEnc->sOriginal, &pEnc->sCurrent, pEnc->mbParam.edged_width, pEnc->mbParam.height);          image_copy(&pEnc->sOriginal, &pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height);
468  #endif  #endif
469    
470    
# Line 500  Line 514 
514                  /* note: sequences like "IIBB" decode fine with msfdam but,                  /* note: sequences like "IIBB" decode fine with msfdam but,
515                     go screwy with divx5.00 */                     go screwy with divx5.00 */
516          }          }
517          else if (pEnc->bframenum_tail >= pEnc->max_bframes)          else if (pEnc->bframenum_tail >= pEnc->mbParam.max_bframes)
518          {          {
519                  dprintf("--- PFRAME ---");                  dprintf("--- PFRAME ---");
520    

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.36

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