[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.38, Mon Jan 13 23:52:50 2003 UTC
# Line 661  Line 661 
661          if (intra < 0)          return -1;          if (intra < 0)          return -1;
662          if (intra == 1)         return I_VOP;          if (intra == 1)         return I_VOP;
663          if (intra == 2)         return B_VOP;          if (intra == 2)         return B_VOP;
664            if (intra == 3) return S_VOP;
665    
666          return P_VOP;          return P_VOP;
667  }  }
# Line 732  Line 733 
733    
734                          BitstreamPadAlways(&bs);                          BitstreamPadAlways(&bs);
735                          pFrame->length = BitstreamLength(&bs);                          pFrame->length = BitstreamLength(&bs);
736                            if(pEnc->current->coding_type == P_VOP)
737                          pFrame->intra = 0;                          pFrame->intra = 0;
738                            else
739                                    pFrame->intra = 3;
740    
741                          emms();                          emms();
742    
743                            if (pResult) {
744                                    pResult->quant = pEnc->current->quant;
745                                    pResult->hlength = pFrame->length - (pEnc->current->sStat.iTextBits / 8);
746                                    pResult->kblks = pEnc->current->sStat.kblks;
747                                    pResult->mblks = pEnc->current->sStat.mblks;
748                                    pResult->ublks = pEnc->current->sStat.ublks;
749                            }
750    
751                          return XVID_ERR_OK;                          return XVID_ERR_OK;
752                  }                  }
753    
# Line 751  Line 763 
763                  pFrame->length = BitstreamLength(&bs);                  pFrame->length = BitstreamLength(&bs);
764                  pFrame->intra = 2;                  pFrame->intra = 2;
765    
766                    if (pResult) {
767                            pResult->quant = pEnc->current->quant;
768                            pResult->hlength = pFrame->length - (pEnc->current->sStat.iTextBits / 8);
769                            pResult->kblks = pEnc->current->sStat.kblks;
770                            pResult->mblks = pEnc->current->sStat.mblks;
771                            pResult->ublks = pEnc->current->sStat.ublks;
772                    }
773    
774                  if (input_valid)                  if (input_valid)
775                          queue_image(pEnc, pFrame);                          queue_image(pEnc, pFrame);
776    
# Line 787  Line 807 
807                          pFrame->length = BitstreamLength(&bs);                          pFrame->length = BitstreamLength(&bs);
808                          pFrame->intra = 4;                          pFrame->intra = 4;
809    
810                            if (pResult) {
811                                    pResult->quant = pEnc->current->quant;
812                                    pResult->hlength = pFrame->length - (pEnc->current->sStat.iTextBits / 8);
813                                    pResult->kblks = pEnc->current->sStat.kblks;
814                                    pResult->mblks = pEnc->current->sStat.mblks;
815                                    pResult->ublks = pEnc->current->sStat.ublks;
816                            }
817    
818                          if (input_valid)                          if (input_valid)
819                                  queue_image(pEnc, pFrame);                                  queue_image(pEnc, pFrame);
820    
# Line 862  Line 890 
890    
891                  //      BitstreamPutBits(&bs, 0x7f, 8);                  //      BitstreamPutBits(&bs, 0x7f, 8);
892                          pFrame->intra = 5;                          pFrame->intra = 5;
893    
894                            if (pResult) {
895                                    /*
896                                     * We must decide what to put there because i know some apps
897                                     * are storing statistics about quantizers and just do
898                                     * stats[quant]++ or stats[quant-1]++
899                                     * transcode is one of these app with its 2pass module
900                                     */
901    
902                                    /*
903                                     * For now i prefer 31 than 0 that could lead to a segfault
904                                     * in transcode
905                                     */
906                                    pResult->quant = 31;
907    
908                                    pResult->hlength = 0;
909                                    pResult->kblks = 0;
910                                    pResult->mblks = 0;
911                                    pResult->ublks = 0;
912                            }
913    
914                    } else {
915    
916                            if (pResult) {
917                                    pResult->quant = pEnc->current->quant;
918                                    pResult->hlength = pFrame->length - (pEnc->current->sStat.iTextBits / 8);
919                                    pResult->kblks = pEnc->current->sStat.kblks;
920                                    pResult->mblks = pEnc->current->sStat.mblks;
921                                    pResult->ublks = pEnc->current->sStat.ublks;
922                            }
923    
924                  }                  }
925    
926                  pFrame->length = BitstreamLength(&bs);                  pFrame->length = BitstreamLength(&bs);
927    
928                  emms();                  emms();
929    
930                  return XVID_ERR_OK;                  return XVID_ERR_OK;
931          }          }
932    
# Line 1003  Line 1064 
1064                          FrameCodeP(pEnc, &bs, &bits, 1, 0);                          FrameCodeP(pEnc, &bs, &bits, 1, 0);
1065                          bframes_count = 0;                          bframes_count = 0;
1066    
1067                            if(pEnc->current->coding_type == P_VOP)
1068                          pFrame->intra = 0;                          pFrame->intra = 0;
1069                            else
1070                                    pFrame->intra = 3;
1071    
1072    
1073                  } else {                  } else {
1074    
# Line 1026  Line 1091 
1091                   * NB : sequences like "IIBB" decode fine with msfdam but,                   * NB : sequences like "IIBB" decode fine with msfdam but,
1092                   *      go screwy with divx 5.00                   *      go screwy with divx 5.00
1093                   */                   */
1094          } 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) {
1095                  /*                  /*
1096                   * This will be coded as a Predicted Frame                   * This will be coded as a Predicted Frame
1097                   */                   */
# Line 1041  Line 1106 
1106    
1107                  FrameCodeP(pEnc, &bs, &bits, 1, 0);                  FrameCodeP(pEnc, &bs, &bits, 1, 0);
1108                  bframes_count = 0;                  bframes_count = 0;
1109                    if(pEnc->current->coding_type == P_VOP)
1110                  pFrame->intra = 0;                  pFrame->intra = 0;
1111                    else
1112                            pFrame->intra = 3;
1113                  pEnc->flush_bframes = 1;                  pEnc->flush_bframes = 1;
1114    
1115                  if ((pEnc->mbParam.global & XVID_GLOBAL_PACKED) && (pEnc->bframenum_tail > 0)) {                  if ((pEnc->mbParam.global & XVID_GLOBAL_PACKED) && (pEnc->bframenum_tail > 0)) {

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

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