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

Diff of /trunk/xvidcore/src/encoder.c

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

revision 1913, Sat Dec 18 16:02:08 2010 UTC revision 1919, Fri Dec 24 13:21:35 2010 UTC
# Line 21  Line 21 
21   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
22   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
23   *   *
24   * $Id: encoder.c,v 1.134 2010-12-18 16:02:00 Isibaar Exp $   * $Id: encoder.c,v 1.135 2010-12-24 13:20:07 Isibaar Exp $
25   *   *
26   ****************************************************************************/   ****************************************************************************/
27    
# Line 1855  Line 1855 
1855                                                  iSAD = sad16(reference->image.y + 16*y*pParam->edged_width + 16*x,                                                  iSAD = sad16(reference->image.y + 16*y*pParam->edged_width + 16*x,
1856                                                                                  pEnc->bframes[k]->image.y + 16*y*pParam->edged_width + 16*x,                                                                                  pEnc->bframes[k]->image.y + 16*y*pParam->edged_width + 16*x,
1857                                                                                  pParam->edged_width, BFRAME_SKIP_THRESHHOLD * pMB->quant);                                                                                  pParam->edged_width, BFRAME_SKIP_THRESHHOLD * pMB->quant);
1858                                                  if (iSAD >= BFRAME_SKIP_THRESHHOLD * pMB->quant) {                                                  if (iSAD >= BFRAME_SKIP_THRESHHOLD * pMB->quant || ((bound > 1) &&
1859                                                            ((y*mb_width+x == bound) || (y*mb_width+x == bound+1)))) { /* Some third-party decoders have problems with coloc skip MB before or after
1860                                                                                                                                                                               resync marker in BVOP. We avoid any ambiguity and force no skip at slice boundary */
1861                                                          bSkip = 0; /* could not SKIP */                                                          bSkip = 0; /* could not SKIP */
1862                                                          if (pParam->vol_flags & XVID_VOL_QUARTERPEL) {                                                          if (pParam->vol_flags & XVID_VOL_QUARTERPEL) {
1863                                                                  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 2208 
2208          int num_slices = pEnc->num_slices;          int num_slices = pEnc->num_slices;
2209    
2210          if (data->start_y > 0) { /* write resync marker */          if (data->start_y > 0) { /* write resync marker */
2211                  write_video_packet_header(bs, pParam, frame, bound);                  write_video_packet_header(bs, pParam, frame, bound+1);
2212          }          }
2213    
2214          for (y = data->start_y; y < data->stop_y; y++) {          for (y = data->start_y; y < MIN(data->stop_y+1, mb_height); y++) {
2215                  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);
2216                    int stop_x = (y == data->stop_y) ? 1 : mb_width;
2217                    int start_x = (y == data->start_y && y > 0) ? 1 : 0;
2218    
2219                  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++) {  
2220                          MACROBLOCK * const mb = &frame->mbs[x + y * pEnc->mbParam.mb_width];                          MACROBLOCK * const mb = &frame->mbs[x + y * pEnc->mbParam.mb_width];
2221    
2222                          /* 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 2228 
2228                                  continue;                                  continue;
2229                          }                          }
2230    
2231                            if (new_bound > bound && x > 0) {
2232                                    bound = new_bound;
2233                                    BitstreamPadAlways(bs);
2234                                    write_video_packet_header(bs, pParam, frame, y*mb_width+x);
2235                            }
2236    
2237                          mb->quant = frame->quant;                          mb->quant = frame->quant;
2238    
2239                          if (mb->cbp != 0 || pParam->plugin_flags & XVID_REQORIGINAL) {                          if (mb->cbp != 0 || pParam->plugin_flags & XVID_REQORIGINAL) {
# Line 2406  Line 2410 
2410                                                           pEnc->reference->mbs, f_ref,                                                           pEnc->reference->mbs, f_ref,
2411                                                           &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv,                                                           &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv,
2412                                                           pEnc->current, b_ref, &pEnc->vInterH,                                                           pEnc->current, b_ref, &pEnc->vInterH,
2413                                                           &pEnc->vInterV, &pEnc->vInterHV);                                                           &pEnc->vInterV, &pEnc->vInterHV,
2414                                                             pEnc->num_slices);
2415          }          }
2416          stop_motion_timer();          stop_motion_timer();
2417    

Legend:
Removed from v.1913  
changed lines
  Added in v.1919

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