资源简介
标准的视频编解码器模型,可用于视频编解码的学习研究。
代码片段和文件信息
/*!
*************************************************************************************
* \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;
char *Buf;
int LeadingZero8BitsCount=0 TrailingZero8Bits=0;
if ((Buf = (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 (bits))
{
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2004-09-16 22:41 JM\bin\
文件 753 2004-09-16 22:38 JM\bin\decoder.cfg
文件 11222 2004-09-02 12:46 JM\bin\encoder_ba
文件 11221 2004-09-02 12:46 JM\bin\encoder_extended.cfg
文件 11221 2004-09-16 22:38 JM\bin\encoder_main.cfg
文件 114048 2001-09-03 13:05 JM\bin\foreman_part_qcif.yuv
文件 16 2001-12-20 10:42 JM\bin\leakybucketrate.cfg
文件 66 2004-05-25 15:54 JM\bin\sg0conf.cfg
文件 126 2004-05-25 15:54 JM\bin\sg2conf.cfg
文件 1188 2004-05-25 15:54 JM\bin\sg6conf.cfg
文件 30821 2004-09-16 18:00 JM\CHANGES.TXT
文件 5002 2004-01-14 15:19 JM\Changes_detail.txt
文件 1383 2003-06-11 20:22 JM\copyright.txt
文件 1069 2001-08-29 13:58 JM\disclaimer.txt
目录 0 2004-09-16 22:41 JM\doc\
文件 54272 2001-10-03 00:09 JM\doc\coding_st
文件 491 2002-11-11 14:10 JM\doc\doxygen.txt
文件 99 2001-10-03 00:09 JM\doc\foot.html
文件 1410 2001-10-03 00:09 JM\doc\h26l.css
文件 8143 2003-08-12 18:03 JM\doc\ldecod.dox
文件 8142 2003-08-12 18:03 JM\doc\lencod.dox
目录 0 2004-09-16 22:41 JM\ldecod\
目录 0 2004-09-16 22:41 JM\ldecod\inc\
文件 648 2004-09-16 17:18 JM\ldecod\inc\annexb.h
文件 1299 2003-05-13 12:58 JM\ldecod\inc\biaridecod.h
文件 677 2003-05-13 12:58 JM\ldecod\inc\block.h
文件 2628 2003-06-10 17:13 JM\ldecod\inc\cabac.h
文件 598 2003-06-13 18:49 JM\ldecod\inc\context_ini.h
文件 6206 2004-07-06 16:41 JM\ldecod\inc\contributors.h
文件 46271 2003-12-01 12:38 JM\ldecod\inc\ctx_tables.h
文件 4211 2004-09-16 22:38 JM\ldecod\inc\defines.h
............此处省略146个文件信息
- 上一篇:103规约主站侧源代码
- 下一篇:多尺度的KCF算法代码
评论
共有 条评论