JM10.2源代码


JM视频编码源代码,适用于初学者,里面有标准文档和源代码
资源截图
代码片段和文件信息

/*!
 *************************************************************************************
 * file annexb.c
 *
 * rief
 *    Annex B Byte Stream format
 *
 * author
 *    Main contributors (see contributors.h for copyright address and affiliation details)
 *      - Stephan Wenger                  
 *************************************************************************************
 */

#include 
#include 

#include “global.h“
#include “annexb.h“
#include “memalloc.h“


FILE *bits = NULL;                //!< the bit stream file
static int FindStartCode (unsigned char *Buf int zeros_in_startcode);

int IsFirstByteStreamNALU=1;
int LastAccessUnitExists=0;
int NALUCount=0;


/*!
 ************************************************************************
 * rief
 *    Returns the size of the NALU (bits between start codes in case of
 *    Annex B.  nalu->buf and nalu->len are filled.  Other field in
 *    nalu-> remain uninitialized (will be taken care of by NALUtoRBSP.
 *
 * 
eturn
 *     0 if there is nothing any more to read (EOF)
 *    -1 in case of any error
 *
 *  
ote Side-effect: Returns length of start-code in bytes. 
 *
 * 
ote
 *   GetAnnexbNALU expects start codes at byte aligned positions in the file
 *
 ************************************************************************
 */

int GetAnnexbNALU (NALU_t *nalu)
{
  int info2 info3 pos = 0;
  int StartCodeFound rewind;
  unsigned char *Buf;
  int LeadingZero8BitsCount=0 TrailingZero8Bits=0;
    
  if ((Buf = (unsigned char*)calloc (nalu->max_size  sizeof(char))) == NULL) no_mem_exit(“GetAnnexbNALU: Buf“);

  while(!feof(bits) && (Buf[pos++]=fgetc(bits))==0);
  
  if(feof(bits))
  {
    if(pos==0)
    return 0;
    else
    {
      printf( “GetAnnexbNALU can‘t read start code
“);
      free(Buf);
      return -1;
    }
  }

  if(Buf[pos-1]!=1)
  {
    printf (“GetAnnexbNALU: no Start Code at the begin of the NALU return -1
“);
    free(Buf);
    return -1;
  }

  if(pos<3)
  {
    printf (“GetAnnexbNALU: no Start Code at the begin of the NALU return -1
“);
    free(Buf);
    return -1;
  }
  else if(pos==3)
  {
    nalu->startcodeprefix_len = 3;
    LeadingZero8BitsCount = 0;
  }
  else
  {
    LeadingZero8BitsCount = pos-4;
    nalu->startcodeprefix_len = 4;
  }

  //the 1st byte stream NAL unit can has leading_zero_8bits but subsequent ones are not
  //allowed to contain it since these zeros(if any) are considered trailing_zero_8bits
  //of the previous byte stream NAL unit.
  if(!IsFirstByteStreamNALU && LeadingZero8BitsCount>0)
  {
    printf (“GetAnnexbNALU: The leading_zero_8bits syntax can only be present in the first byte stream NAL unit return -1
“);
    free(Buf);
    return -1;
  }
  IsFirstByteStreamNALU=0;

  StartCodeFound = 0;
  info2 = 0;
  info3 = 0;

  while (!StartCodeFound)
  {
    if (feof 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        552  2012-10-21 18:44  jm10.2JMindata.txt

     文件       1042  2012-10-21 18:44  jm10.2JMindecoder.cfg

     文件      23784  2012-10-21 18:44  jm10.2JMinencoder.cfg

     文件      13316  2012-10-21 18:44  jm10.2JMinencoder_baseline.cfg

     文件      13316  2012-10-21 18:44  jm10.2JMinencoder_extended.cfg

     文件      15736  2012-10-21 18:44  jm10.2JMinencoder_highquality_HD.cfg

     文件      13315  2012-10-21 18:44  jm10.2JMinencoder_main.cfg

     文件      15803  2012-10-21 18:44  jm10.2JMinencoder_yuv422.cfg

     文件      15803  2012-10-21 18:44  jm10.2JMinencoder_yuv444.cfg

     文件     114048  2012-10-21 18:44  jm10.2JMinforeman_part_qcif.yuv

     文件     152064  2012-10-21 18:44  jm10.2JMinforeman_part_qcif_422.yuv

     文件     228096  2012-10-21 18:44  jm10.2JMinforeman_part_qcif_444.yuv

     文件   11404800  2012-10-21 18:44  jm10.2JMinforeman_qcif.yuv

     文件        100  2012-10-21 18:44  jm10.2JMinleakybucketparam.cfg

     文件         16  2012-10-21 18:44  jm10.2JMinleakybucketrate.cfg

     文件    1643520  2012-10-21 18:44  jm10.2JMinlencod.exe

     文件    1707408  2012-10-21 18:44  jm10.2JMinlencod.ilk

     文件     300544  2012-10-21 18:44  jm10.2JMinlencod.map

     文件    1213440  2012-10-21 18:44  jm10.2JMinlencod.pdb

     文件       3284  2012-10-21 18:44  jm10.2JMinlog.dat

     文件       1526  2012-10-21 18:44  jm10.2JMinq_matrix.cfg

     文件       1244  2012-10-21 18:44  jm10.2JMinq_matrix2.cfg

     文件       1244  2012-10-21 18:44  jm10.2JMinq_matrix_def.cfg

     文件       3357  2012-10-21 18:44  jm10.2JMinq_offset.cfg

     文件         66  2012-10-21 18:44  jm10.2JMinsg0conf.cfg

     文件        126  2012-10-21 18:44  jm10.2JMinsg2conf.cfg

     文件       1188  2012-10-21 18:44  jm10.2JMinsg6conf.cfg

     文件       3644  2012-10-21 18:44  jm10.2JMinstats.dat

     文件       5287  2012-10-21 18:44  jm10.2JMin est.264

     文件          0  2012-10-21 18:44  jm10.2JMin est_rec.yuv

............此处省略301个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)