[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.28.2.14, Sun Dec 29 04:55:51 2002 UTC revision 1.28.2.19, Tue Jan 14 10:30:39 2003 UTC
# Line 41  Line 41 
41    *                                                                            *    *                                                                            *
42    *  Revision history:                                                         *    *  Revision history:                                                         *
43    *                                                                            *    *                                                                            *
44    *  28.10.2002 GMC support - gruel                                                                                        *    *  05.01.2003 GMC support - gruel                                            *
45    *  04.10.2002 qpel support - Isibaar                                                                             *    *  04.10.2002 qpel support - Isibaar                                                                             *
46    *  11.07.2002 add VOP width & height return to dec when dec->width           *    *  11.07.2002 add VOP width & height return to dec when dec->width           *
47    *             or dec->height is 0  (for use in examples/ex1.c)               *    *             or dec->height is 0  (for use in examples/ex1.c)               *
# Line 230  Line 230 
230                          if (coding_type == B_VOP && fcode_backward)                          if (coding_type == B_VOP && fcode_backward)
231                          {                          {
232                                  *fcode_backward = BitstreamGetBits(bs, 3);                                  *fcode_backward = BitstreamGetBits(bs, 3);
233                                  DPRINTF(DPRINTF_HEADER,"fcode_backward %i", fcode_backward);                                  DPRINTF(DPRINTF_HEADER,"fcode_backward %i", *fcode_backward);
234                          }                          }
235                  }                  }
236    
# Line 432  Line 432 
432                                           uint32_t * fcode_forward,                                           uint32_t * fcode_forward,
433                                           uint32_t * fcode_backward,                                           uint32_t * fcode_backward,
434                                           uint32_t * intra_dc_threshold,                                           uint32_t * intra_dc_threshold,
435                                           VECTOR * gmc_mv)                                           WARPPOINTS *gmc_warp)
436  {  {
437          uint32_t vol_ver_id;          uint32_t vol_ver_id;
438          uint32_t coding_type;          uint32_t coding_type;
# Line 472  Line 472 
472                          if (BitstreamGetBit(bs))        // is_visual_object_identified                          if (BitstreamGetBit(bs))        // is_visual_object_identified
473                          {                          {
474                                  visobj_ver_id = BitstreamGetBits(bs, 4);        // visual_object_ver_id                                  visobj_ver_id = BitstreamGetBits(bs, 4);        // visual_object_ver_id
475                                  DPRINTF(DPRINTF_HEADER,"ver_id %i", vol_ver_id);                                  DPRINTF(DPRINTF_HEADER,"visobj_ver_id %i", visobj_ver_id);
476                                  BitstreamSkip(bs, 3);   // visual_object_priority                                  BitstreamSkip(bs, 3);   // visual_object_priority
477                          } else {                          } else {
478                                  visobj_ver_id = 1;                                  visobj_ver_id = 1;
# Line 827  Line 827 
827                                  READ_MARKER();                                  READ_MARKER();
828                                  seconds = BitstreamGetBits(bs, 6);                                  seconds = BitstreamGetBits(bs, 6);
829    
830                                  DPRINTF(DPRINTF_HEADER, "time %ih%im%is", hours);                                  DPRINTF(DPRINTF_HEADER, "time %ih%im%is", hours,minutes,seconds);
831                          }                          }
832                          BitstreamSkip(bs, 1);   // closed_gov                          BitstreamSkip(bs, 1);   // closed_gov
833                          BitstreamSkip(bs, 1);   // broken_link                          BitstreamSkip(bs, 1);   // broken_link
# Line 1001  Line 1001 
1001                                          }                                          }
1002                                          READ_MARKER();                                          READ_MARKER();
1003    
1004                                          gmc_mv[i].x = x;                                          gmc_warp->duv[i].x = x;
1005                                          gmc_mv[i].y = y;                                          gmc_warp->duv[i].y = y;
1006    
1007                                          DPRINTF(DPRINTF_HEADER,"sprite_warping_point[%i] xy=(%i,%i)", i, x, y);                                          DPRINTF(DPRINTF_HEADER,"sprite_warping_point[%i] xy=(%i,%i)", i, x, y);
1008                                  }                                  }
# Line 1131  Line 1131 
1131                  profile = 0xf3; /* advanced simple profile/level 2 */                  profile = 0xf3; /* advanced simple profile/level 2 */
1132    
1133          // visual_object_sequence_start_code          // visual_object_sequence_start_code
1134          BitstreamPad(bs);  //      BitstreamPad(bs);
1135    /* no padding here, anymore. You have to make sure that you are
1136       byte aligned, and that always 1-8 padding bits have been written */
1137    
1138          BitstreamPutBits(bs, VISOBJSEQ_START_CODE, 32);          BitstreamPutBits(bs, VISOBJSEQ_START_CODE, 32);
1139          BitstreamPutBits(bs, profile, 8);          BitstreamPutBits(bs, profile, 8);
1140    
# Line 1146  Line 1149 
1149          BitstreamPutBits(bs, VIDOBJ_START_CODE|(vo_id&0x5), 32);          BitstreamPutBits(bs, VIDOBJ_START_CODE|(vo_id&0x5), 32);
1150    
1151          // video_object_layer_start_code & vol_id          // video_object_layer_start_code & vol_id
1152            BitstreamPad(bs);
1153          BitstreamPutBits(bs, VIDOBJLAY_START_CODE|(vol_id&0x4), 32);          BitstreamPutBits(bs, VIDOBJLAY_START_CODE|(vol_id&0x4), 32);
1154    
1155          BitstreamPutBit(bs, 0);         // random_accessible_vol          BitstreamPutBit(bs, 0);         // random_accessible_vol
# Line 1255  Line 1259 
1259    
1260          BitstreamPutBit(bs, 0);         // scalability          BitstreamPutBit(bs, 0);         // scalability
1261    
1262            /* fake divx5 id, to ensure compatibility with divx5 decoder */
1263    #define DIVX5_ID "DivX501b481p"
1264            if (pParam->max_bframes > 0 && (pParam->global & XVID_GLOBAL_PACKED)) {
1265                    BitstreamWriteUserData(bs, DIVX5_ID, strlen(DIVX5_ID));
1266            }
1267    
1268            /* xvid id */
1269    #define XVID_ID "XviD" XVID_BS_VERSION
1270            BitstreamWriteUserData(bs, XVID_ID, strlen(XVID_ID));
1271  }  }
1272    
1273    
# Line 1270  Line 1283 
1283  {  {
1284          uint32_t i;          uint32_t i;
1285    
1286          BitstreamPad(bs);  //      BitstreamPad(bs);
1287    /* no padding here, anymore. You have to make sure that you are
1288       byte aligned, and that always 1-8 padding bits have been written */
1289    
1290          BitstreamPutBits(bs, VOP_START_CODE, 32);          BitstreamPutBits(bs, VOP_START_CODE, 32);
1291    
1292          BitstreamPutBits(bs, frame->coding_type, 2);          BitstreamPutBits(bs, frame->coding_type, 2);
# Line 1313  Line 1329 
1329          }          }
1330    
1331          if (frame->coding_type == S_VOP) {          if (frame->coding_type == S_VOP) {
1332                  if (1)  {               // no_of_sprite_warping_points>=1                  if (1)  {               // no_of_sprite_warping_points>=1 (we use 2!)
1333                          if (pParam->m_quarterpel)                          int k;
1334                                  bs_put_spritetrajectory(bs, frame->GMC_MV.x/2 ); // du[0]                          for (k=0;k<2;k++)
1335                          else                          {
1336                                  bs_put_spritetrajectory(bs, frame->GMC_MV.x ); // du[0]                                  bs_put_spritetrajectory(bs, frame->warp.duv[k].x ); // du[k]
1337                          WRITE_MARKER();                          WRITE_MARKER();
1338    
1339                          if (pParam->m_quarterpel)                                  bs_put_spritetrajectory(bs, frame->warp.duv[k].y ); // dv[k]
                                 bs_put_spritetrajectory(bs, frame->GMC_MV.y/2 ); // dv[0]  
                         else  
                                 bs_put_spritetrajectory(bs, frame->GMC_MV.y ); // dv[0]  
1340                          WRITE_MARKER();                          WRITE_MARKER();
1341    
   
1342                          if (pParam->m_quarterpel)                          if (pParam->m_quarterpel)
1343                          {                          {
1344                                  DPRINTF(DPRINTF_HEADER,"sprite_warping_point[%i] xy=(%i,%i) *QPEL*", 0, frame->GMC_MV.x/2, frame->GMC_MV.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);
1345                          }                          }
1346                          else                          else
1347                          {                          {
1348                                  DPRINTF(DPRINTF_HEADER,"sprite_warping_point[%i] xy=(%i,%i)", 0, frame->GMC_MV.x, frame->GMC_MV.y);                                  DPRINTF(DPRINTF_HEADER,"sprite_warping_point[%i] xy=(%i,%i)", k, frame->warp.duv[k].x, frame->warp.duv[k].y);
1349                          }                          }
   
1350                  }                  }
 /* GMC is halfpel in bitstream, even though GMC_MV was pseudo-qpel (2*halfpel) */  
   
                 if (2) {                // no_of_sprite_warping_points>=2 (for DivX5 compat)  
                         bs_put_spritetrajectory(bs, 0 );  
                         WRITE_MARKER();  
                         bs_put_spritetrajectory(bs, 0 );  
                         WRITE_MARKER();  
1351                  }                  }
                 // no support for brightness_change!  
1352          }          }
1353    
1354    

Legend:
Removed from v.1.28.2.14  
changed lines
  Added in v.1.28.2.19

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