[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.134, Sat Dec 18 16:02:00 2010 UTC revision 1.136, Tue Dec 28 19:19:43 2010 UTC
# Line 1645  Line 1645 
1645          int bound = 0, num_slices = pEnc->num_slices;          int bound = 0, num_slices = pEnc->num_slices;
1646          int num_threads = MAX(1, MIN(pEnc->num_threads, num_slices));          int num_threads = MAX(1, MIN(pEnc->num_threads, num_slices));
1647          int slices_per_thread = (num_slices*1024 / num_threads);          int slices_per_thread = (num_slices*1024 / num_threads);
         int mb_width = pEnc->mbParam.mb_width;  
1648          int mb_height = pEnc->mbParam.mb_height;          int mb_height = pEnc->mbParam.mb_height;
1649          void * status = NULL;          void * status = NULL;
1650          uint16_t k;          uint16_t k;
# Line 1755  Line 1754 
1754          FRAMEINFO *const current = pEnc->current;          FRAMEINFO *const current = pEnc->current;
1755          FRAMEINFO *const reference = pEnc->reference;          FRAMEINFO *const reference = pEnc->reference;
1756          MBParam * const pParam = &pEnc->mbParam;          MBParam * const pParam = &pEnc->mbParam;
         IMAGE *pRef = &reference->image;  
1757          int mb_width = pParam->mb_width;          int mb_width = pParam->mb_width;
1758          int mb_height = pParam->mb_height;          int mb_height = pParam->mb_height;
1759    
# Line 1855  Line 1853 
1853                                                  iSAD = sad16(reference->image.y + 16*y*pParam->edged_width + 16*x,                                                  iSAD = sad16(reference->image.y + 16*y*pParam->edged_width + 16*x,
1854                                                                                  pEnc->bframes[k]->image.y + 16*y*pParam->edged_width + 16*x,                                                                                  pEnc->bframes[k]->image.y + 16*y*pParam->edged_width + 16*x,
1855                                                                                  pParam->edged_width, BFRAME_SKIP_THRESHHOLD * pMB->quant);                                                                                  pParam->edged_width, BFRAME_SKIP_THRESHHOLD * pMB->quant);
1856                                                  if (iSAD >= BFRAME_SKIP_THRESHHOLD * pMB->quant) {                                                  if (iSAD >= BFRAME_SKIP_THRESHHOLD * pMB->quant || ((bound > 1) &&
1857                                                            ((y*mb_width+x == bound) || (y*mb_width+x == bound+1)))) { /* Some third-party decoders have problems with coloc skip MB before or after
1858                                                                                                                                                                               resync marker in BVOP. We avoid any ambiguity and force no skip at slice boundary */
1859                                                          bSkip = 0; /* could not SKIP */                                                          bSkip = 0; /* could not SKIP */
1860                                                          if (pParam->vol_flags & XVID_VOL_QUARTERPEL) {                                                          if (pParam->vol_flags & XVID_VOL_QUARTERPEL) {
1861                                                                  VECTOR predMV = get_qpmv2(current->mbs, pParam->mb_width, bound, x, y, 0);                                                                  VECTOR predMV = get_qpmv2(current->mbs, pParam->mb_width, bound, x, y, 0);
# Line 2206  Line 2206 
2206          int num_slices = pEnc->num_slices;          int num_slices = pEnc->num_slices;
2207    
2208          if (data->start_y > 0) { /* write resync marker */          if (data->start_y > 0) { /* write resync marker */
2209                  write_video_packet_header(bs, pParam, frame, bound);                  write_video_packet_header(bs, pParam, frame, bound+1);
2210          }          }
2211    
2212          for (y = data->start_y; y < data->stop_y; y++) {          for (y = data->start_y; y < MIN(data->stop_y+1, mb_height); y++) {
2213                  int new_bound = mb_width * ((((y*num_slices) / mb_height) * mb_height + (num_slices-1)) / num_slices);                  int new_bound = mb_width * ((((y*num_slices) / mb_height) * mb_height + (num_slices-1)) / num_slices);
2214                    int stop_x = (y == data->stop_y) ? 1 : mb_width;
2215                    int start_x = (y == data->start_y && y > 0) ? 1 : 0;
2216    
2217                  if (new_bound > bound) {                  for (x = start_x; x < stop_x; x++) {
                         bound = new_bound;  
                         BitstreamPadAlways(bs);  
                         write_video_packet_header(bs, pParam, frame, bound);  
                 }  
   
                 for (x = 0; x < mb_width; x++) {  
2218                          MACROBLOCK * const mb = &frame->mbs[x + y * pEnc->mbParam.mb_width];                          MACROBLOCK * const mb = &frame->mbs[x + y * pEnc->mbParam.mb_width];
2219    
2220                          /* decoder ignores mb when refence block is INTER(0,0), CBP=0 */                          /* decoder ignores mb when refence block is INTER(0,0), CBP=0 */
# Line 2230  Line 2226 
2226                                  continue;                                  continue;
2227                          }                          }
2228    
2229                            if (new_bound > bound && x > 0) {
2230                                    bound = new_bound;
2231                                    BitstreamPadAlways(bs);
2232                                    write_video_packet_header(bs, pParam, frame, y*mb_width+x);
2233                            }
2234    
2235                          mb->quant = frame->quant;                          mb->quant = frame->quant;
2236    
2237                          if (mb->cbp != 0 || pParam->plugin_flags & XVID_REQORIGINAL) {                          if (mb->cbp != 0 || pParam->plugin_flags & XVID_REQORIGINAL) {
# Line 2281  Line 2283 
2283          IMAGE *b_ref = &pEnc->current->image;          IMAGE *b_ref = &pEnc->current->image;
2284    
2285          MBParam * const pParam = &pEnc->mbParam;          MBParam * const pParam = &pEnc->mbParam;
         int mb_width = pParam->mb_width;  
2286          int mb_height = pParam->mb_height;          int mb_height = pParam->mb_height;
2287    
2288          #ifdef BFRAMES_DEC_DEBUG          #ifdef BFRAMES_DEC_DEBUG
# Line 2406  Line 2407 
2407                                                           pEnc->reference->mbs, f_ref,                                                           pEnc->reference->mbs, f_ref,
2408                                                           &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv,                                                           &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv,
2409                                                           pEnc->current, b_ref, &pEnc->vInterH,                                                           pEnc->current, b_ref, &pEnc->vInterH,
2410                                                           &pEnc->vInterV, &pEnc->vInterHV);                                                           &pEnc->vInterV, &pEnc->vInterHV,
2411                                                             pEnc->num_slices);
2412          }          }
2413          stop_motion_timer();          stop_motion_timer();
2414    

Legend:
Removed from v.1.134  
changed lines
  Added in v.1.136

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