[cvs] / xvidcore / src / bitstream / bitstream.c Repository:
ViewVC logotype

Diff of /xvidcore/src/bitstream/bitstream.c

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

revision 1.39, Wed Feb 19 21:59:30 2003 UTC revision 1.39.2.3, Sat Mar 15 17:03:17 2003 UTC
# Line 640  Line 640 
640                                          {                                          {
641                                                  if (dec->fixed_dimensions)                                                  if (dec->fixed_dimensions)
642                                                  {                                                  {
643                                                          DPRINTF(DPRINTF_ERROR, "XVID_DEC_PARAM width/height does not match bitstream");                                                          DPRINTF(DPRINTF_ERROR, "decoder width/height does not match bitstream");
644                                                          return -1;                                                          return -1;
645                                                  }                                                  }
646                                                  resize = 1;                                                  resize = 1;
# Line 1068  Line 1068 
1068                                  BitstreamSkip(bs, 8);                                  BitstreamSkip(bs, 8);
1069                          }                          }
1070    
1071                          DPRINTF(DPRINTF_STARTCODE, "<user_data>: %s\n", tmp);                          DPRINTF(DPRINTF_STARTCODE, "<user_data>: %s", tmp);
1072    
1073                      /* divx detection */                      /* divx detection */
1074                          i = sscanf(tmp, "DivX%dBuild%d%c", &version, &build, &packed);                          i = sscanf(tmp, "DivX%dBuild%d%c", &version, &build, &packed);
# Line 1123  Line 1123 
1123  */  */
1124  void  void
1125  BitstreamWriteVolHeader(Bitstream * const bs,  BitstreamWriteVolHeader(Bitstream * const bs,
1126                                                  const MBParam * pParam,                                                  const MBParam * pParam)
                                                 const FRAMEINFO * const frame)  
