资源简介
JM视频编码源代码,适用于初学者,里面有标准文档和源代码
代码片段和文件信息
/*!
*************************************************************************************
* \file annexb.c
*
* \brief
* 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;
/*!
************************************************************************
* \brief
* 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.
*
* \return
* 0 if there is nothing any more to read (EOF)
* -1 in case of any error
*
* \note Side-effect: Returns length of start-code in bytes.
*
* \note
* 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\n“);
free(Buf);
return -1;
}
}
if(Buf[pos-1]!=1)
{
printf (“GetAnnexbNALU: no Start Code at the begin of the NALU return -1\n“);
free(Buf);
return -1;
}
if(pos<3)
{
printf (“GetAnnexbNALU: no Start Code at the begin of the NALU return -1\n“);
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\n“);
free(Buf);
return -1;
}
IsFirstByteStreamNALU=0;
StartCodeFound = 0;
info2 = 0;
info3 = 0;
while (!StartCodeFound)
{
if (feof
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 552 2012-10-21 18:44 jm10.2\JM\bin\data.txt
文件 1042 2012-10-21 18:44 jm10.2\JM\bin\decoder.cfg
文件 23784 2012-10-21 18:44 jm10.2\JM\bin\encoder.cfg
文件 13316 2012-10-21 18:44 jm10.2\JM\bin\encoder_ba
文件 13316 2012-10-21 18:44 jm10.2\JM\bin\encoder_extended.cfg
文件 15736 2012-10-21 18:44 jm10.2\JM\bin\encoder_highquality_HD.cfg
文件 13315 2012-10-21 18:44 jm10.2\JM\bin\encoder_main.cfg
文件 15803 2012-10-21 18:44 jm10.2\JM\bin\encoder_yuv422.cfg
文件 15803 2012-10-21 18:44 jm10.2\JM\bin\encoder_yuv444.cfg
文件 114048 2012-10-21 18:44 jm10.2\JM\bin\foreman_part_qcif.yuv
文件 152064 2012-10-21 18:44 jm10.2\JM\bin\foreman_part_qcif_422.yuv
文件 228096 2012-10-21 18:44 jm10.2\JM\bin\foreman_part_qcif_444.yuv
文件 11404800 2012-10-21 18:44 jm10.2\JM\bin\foreman_qcif.yuv
文件 100 2012-10-21 18:44 jm10.2\JM\bin\leakybucketparam.cfg
文件 16 2012-10-21 18:44 jm10.2\JM\bin\leakybucketrate.cfg
文件 1643520 2012-10-21 18:44 jm10.2\JM\bin\lencod.exe
文件 1707408 2012-10-21 18:44 jm10.2\JM\bin\lencod.ilk
文件 300544 2012-10-21 18:44 jm10.2\JM\bin\lencod.map
文件 1213440 2012-10-21 18:44 jm10.2\JM\bin\lencod.pdb
文件 3284 2012-10-21 18:44 jm10.2\JM\bin\log.dat
文件 1526 2012-10-21 18:44 jm10.2\JM\bin\q_matrix.cfg
文件 1244 2012-10-21 18:44 jm10.2\JM\bin\q_matrix2.cfg
文件 1244 2012-10-21 18:44 jm10.2\JM\bin\q_matrix_def.cfg
文件 3357 2012-10-21 18:44 jm10.2\JM\bin\q_offset.cfg
文件 66 2012-10-21 18:44 jm10.2\JM\bin\sg0conf.cfg
文件 126 2012-10-21 18:44 jm10.2\JM\bin\sg2conf.cfg
文件 1188 2012-10-21 18:44 jm10.2\JM\bin\sg6conf.cfg
文件 3644 2012-10-21 18:44 jm10.2\JM\bin\stats.dat
文件 5287 2012-10-21 18:44 jm10.2\JM\bin\test.264
文件 0 2012-10-21 18:44 jm10.2\JM\bin\test_rec.yuv
............此处省略301个文件信息
- 上一篇:2D/3D人脸识别分析源码
- 下一篇:硕士论文-基于本体的学科知识库构建研究
评论
共有 条评论