[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.120, Tue Nov 22 10:23:01 2005 UTC revision 1.121, Fri Dec 9 04:45:35 2005 UTC
# Line 238  Line 238 
238                          goto xvid_err_memory1a;                          goto xvid_err_memory1a;
239          }          }
240    
241            /* temp lambdas */
242            if (pEnc->mbParam.plugin_flags & XVID_REQLAMBDA) {
243                    pEnc->temp_lambda = (float *) xvid_malloc(pEnc->mbParam.mb_width *
244                                                    pEnc->mbParam.mb_height * 6 * sizeof(float), CACHE_LINE);
245                    if (pEnc->temp_lambda == NULL)
246                            goto xvid_err_memory1a;
247            }
248    
249          /* bframes */          /* bframes */
250          pEnc->mbParam.max_bframes = MAX(create->max_bframes, 0);          pEnc->mbParam.max_bframes = MAX(create->max_bframes, 0);
251          pEnc->mbParam.bquant_ratio = MAX(create->bquant_ratio, 0);          pEnc->mbParam.bquant_ratio = MAX(create->bquant_ratio, 0);
# Line 519  Line 527 
527                  xvid_free(pEnc->temp_dquants);                  xvid_free(pEnc->temp_dquants);
528          }          }
529    
530            if(pEnc->mbParam.plugin_flags & XVID_REQLAMBDA) {
531                    xvid_free(pEnc->temp_lambda);
532            }
533    
534    xvid_err_memory0:    xvid_err_memory0:
535          for (n=0; n<pEnc->num_plugins;n++) {          for (n=0; n<pEnc->num_plugins;n++) {
536                  if (pEnc->plugins[n].func) {                  if (pEnc->plugins[n].func) {
# Line 651  Line 663 
663  static void call_plugins(Encoder * pEnc, FRAMEINFO * frame, IMAGE * original,  static void call_plugins(Encoder * pEnc, FRAMEINFO * frame, IMAGE * original,
664                                                   int opt, int * type, int * quant, xvid_enc_stats_t * stats)                                                   int opt, int * type, int * quant, xvid_enc_stats_t * stats)
665  {  {
666          unsigned int i, j;          unsigned int i, j, k;
667          xvid_plg_data_t data;          xvid_plg_data_t data;
668    
669          /* set data struct */          /* set data struct */
# Line 713  Line 725 
725                          memset(data.dquant, 0, data.mb_width*data.mb_height);                          memset(data.dquant, 0, data.mb_width*data.mb_height);
726                  }                  }
727    
728                    if(pEnc->mbParam.plugin_flags & XVID_REQLAMBDA) {
729                            int block = 0;
730                            data.lambda = pEnc->temp_lambda;
731                            for(i = 0;i < pEnc->mbParam.mb_height; i++)
732                                    for(j = 0;j < pEnc->mbParam.mb_width; j++)
733                                            for (k = 0; k < 6; k++)
734                                                    data.lambda[block++] = 1.0f;
735                    }
736    
737          } else { /* XVID_PLG_AFTER */          } else { /* XVID_PLG_AFTER */
738                  if ((pEnc->mbParam.plugin_flags & XVID_REQORIGINAL)) {                  if ((pEnc->mbParam.plugin_flags & XVID_REQORIGINAL)) {
739                          data.original.csp = XVID_CSP_PLANAR;                          data.original.csp = XVID_CSP_PLANAR;
# Line 816  Line 837 
837                                  frame->mbs[j*pEnc->mbParam.mb_width + i].dquant = 0;                                  frame->mbs[j*pEnc->mbParam.mb_width + i].dquant = 0;
838                          }                          }
839                  }                  }
840    
841                    if (pEnc->mbParam.plugin_flags & XVID_REQLAMBDA) {
842                            for (j = 0; j < pEnc->mbParam.mb_height; j++)
843                                    for (i = 0; i < pEnc->mbParam.mb_width; i++)
844                                            for (k = 0; k < 6; k++) {
845                                                    frame->mbs[j*pEnc->mbParam.mb_width + i].lambda[k] =
846                                                            (int) ((float)(1<<LAMBDA_EXP) * data.lambda[6 * (j * data.mb_width + i) + k]);
847                            }
848                    } else {
849                            for (j = 0; j<pEnc->mbParam.mb_height; j++)
850                                    for (i = 0; i<pEnc->mbParam.mb_width; i++)
851                                            for (k = 0; k < 6; k++) {
852                                                    frame->mbs[j*pEnc->mbParam.mb_width + i].lambda[k] = 1<<LAMBDA_EXP;
853                            }
854                    }
855    
856    
857                  frame->mbs[0].quant = data.quant; /* FRAME will not affect the quant in stats */                  frame->mbs[0].quant = data.quant; /* FRAME will not affect the quant in stats */
858          }          }
859    
# Line 1872  Line 1910 
1910          }          }
1911    
1912          frame->coding_type = B_VOP;          frame->coding_type = B_VOP;
1913          call_plugins(pEnc, pEnc->current, NULL, XVID_PLG_FRAME, NULL, NULL, NULL);          call_plugins(pEnc, frame, NULL, XVID_PLG_FRAME, NULL, NULL, NULL);
1914    
1915          start_timer();          start_timer();
1916          MotionEstimationBVOP(&pEnc->mbParam, frame,          MotionEstimationBVOP(&pEnc->mbParam, frame,

Legend:
Removed from v.1.120  
changed lines
  Added in v.1.121

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