[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.76.2.37, Mon Jan 13 14:33:24 2003 UTC revision 1.76.2.40, Tue Jan 21 22:05:44 2003 UTC
# Line 229  Line 229 
229    
230          pEnc->bitrate = pParam->rc_bitrate;          pEnc->bitrate = pParam->rc_bitrate;
231    
232          pEnc->iFrameNum = 0;          pEnc->iFrameNum = -1;
233          pEnc->mbParam.iMaxKeyInterval = pParam->max_key_interval;          pEnc->mbParam.iMaxKeyInterval = pParam->max_key_interval;
234    
235          /* try to allocate frame memory */          /* try to allocate frame memory */
# Line 734  Line 734 
734                          pFrame->length = BitstreamLength(&bs);                          pFrame->length = BitstreamLength(&bs);
735                          pFrame->intra = 0;                          pFrame->intra = 0;
736    
737    
738                          emms();                          emms();
739    
740                            if (pResult) {
741                                    pResult->quant = pEnc->current->quant;
742                                    pResult->hlength = pFrame->length - (pEnc->current->sStat.iTextBits / 8);
743                                    pResult->kblks = pEnc->current->sStat.kblks;
744                                    pResult->mblks = pEnc->current->sStat.mblks;
745                                    pResult->ublks = pEnc->current->sStat.ublks;
746                            }
747    
748                          return XVID_ERR_OK;                          return XVID_ERR_OK;
749                  }                  }
750    
# Line 751  Line 760 
760                  pFrame->length = BitstreamLength(&bs);                  pFrame->length = BitstreamLength(&bs);
761                  pFrame->intra = 2;                  pFrame->intra = 2;
762    
763                    if (pResult) {
764                            pResult->quant = pEnc->current->quant;
765                            pResult->hlength = pFrame->length - (pEnc->current->sStat.iTextBits / 8);
766                            pResult->kblks = pEnc->current->sStat.kblks;
767                            pResult->mblks = pEnc->current->sStat.mblks;
768                            pResult->ublks = pEnc->current->sStat.ublks;
769                    }
770    
771                  if (input_valid)                  if (input_valid)
772                          queue_image(pEnc, pFrame);                          queue_image(pEnc, pFrame);
773    
# Line 787  Line 804 
804                          pFrame->length = BitstreamLength(&bs);                          pFrame->length = BitstreamLength(&bs);
805                          pFrame->intra = 4;                          pFrame->intra = 4;
806    
807                            if (pResult) {
808                                    pResult->quant = pEnc->current->quant;
809                                    pResult->hlength = pFrame->length - (pEnc->current->sStat.iTextBits / 8);
810                                    pResult->kblks = pEnc->current->sStat.kblks;
811                                    pResult->mblks = pEnc->current->sStat.mblks;
812                                    pResult->ublks = pEnc->current->sStat.ublks;
813                            }
814    
815                          if (input_valid)                          if (input_valid)
816                                  queue_image(pEnc, pFrame);                                  queue_image(pEnc, pFrame);
817    
# Line 862  Line 887 
887    
888                  //      BitstreamPutBits(&bs, 0x7f, 8);                  //      BitstreamPutBits(&bs, 0x7f, 8);
889                          pFrame->intra = 5;                          pFrame->intra = 5;
890    
891                            if (pResult) {
892                                    /*
893                                     * We must decide what to put there because i know some apps
894                                     * are storing statistics about quantizers and just do
895                                     * stats[quant]++ or stats[quant-1]++
896                                     * transcode is one of these app with its 2pass module
897                                     */
898    
899                                    /*
900                                     * For now i prefer 31 than 0 that could lead to a segfault
901                                     * in transcode
902                                     */
903                                    pResult->quant = 31;
904    
905                                    pResult->hlength = 0;
906                                    pResult->kblks = 0;
907                                    pResult->mblks = 0;
908                                    pResult->ublks = 0;
909                            }
910    
911                    } else {
912    
913                            if (pResult) {
914                                    pResult->quant = pEnc->current->quant;
915                                    pResult->hlength = pFrame->length - (pEnc->current->sStat.iTextBits / 8);
916                                    pResult->kblks = pEnc->current->sStat.kblks;
917                                    pResult->mblks = pEnc->current->sStat.mblks;
918                                    pResult->ublks = pEnc->current->sStat.ublks;
919                            }
920    
921                  }                  }
922    
923                  pFrame->length = BitstreamLength(&bs);                  pFrame->length = BitstreamLength(&bs);
924    
925                  emms();                  emms();
926    
927                  return XVID_ERR_OK;                  return XVID_ERR_OK;
928          }          }
929    
# Line 1002  Line 1060 
1060                          }                          }
1061                          FrameCodeP(pEnc, &bs, &bits, 1, 0);                          FrameCodeP(pEnc, &bs, &bits, 1, 0);
1062                          bframes_count = 0;                          bframes_count = 0;
   
1063                          pFrame->intra = 0;                          pFrame->intra = 0;
1064    
1065                  } else {                  } else {
# Line 1026  Line 1083 
1083                   * NB : sequences like "IIBB" decode fine with msfdam but,                   * NB : sequences like "IIBB" decode fine with msfdam but,
1084                   *      go screwy with divx 5.00                   *      go screwy with divx 5.00
1085                   */                   */
1086          } else if (mode == P_VOP || pEnc->bframenum_tail >= pEnc->mbParam.max_bframes) {          } else if (mode == P_VOP || mode == S_VOP || pEnc->bframenum_tail >= pEnc->mbParam.max_bframes) {
1087                  /*                  /*
1088                   * This will be coded as a Predicted Frame                   * This will be coded as a Predicted Frame
1089                   */                   */
# Line 1767  Line 1824 
1824                                          pEnc->vGMC.y + 16*y*pEnc->mbParam.edged_width + 16*x,                                          pEnc->vGMC.y + 16*y*pEnc->mbParam.edged_width + 16*x,
1825                                          pEnc->mbParam.edged_width, 65536);                                          pEnc->mbParam.edged_width, 65536);
1826    
1827                                    if (pEnc->current->motion_flags & PMV_CHROMA16) {
1828                                            iSAD += sad8(pEnc->current->image.u + 8*y*(pEnc->mbParam.edged_width/2) + 8*x,
1829                                            pEnc->vGMC.u + 8*y*(pEnc->mbParam.edged_width/2) + 8*x, pEnc->mbParam.edged_width/2);
1830    
1831                                            iSAD += sad8(pEnc->current->image.v + 8*y*(pEnc->mbParam.edged_width/2) + 8*x,
1832                                            pEnc->vGMC.v + 8*y*(pEnc->mbParam.edged_width/2) + 8*x, pEnc->mbParam.edged_width/2);
1833                                    }
1834    
1835                                  if (iSAD <= pMB->sad16) {               /* mode decision GMC */                                  if (iSAD <= pMB->sad16) {               /* mode decision GMC */
1836    
1837                                          if (pEnc->mbParam.m_quarterpel)                                          if (pEnc->mbParam.m_quarterpel)

Legend:
Removed from v.1.76.2.37  
changed lines
  Added in v.1.76.2.40

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