[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.95.2.63, Fri Jan 30 18:53:50 2004 UTC revision 1.103, Tue Mar 30 12:31:52 2004 UTC
# Line 123  Line 123 
123          if (create->width%2 || create->height%2)          if (create->width%2 || create->height%2)
124                  return XVID_ERR_FAIL;                  return XVID_ERR_FAIL;
125    
126            if (create->width<=0 || create->height<=0)
127                    return XVID_ERR_FAIL;
128    
129          /* allocate encoder struct */          /* allocate encoder struct */
130    
131          pEnc = (Encoder *) xvid_malloc(sizeof(Encoder), CACHE_LINE);          pEnc = (Encoder *) xvid_malloc(sizeof(Encoder), CACHE_LINE);
# Line 1086  Line 1089 
1089                                  DPRINTF(XVID_DEBUG_DEBUG,"*** PFRAME bf: head=%i tail=%i   queue: head=%i tail=%i size=%i\n",                                  DPRINTF(XVID_DEBUG_DEBUG,"*** PFRAME bf: head=%i tail=%i   queue: head=%i tail=%i size=%i\n",
1090                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
1091                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
1092                                    pEnc->mbParam.frame_drop_ratio = -1; /* it must be a coded vop */
1093    
1094                                  FrameCodeP(pEnc, &bs, 1, 0);                                  FrameCodeP(pEnc, &bs, 1, 0);
1095    
# Line 1339  Line 1343 
1343                                     pEnc->mbParam.edged_width, pEnc->mbParam.height);                                     pEnc->mbParam.edged_width, pEnc->mbParam.height);
1344                  }                  }
1345    
1346                  FrameCodeP(pEnc, &bs, 1, 0);                  if ( FrameCodeP(pEnc, &bs, 1, 0) == 0 ) {
1347                            /* N-VOP, we mustn't code b-frames yet */
1348                            call_plugins(pEnc, pEnc->current, &pEnc->sOriginal, XVID_PLG_AFTER, 0, 0, stats);
1349                            goto done;
1350                    }
1351          }          }
1352    
1353    
# Line 1440  Line 1448 
1448                  start_timer();                  start_timer();
1449                  image_setedges(&pEnc->current->image,                  image_setedges(&pEnc->current->image,
1450                          pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,                          pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,
1451                          pEnc->mbParam.width, pEnc->mbParam.height);                          pEnc->mbParam.width, pEnc->mbParam.height, 0);
1452                  stop_edges_timer();                  stop_edges_timer();
1453          }          }
1454    
# Line 1536  Line 1544 
1544          MBParam * const pParam = &pEnc->mbParam;          MBParam * const pParam = &pEnc->mbParam;
1545          int mb_width = pParam->mb_width;          int mb_width = pParam->mb_width;
1546          int mb_height = pParam->mb_height;          int mb_height = pParam->mb_height;
1547            int coded = 1;
1548    
1549    
1550          /* IMAGE *pCurrent = &current->image; */          /* IMAGE *pCurrent = &current->image; */
# Line 1551  Line 1560 
1560          if (!reference->is_edged) {          if (!reference->is_edged) {
1561                  start_timer();                  start_timer();
1562                  image_setedges(pRef, pParam->edged_width, pParam->edged_height,                  image_setedges(pRef, pParam->edged_width, pParam->edged_height,
1563                                             pParam->width, pParam->height);                                             pParam->width, pParam->height, 0);
1564                  stop_edges_timer();                  stop_edges_timer();
1565                  reference->is_edged = 1;                  reference->is_edged = 1;
1566          }          }
# Line 1863  Line 1872 
1872  #if 0  #if 0
1873          DPRINTF(XVID_DEBUG_DEBUG, "kmu %i %i %i\n", current->sStat.kblks, current->sStat.mblks, current->sStat.ublks);          DPRINTF(XVID_DEBUG_DEBUG, "kmu %i %i %i\n", current->sStat.kblks, current->sStat.mblks, current->sStat.ublks);
1874  #endif  #endif
1875          if (current->sStat.kblks + current->sStat.mblks <          if (current->sStat.kblks + current->sStat.mblks <=
1876                  (pParam->frame_drop_ratio * mb_width * mb_height) / 100)                  (pParam->frame_drop_ratio * mb_width * mb_height) / 100)
1877          {          {
1878                  current->sStat.kblks = current->sStat.mblks = 0;                  current->sStat.kblks = current->sStat.mblks = 0;
# Line 1880  Line 1889 
1889                  current->rounding_type = reference->rounding_type;                  current->rounding_type = reference->rounding_type;
1890                  current->fcode = reference->fcode;                  current->fcode = reference->fcode;
1891                  current->bcode = reference->bcode;                  current->bcode = reference->bcode;
1892                    current->stamp = reference->stamp;
1893                  image_copy(&current->image, &reference->image, pParam->edged_width, pParam->height);                  image_copy(&current->image, &reference->image, pParam->edged_width, pParam->height);
1894                  memcpy(current->mbs, reference->mbs, sizeof(MACROBLOCK) * mb_width * mb_height);                  memcpy(current->mbs, reference->mbs, sizeof(MACROBLOCK) * mb_width * mb_height);
1895          }                  coded = 0;
1896    
1897            } else {
1898    
1899          pEnc->current->is_edged = 0; /* not edged */          pEnc->current->is_edged = 0; /* not edged */
1900          pEnc->current->is_interpolated = -1; /* not interpolated (fake rounding -1) */          pEnc->current->is_interpolated = -1; /* not interpolated (fake rounding -1) */
# Line 1893  Line 1905 
1905          image_swap(&pEnc->vInterH, &pEnc->f_refh);          image_swap(&pEnc->vInterH, &pEnc->f_refh);
1906          image_swap(&pEnc->vInterV, &pEnc->f_refv);          image_swap(&pEnc->vInterV, &pEnc->f_refv);
1907          image_swap(&pEnc->vInterHV, &pEnc->f_refhv);          image_swap(&pEnc->vInterHV, &pEnc->f_refhv);
1908            }
1909    
1910          /* XXX: debug          /* XXX: debug
1911          {          {
# Line 1914  Line 1926 
1926    
1927          current->length = (BitstreamPos(bs) - bits) / 8;          current->length = (BitstreamPos(bs) - bits) / 8;
1928    
1929          return 0;                                       /* inter */          return coded;
1930  }  }
1931    
1932    
# Line 1949  Line 1961 
1961          if (!pEnc->reference->is_edged) {          if (!pEnc->reference->is_edged) {
1962                  image_setedges(f_ref, pEnc->mbParam.edged_width,                  image_setedges(f_ref, pEnc->mbParam.edged_width,
1963                                             pEnc->mbParam.edged_height, pEnc->mbParam.width,                                             pEnc->mbParam.edged_height, pEnc->mbParam.width,
1964                                             pEnc->mbParam.height);                                             pEnc->mbParam.height, 0);
1965                  pEnc->current->is_edged = 1;                  pEnc->current->is_edged = 1;
1966          }          }
1967    
# Line 1966  Line 1978 
1978          if (!pEnc->current->is_edged) {          if (!pEnc->current->is_edged) {
1979                  image_setedges(b_ref, pEnc->mbParam.edged_width,                  image_setedges(b_ref, pEnc->mbParam.edged_width,
1980                                             pEnc->mbParam.edged_height, pEnc->mbParam.width,                                             pEnc->mbParam.edged_height, pEnc->mbParam.width,
1981                                             pEnc->mbParam.height);                                             pEnc->mbParam.height, 0);
1982                  pEnc->current->is_edged = 1;                  pEnc->current->is_edged = 1;
1983          }          }
1984    

Legend:
Removed from v.1.95.2.63  
changed lines
  Added in v.1.103

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