[svn] / branches / dev-api-4 / xvidcore / src / bitstream / bitstream.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/src/bitstream/bitstream.c

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

revision 886, Fri Feb 21 14:49:29 2003 UTC revision 949, Wed Mar 26 14:56:49 2003 UTC
# Line 522  Line 522 
522                                  BitstreamShowBits(bs, 8) != VIDOBJLAY_TYPE_MAIN &&                                  BitstreamShowBits(bs, 8) != VIDOBJLAY_TYPE_MAIN &&
523                                  BitstreamShowBits(bs, 8) != VIDOBJLAY_TYPE_ACE &&                                  BitstreamShowBits(bs, 8) != VIDOBJLAY_TYPE_ACE &&
524                                  BitstreamShowBits(bs, 8) != VIDOBJLAY_TYPE_ART_SIMPLE &&                                  BitstreamShowBits(bs, 8) != VIDOBJLAY_TYPE_ART_SIMPLE &&
525                    BitstreamShowBits(bs, 8) != VIDOBJLAY_TYPE_ASP &&
526                                  BitstreamShowBits(bs, 8) != 0)  // BUGGY DIVX                                  BitstreamShowBits(bs, 8) != 0)  // BUGGY DIVX
527                          {                          {
528                                  DPRINTF(DPRINTF_ERROR,"video_object_type_indication %i not supported ",                                  DPRINTF(DPRINTF_ERROR,"video_object_type_indication %i not supported ",
# Line 640  Line 641 
641                                          {                                          {
642                                                  if (dec->fixed_dimensions)                                                  if (dec->fixed_dimensions)
643                                                  {                                                  {
644                                                          DPRINTF(DPRINTF_ERROR, "XVID_DEC_PARAM width/height does not match bitstream");                                                          DPRINTF(DPRINTF_ERROR, "decoder width/height does not match bitstream");
645                                                          return -1;                                                          return -1;
646                                                  }                                                  }
647                                                  resize = 1;                                                  resize = 1;
# Line 1068  Line 1069 
1069                                  BitstreamSkip(bs, 8);                                  BitstreamSkip(bs, 8);
1070                          }                          }
1071    
1072                          DPRINTF(DPRINTF_STARTCODE, "<user_data>: %s\n", tmp);                          DPRINTF(DPRINTF_STARTCODE, "<user_data>: %s", tmp);
1073    
1074                      /* divx detection */                      /* divx detection */
1075                          i = sscanf(tmp, "DivX%dBuild%d%c", &version, &build, &packed);                          i = sscanf(tmp, "DivX%dBuild%d%c", &version, &build, &packed);
# Line 1123  Line 1124 
1124  */  */
1125  void  void
1126  BitstreamWriteVolHeader(Bitstream * const bs,  BitstreamWriteVolHeader(Bitstream * const bs,
1127                                                  const MBParam * pParam,                                                  const MBParam * pParam)
                                                 const FRAMEINFO * const frame)  
1128  {  {
1129          static const unsigned int vo_id = 0;          static const unsigned int vo_id = 0;
1130          static const unsigned int vol_id = 0;          static const unsigned int vol_id = 0;
1131          int vol_ver_id=1;          int vol_ver_id=1;
1132          int profile = 0x03;     /* simple profile/level 3 */          int profile = 0x03;     /* simple profile/level 3 */
1133        int vol_type_ind=VIDOBJLAY_TYPE_SIMPLE;
1134    
1135          if ( pParam->m_quarterpel ||  (frame->global_flags & XVID_GMC) ||          if ( (pParam->vol_flags & XVID_VOL_QUARTERPEL) ||
1136                   (pParam->global & XVID_GLOBAL_REDUCED))           (pParam->vol_flags & XVID_VOL_GMC) ||
1137                     (pParam->vol_flags & XVID_VOL_REDUCED_ENABLE))
1138                  vol_ver_id = 2;                  vol_ver_id = 2;
1139    
1140          if ((pParam->global & XVID_GLOBAL_REDUCED))      if ((pParam->vol_flags & XVID_VOL_REDUCED_ENABLE)) {
1141                  profile = 0x93; /* advanced realtime simple profile/level 3 */                  profile = 0x93; /* advanced realtime simple profile/level 3 */
1142            vol_type_ind = VIDOBJLAY_TYPE_ART_SIMPLE;
1143        }
1144    
1145          if (pParam->m_quarterpel ||  (frame->global_flags & XVID_GMC))          if ((pParam->vol_flags & XVID_VOL_QUARTERPEL) ||
1146            (pParam->vol_flags & XVID_VOL_GMC)) {
1147                  profile = 0xf3; /* advanced simple profile/level 2 */                  profile = 0xf3; /* advanced simple profile/level 2 */
1148            vol_type_ind = VIDOBJLAY_TYPE_ASP;
1149        }
1150    
1151          // visual_object_sequence_start_code          // visual_object_sequence_start_code
1152  //      BitstreamPad(bs);  //      BitstreamPad(bs);
# Line 1203  Line 1210 
1210    
1211          WRITE_MARKER();          WRITE_MARKER();
1212    
1213        if (pParam->fincr>0) {
1214          BitstreamPutBit(bs, 1);         // fixed_vop_rate = 1          BitstreamPutBit(bs, 1);         // fixed_vop_rate = 1
1215          BitstreamPutBits(bs, pParam->fincr, log2bin(pParam->fbase));    // fixed_vop_time_increment          BitstreamPutBits(bs, pParam->fincr, log2bin(pParam->fbase));    // fixed_vop_time_increment
1216        }else{
1217            BitstreamPutBit(bs, 0);         // fixed_vop_rate = 0
1218        }
1219    
1220          WRITE_MARKER();          WRITE_MARKER();
1221          BitstreamPutBits(bs, pParam->width, 13);        // width          BitstreamPutBits(bs, pParam->width, 13);        // width
# Line 1212  Line 1223 
1223          BitstreamPutBits(bs, pParam->height, 13);       // height          BitstreamPutBits(bs, pParam->height, 13);       // height
1224          WRITE_MARKER();          WRITE_MARKER();
1225    
1226          BitstreamPutBit(bs, frame->global_flags & XVID_INTERLACING);    // interlace          BitstreamPutBit(bs, pParam->vol_flags & XVID_VOL_INTERLACING);  // interlace
1227          BitstreamPutBit(bs, 1);         // obmc_disable (overlapped block motion compensation)          BitstreamPutBit(bs, 1);         // obmc_disable (overlapped block motion compensation)
1228    
1229          if (vol_ver_id != 1)          if (vol_ver_id != 1)
1230          {       if (frame->global_flags & XVID_GMC)          {       if ((pParam->vol_flags & XVID_VOL_GMC))
1231                  {       BitstreamPutBits(bs, 2, 2);             // sprite_enable=='GMC'                  {       BitstreamPutBits(bs, 2, 2);             // sprite_enable=='GMC'
1232                          BitstreamPutBits(bs, 2, 6);             // no_of_sprite_warping_points                          BitstreamPutBits(bs, 2, 6);             // no_of_sprite_warping_points
1233                          BitstreamPutBits(bs, 3, 2);             // sprite_warping_accuracy 0==1/2, 1=1/4, 2=1/8, 3=1/16                          BitstreamPutBits(bs, 3, 2);             // sprite_warping_accuracy 0==1/2, 1=1/4, 2=1/8, 3=1/16
# Line 1234  Line 1245 
1245          BitstreamPutBit(bs, 0);         // not_8_bit          BitstreamPutBit(bs, 0);         // not_8_bit
1246    
1247          // quant_type   0=h.263  1=mpeg4(quantizer tables)          // quant_type   0=h.263  1=mpeg4(quantizer tables)
1248          BitstreamPutBit(bs, pParam->m_quant_type);          BitstreamPutBit(bs, pParam->vol_flags & XVID_VOL_MPEGQUANT);
1249    
1250          if (pParam->m_quant_type) {          if ((pParam->vol_flags & XVID_VOL_MPEGQUANT)) {
1251                  BitstreamPutBit(bs, get_intra_matrix_status()); // load_intra_quant_mat                  BitstreamPutBit(bs, get_intra_matrix_status()); // load_intra_quant_mat
1252                  if (get_intra_matrix_status()) {                  if (get_intra_matrix_status()) {
1253                          bs_put_matrix(bs, get_intra_matrix());                          bs_put_matrix(bs, get_intra_matrix());
# Line 1250  Line 1261 
1261          }          }
1262    
1263          if (vol_ver_id != 1) {          if (vol_ver_id != 1) {
1264                  if (pParam->m_quarterpel)                  if ((pParam->vol_flags & XVID_VOL_QUARTERPEL))
1265                          BitstreamPutBit(bs, 1);         //  quarterpel                          BitstreamPutBit(bs, 1);         //  quarterpel
1266                  else                  else
1267                          BitstreamPutBit(bs, 0);         // no quarterpel                          BitstreamPutBit(bs, 0);         // no quarterpel
# Line 1264  Line 1275 
1275          {          {
1276                  BitstreamPutBit(bs, 0);         // newpred_enable                  BitstreamPutBit(bs, 0);         // newpred_enable
1277    
1278                  BitstreamPutBit(bs, (pParam->global & XVID_GLOBAL_REDUCED)?1:0);                  BitstreamPutBit(bs, (pParam->vol_flags & XVID_VOL_REDUCED_ENABLE)?1:0);
1279                                                                          /* reduced_resolution_vop_enabled */                                                                          /* reduced_resolution_vop_enabled */
1280          }          }
1281    
1282          BitstreamPutBit(bs, 0);         // scalability          BitstreamPutBit(bs, 0);         // scalability
1283    
1284          /* fake divx5 id, to ensure compatibility with divx5 decoder */          /* fake divx5 id, to ensure compatibility with divx5 decoder */
1285  #define DIVX5_ID "DivX501b481p"  #define DIVX5_ID "DivX000b000p"
1286          if (pParam->max_bframes > 0 && (pParam->global & XVID_GLOBAL_PACKED)) {          if (pParam->max_bframes > 0 && (pParam->global_flags & XVID_GLOBAL_PACKED)) {
1287                  BitstreamWriteUserData(bs, DIVX5_ID, strlen(DIVX5_ID));                  BitstreamWriteUserData(bs, DIVX5_ID, strlen(DIVX5_ID));
1288          }          }
1289    
# Line 1329  Line 1340 
1340          if ( (frame->coding_type == P_VOP) || (frame->coding_type == S_VOP) )          if ( (frame->coding_type == P_VOP) || (frame->coding_type == S_VOP) )
1341                  BitstreamPutBits(bs, frame->rounding_type, 1);                  BitstreamPutBits(bs, frame->rounding_type, 1);
1342    
1343          if ((pParam->global & XVID_GLOBAL_REDUCED))          if ((frame->vol_flags & XVID_VOL_REDUCED_ENABLE))
1344                  BitstreamPutBit(bs, (frame->global_flags & XVID_REDUCED)?1:0);                  BitstreamPutBit(bs, (frame->vop_flags & XVID_VOP_REDUCED)?1:0);
1345    
1346          BitstreamPutBits(bs, 0, 3);     // intra_dc_vlc_threshold          BitstreamPutBits(bs, 0, 3);     // intra_dc_vlc_threshold
1347    
1348          if (frame->global_flags & XVID_INTERLACING) {          if ((frame->vol_flags & XVID_VOL_INTERLACING)) {
1349                  BitstreamPutBit(bs, (frame->global_flags & XVID_TOPFIELDFIRST));                  BitstreamPutBit(bs, (frame->vop_flags & XVID_VOP_TOPFIELDFIRST));
1350                  BitstreamPutBit(bs, (frame->global_flags & XVID_ALTERNATESCAN));                  BitstreamPutBit(bs, (frame->vop_flags & XVID_VOP_ALTERNATESCAN));
1351          }          }
1352    
1353          if (frame->coding_type == S_VOP) {          if (frame->coding_type == S_VOP) {
# Line 1350  Line 1361 
1361                                  bs_put_spritetrajectory(bs, frame->warp.duv[k].y ); // dv[k]                                  bs_put_spritetrajectory(bs, frame->warp.duv[k].y ); // dv[k]
1362                                  WRITE_MARKER();                                  WRITE_MARKER();
1363    
1364                          if (pParam->m_quarterpel)                          if ((frame->vol_flags & XVID_VOL_QUARTERPEL))
1365                          {                          {
1366                                  DPRINTF(DPRINTF_HEADER,"sprite_warping_point[%i] xy=(%i,%i) *QPEL*", k, frame->warp.duv[k].x/2, frame->warp.duv[k].y/2);                                  DPRINTF(DPRINTF_HEADER,"sprite_warping_point[%i] xy=(%i,%i) *QPEL*", k, frame->warp.duv[k].x/2, frame->warp.duv[k].y/2);
1367                          }                          }

Legend:
Removed from v.886  
changed lines
  Added in v.949

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