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

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

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

revision 1891, Tue Aug 10 15:00:34 2010 UTC revision 2167, Thu Jan 17 14:14:02 2019 UTC
# Line 20  Line 20 
20   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
21   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22   *   *
23   * $Id: bitstream.c,v 1.59 2010-08-10 15:00:06 Isibaar Exp $   * $Id$
24   *   *
25   ****************************************************************************/   ****************************************************************************/
26    
# Line 129  Line 129 
129                  }                  }
130          }          }
131    
132          mbnum = BitstreamGetBits(bs, mbnum_bits);               /* macroblock_number */          mbnum = (mbnum_bits == 0) ? 0 : BitstreamGetBits(bs, mbnum_bits);               /* macroblock_number */
         DPRINTF(XVID_DEBUG_HEADER, "mbnum %i\n", mbnum);  
133    
134          if (dec->shape != VIDOBJLAY_SHAPE_BINARY_ONLY)          if (dec->shape != VIDOBJLAY_SHAPE_BINARY_ONLY)
135          {          {
# Line 1072  Line 1071 
1071  void  void
1072  BitstreamWriteVolHeader(Bitstream * const bs,  BitstreamWriteVolHeader(Bitstream * const bs,
1073                                                  const MBParam * pParam,                                                  const MBParam * pParam,
1074                                                  const FRAMEINFO * const frame)                                                  const FRAMEINFO * const frame,
1075                                                    const int num_slices)
1076  {  {
1077          static const unsigned int vo_id = 0;          static const unsigned int vo_id = 0;
1078          static const unsigned int vol_id = 0;          static const unsigned int vol_id = 0;
# Line 1237  Line 1237 
1237          }          }
1238    
1239          BitstreamPutBit(bs, 1);         /* complexity_estimation_disable */          BitstreamPutBit(bs, 1);         /* complexity_estimation_disable */
1240          BitstreamPutBit(bs, 1);         /* resync_marker_disable */  
1241            if (num_slices > 1)
1242                    BitstreamPutBit(bs, 0);         /* resync_marker_enabled */
1243            else
1244                    BitstreamPutBit(bs, 1);         /* resync_marker_disabled */
1245    
1246          BitstreamPutBit(bs, 0);         /* data_partitioned */          BitstreamPutBit(bs, 0);         /* data_partitioned */
1247    
1248          if (vol_ver_id != 1) {          if (vol_ver_id != 1) {
# Line 1252  Line 1257 
1257          /* divx5 userdata string */          /* divx5 userdata string */
1258  #define DIVX5_ID ((char *)"DivX503b1393")  #define DIVX5_ID ((char *)"DivX503b1393")
1259    if ((pParam->global_flags & XVID_GLOBAL_DIVX5_USERDATA)) {    if ((pParam->global_flags & XVID_GLOBAL_DIVX5_USERDATA)) {
1260      BitstreamWriteUserData(bs, DIVX5_ID, strlen(DIVX5_ID));      BitstreamWriteUserData(bs, DIVX5_ID, (uint32_t)strlen(DIVX5_ID));
1261          if (pParam->max_bframes > 0 && (pParam->global_flags & XVID_GLOBAL_PACKED))          if (pParam->max_bframes > 0 && (pParam->global_flags & XVID_GLOBAL_PACKED))
1262        BitstreamPutBits(bs, 'p', 8);        BitstreamPutBits(bs, 'p', 8);
1263          }          }
# Line 1265  Line 1270 
1270                                  xvid_user_format,                                  xvid_user_format,
1271                                  XVID_BS_VERSION,                                  XVID_BS_VERSION,
1272                                  (frame->vop_flags & XVID_VOP_CARTOON)?'C':'\0');                                  (frame->vop_flags & XVID_VOP_CARTOON)?'C':'\0');
1273                  BitstreamWriteUserData(bs, xvid_user_data, strlen(xvid_user_data));                  BitstreamWriteUserData(bs, xvid_user_data, (uint32_t)strlen(xvid_user_data));
1274          }          }
1275  }  }
1276    
# Line 1386  Line 1391 
1391                                                  const char *data,                                                  const char *data,
1392                                                  const unsigned int length)                                                  const unsigned int length)
1393  {  {
1394          int i;          unsigned int i;
1395    
1396          BitstreamPad(bs);          BitstreamPad(bs);
1397          BitstreamPutBits(bs, USERDATA_START_CODE, 32);          BitstreamPutBits(bs, USERDATA_START_CODE, 32);
# Line 1446  Line 1451 
1451    
1452      if (frame->coding_type == I_VOP)      if (frame->coding_type == I_VOP)
1453        nbitsresyncmarker = NUMBITS_VP_RESYNC_MARKER;  /* 16 zeros followed by a 1. */        nbitsresyncmarker = NUMBITS_VP_RESYNC_MARKER;  /* 16 zeros followed by a 1. */
1454      else if (frame->coding_type == P_VOP)      else if (frame->coding_type == B_VOP) /* B_VOP */
1455        nbitsresyncmarker = NUMBITS_VP_RESYNC_MARKER-1 + frame->fcode;        nbitsresyncmarker = MAX(NUMBITS_VP_RESYNC_MARKER+1, NUMBITS_VP_RESYNC_MARKER + MAX(frame->fcode, frame->bcode) - 1);
1456      else /* B_VOP */      else /*(frame->coding_type == P_VOP)*/
1457        nbitsresyncmarker = MAX(NUMBITS_VP_RESYNC_MARKER+1, NUMBITS_VP_RESYNC_MARKER-1 + MAX(frame->fcode, frame->bcode));                  nbitsresyncmarker = NUMBITS_VP_RESYNC_MARKER + frame->fcode - 1;
1458    
     BitstreamPadAlways(bs);  
1459      BitstreamPutBits(bs, RESYNC_MARKER, nbitsresyncmarker);      BitstreamPutBits(bs, RESYNC_MARKER, nbitsresyncmarker);
1460      BitstreamPutBits(bs, mbnum, mbnum_bits);      BitstreamPutBits(bs, mbnum, mbnum_bits);
1461      BitstreamPutBits(bs, frame->quant, 5);      BitstreamPutBits(bs, frame->quant, 5);

Legend:
Removed from v.1891  
changed lines
  Added in v.2167

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