1127  {  {
1128          static const unsigned int vo_id = 0;          static const unsigned int vo_id = 0;
1129          static const unsigned int vol_id = 0;          static const unsigned int vol_id = 0;
1130          int vol_ver_id=1;          int vol_ver_id=1;
1131          int profile = 0x03;     /* simple profile/level 3 */          int profile = 0x03;     /* simple profile/level 3 */
1132    
1133          if ( pParam->m_quarterpel ||  (frame->global_flags & XVID_GMC) ||          if ( (pParam->vol_flags & XVID_QUARTERPEL) ||
1134                   (pParam->global & XVID_GLOBAL_REDUCED))           (pParam->vol_flags & XVID_GMC) ||
1135                     (pParam->vol_flags & XVID_REDUCED_ENABLE))
1136                  vol_ver_id = 2;                  vol_ver_id = 2;
1137    
1138          if ((pParam->global & XVID_GLOBAL_REDUCED))          if ((pParam->vol_flags & XVID_REDUCED_ENABLE))
1139                  profile = 0x93; /* advanced realtime simple profile/level 3 */                  profile = 0x93; /* advanced realtime simple profile/level 3 */
1140    
1141          if (pParam->m_quarterpel ||  (frame->global_flags & XVID_GMC))          if ((pParam->vol_flags & XVID_QUARTERPEL) ||
1142            (pParam->vol_flags & XVID_GMC))
1143                  profile = 0xf3; /* advanced simple profile/level 2 */                  profile = 0xf3; /* advanced simple profile/level 2 */
1144    
1145          // visual_object_sequence_start_code          // visual_object_sequence_start_code
# Line 1203  Line 1204 
1204    
1205          WRITE_MARKER();          WRITE_MARKER();
1206    
1207        if (pParam->fincr>0) {
1208          BitstreamPutBit(bs, 1);         // fixed_vop_rate = 1          BitstreamPutBit(bs, 1);         // fixed_vop_rate = 1
1209          BitstreamPutBits(bs, pParam->fincr, log2bin(pParam->fbase));    // fixed_vop_time_increment          BitstreamPutBits(bs, pParam->fincr, log2bin(pParam->fbase));    // fixed_vop_time_increment
1210        }else{
1211            BitstreamPutBit(bs, 0);         // fixed_vop_rate = 0
1212        }
1213    
1214          WRITE_MARKER();          WRITE_MARKER();
1215          BitstreamPutBits(bs, pParam->width, 13);        // width          BitstreamPutBits(bs, pParam->width, 13);        // width
# Line 1212  Line 1217 
1217          BitstreamPutBits(bs, pParam->height, 13);       // height          BitstreamPutBits(bs, pParam->height, 13);       // height
1218          WRITE_MARKER();          WRITE_MARKER();
1219    
1220          BitstreamPutBit(bs, frame->global_flags & XVID_INTERLACING);    // interlace          BitstreamPutBit(bs, pParam->vol_flags & XVID_INTERLACING);      // interlace
1221          BitstreamPutBit(bs, 1);         // obmc_disable (overlapped block motion compensation)          BitstreamPutBit(bs, 1);         // obmc_disable (overlapped block motion compensation)
1222    
1223          if (vol_ver_id != 1)          if (vol_ver_id != 1)
1224          {       if (frame->global_flags & XVID_GMC)          {       if ((pParam->vol_flags & XVID_GMC))
1225                  {       BitstreamPutBits(bs, 2, 2);             // sprite_enable=='GMC'                  {       BitstreamPutBits(bs, 2, 2);             // sprite_enable=='GMC'
1226                          BitstreamPutBits(bs, 2, 6);             // no_of_sprite_warping_points                          BitstreamPutBits(bs, 2, 6);             // no_of_sprite_warping_points
1227                          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 1239 
1239          BitstreamPutBit(bs, 0);         // not_8_bit          BitstreamPutBit(bs, 0);         // not_8_bit
1240    
1241          // quant_type   0=h.263  1=mpeg4(quantizer tables)          // quant_type   0=h.263  1=mpeg4(quantizer tables)
1242          BitstreamPutBit(bs, pParam->m_quant_type);          BitstreamPutBit(bs, pParam->vol_flags & XVID_MPEGQUANT);
1243    
1244          if (pParam->m_quant_type) {          if ((pParam->vol_flags & XVID_MPEGQUANT)) {
1245                  BitstreamPutBit(bs, get_intra_matrix_status()); // load_intra_quant_mat                  BitstreamPutBit(bs, get_intra_matrix_status()); // load_intra_quant_mat
1246                  if (get_intra_matrix_status()) {                  if (get_intra_matrix_status()) {
1247                          bs_put_matrix(bs, get_intra_matrix());                          bs_put_matrix(bs, get_intra_matrix());
# Line 1250  Line 1255 
1255          }          }
1256    
1257          if (vol_ver_id != 1) {          if (vol_ver_id != 1) {
1258                  if (pParam->m_quarterpel)                  if ((pParam->vol_flags & XVID_QUARTERPEL))
1259                          BitstreamPutBit(bs, 1);         //  quarterpel                          BitstreamPutBit(bs, 1);         //  quarterpel
1260                  else                  else
1261                          BitstreamPutBit(bs, 0);         // no quarterpel                          BitstreamPutBit(bs, 0);         // no quarterpel
# Line 1264  Line 1269 
1269          {          {
1270                  BitstreamPutBit(bs, 0);         // newpred_enable                  BitstreamPutBit(bs, 0);         // newpred_enable
1271    
1272                  BitstreamPutBit(bs, (pParam->global & XVID_GLOBAL_REDUCED)?1:0);                  BitstreamPutBit(bs, (pParam->vol_flags & XVID_REDUCED_ENABLE)?1:0);
1273                                                                          /* reduced_resolution_vop_enabled */                                                                          /* reduced_resolution_vop_enabled */
1274          }          }
1275    
1276          BitstreamPutBit(bs, 0);         // scalability          BitstreamPutBit(bs, 0);         // scalability
1277    
1278          /* fake divx5 id, to ensure compatibility with divx5 decoder */          /* fake divx5 id, to ensure compatibility with divx5 decoder */
1279  #define DIVX5_ID "DivX501b481p"  #define DIVX5_ID "DivX000b000p"
1280          if (pParam->max_bframes > 0 && (pParam->global & XVID_GLOBAL_PACKED)) {          if (pParam->max_bframes > 0 && (pParam->global_flags & XVID_PACKED)) {
1281                  BitstreamWriteUserData(bs, DIVX5_ID, strlen(DIVX5_ID));                  BitstreamWriteUserData(bs, DIVX5_ID, strlen(DIVX5_ID));
1282          }          }
1283    
# Line 1329  Line 1334 
1334          if ( (frame->coding_type == P_VOP) || (frame->coding_type == S_VOP) )          if ( (frame->coding_type == P_VOP) || (frame->coding_type == S_VOP) )
1335                  BitstreamPutBits(bs, frame->rounding_type, 1);                  BitstreamPutBits(bs, frame->rounding_type, 1);
1336    
1337          if ((pParam->global & XVID_GLOBAL_REDUCED))          if ((frame->vol_flags & XVID_REDUCED_ENABLE))
1338                  BitstreamPutBit(bs, (frame->global_flags & XVID_REDUCED)?1:0);                  BitstreamPutBit(bs, (frame->vop_flags & XVID_REDUCED)?1:0);
1339    
1340          BitstreamPutBits(bs, 0, 3);     // intra_dc_vlc_threshold          BitstreamPutBits(bs, 0, 3);     // intra_dc_vlc_threshold
1341    
1342          if (frame->global_flags & XVID_INTERLACING) {          if ((frame->vol_flags & XVID_INTERLACING)) {
1343                  BitstreamPutBit(bs, (frame->global_flags & XVID_TOPFIELDFIRST));                  BitstreamPutBit(bs, (frame->vop_flags & XVID_TOPFIELDFIRST));
1344                  BitstreamPutBit(bs, (frame->global_flags & XVID_ALTERNATESCAN));                  BitstreamPutBit(bs, (frame->vop_flags & XVID_ALTERNATESCAN));
1345          }          }
1346    
1347          if (frame->coding_type == S_VOP) {          if (frame->coding_type == S_VOP) {
# Line 1350  Line 1355 
1355                                  bs_put_spritetrajectory(bs, frame->warp.duv[k].y ); // dv[k]                                  bs_put_spritetrajectory(bs, frame->warp.duv[k].y ); // dv[k]
1356                                  WRITE_MARKER();                                  WRITE_MARKER();
1357    
1358                          if (pParam->m_quarterpel)                          if ((frame->vol_flags & XVID_QUARTERPEL))
1359                          {                          {
1360                                  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);
1361                          }                          }

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.39.2.3

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