• 大小: 33.77MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-07
  • 语言: 其他
  • 标签: h264_JM  

资源简介

h264_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);


/*!
 ************************************************************************
 * \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;
    
  if ((Buf = (char*)calloc (nalu->max_size  sizeof(char))) == NULL) no_mem_exit(“GetAnnexbNALU: Buf“);

  nalu->startcodeprefix_len=3;

  info2 = 0;
  info3 = 0;
  
  if (3 != fread (Buf 1 3 bits))
  {
    free(Buf);
    return 0;
  }

  info2 = FindStartCode (Buf 2);
  if(info2 != 1) {
    if(1 != fread(Buf+3 1 1 bits))
    {
      free(Buf);
      return 0;
    }
    info3 = FindStartCode (Buf 3);
  }

  if (info2 != 1 && info3 != 1)
  {
    printf (“GetAnnexbNALU: no Start Code at the begin of the NALU return -1\n“);
    free(Buf);
    return -1;
  }

  if( info2 == 1) {
    nalu->startcodeprefix_len = 3;
    pos = 3;
  }
  else if(info3 ==1 ) {
    pos = 4;
    nalu->startcodeprefix_len = 4;
  }
  else
    printf( “ Panic: Error \n“);

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

  while (!StartCodeFound)
  {
    if (feof (bits))
    {
      nalu->len = (pos-1)-nalu->startcodeprefix_len;
      memcpy (nalu->buf &Buf[nalu->startcodeprefix_len] nalu->len);     
      nalu->forbidden_bit = (nalu->buf[0]>>7) & 1;
      nalu->nal_reference_idc = (nalu->buf[0]>>5) & 3;
      nalu->nal_unit_type = (nalu->buf[0]) & 0x1f;

// printf (“GetAnnexbNALU eof case: pos %d nalu->len %d nalu->reference_idc %d nal_unit_type %d \n“ pos nalu->len nalu->nal_reference_idc nalu->nal_unit_type);

#if TRACE
  fprintf (p_trace “\n\nLast NALU in File\n\n“);
  fprintf (p_trace “Annex B NALU w/ %s startcode len %d forbidden_bit %d nal_reference_idc %d nal_unit_

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2012-02-04 18:00  h264_JM源码\
     目录           0  2012-02-04 18:00  h264_JM源码\JM83\
     文件       28707  2004-07-26 16:04  h264_JM源码\JM83\CHANGES.TXT
     文件        5002  2004-07-26 16:04  h264_JM源码\JM83\Changes_detail.txt
     文件        3403  2004-07-26 16:04  h264_JM源码\JM83\Readme.txt
     目录           0  2012-02-04 18:00  h264_JM源码\JM83\bin\
     文件        1120  2004-08-20 10:58  h264_JM源码\JM83\bin\dataDec.txt
     文件         753  2004-07-26 16:03  h264_JM源码\JM83\bin\decoder.cfg
     文件       11226  2004-07-26 16:03  h264_JM源码\JM83\bin\encoder_baseline.cfg
     文件       11226  2004-07-26 16:03  h264_JM源码\JM83\bin\encoder_extended.cfg
     文件       11226  2004-07-26 16:03  h264_JM源码\JM83\bin\encoder_main.cfg
     文件      114048  2004-07-26 16:03  h264_JM源码\JM83\bin\foreman_part_qcif.yuv
     文件      421888  2004-08-20 10:53  h264_JM源码\JM83\bin\ldecod._xe
     文件      409666  2004-08-20 10:43  h264_JM源码\JM83\bin\ldecod.exe
     文件      131425  2004-08-20 10:43  h264_JM源码\JM83\bin\ldecod.map
     文件       14908  2004-08-20 10:53  h264_JM源码\JM83\bin\ldecod.pbi
     文件       14976  2004-08-20 10:58  h264_JM源码\JM83\bin\ldecod.pbo
     文件       22312  2004-08-20 10:58  h264_JM源码\JM83\bin\ldecod.pbt
     文件      697344  2004-08-20 10:43  h264_JM源码\JM83\bin\ldecod.pdb
     文件          16  2004-07-26 16:03  h264_JM源码\JM83\bin\leakybucketrate.cfg
     文件      618562  2004-07-26 17:05  h264_JM源码\JM83\bin\lencod.exe
     文件      245248  2004-07-26 17:05  h264_JM源码\JM83\bin\lencod.map
     文件      992256  2004-07-26 17:05  h264_JM源码\JM83\bin\lencod.pdb
     文件        1686  2004-08-20 10:58  h264_JM源码\JM83\bin\log.dec
     文件          66  2004-07-26 16:03  h264_JM源码\JM83\bin\sg0conf.cfg
     文件         126  2004-07-26 16:03  h264_JM源码\JM83\bin\sg2conf.cfg
     文件        1188  2004-07-26 16:03  h264_JM源码\JM83\bin\sg6conf.cfg
     文件       58302  2004-08-01 20:31  h264_JM源码\JM83\bin\test.264
     文件     7679232  2004-08-20 10:58  h264_JM源码\JM83\bin\test_dec.yuv
     文件        1383  2004-07-26 16:04  h264_JM源码\JM83\copyright.txt
     文件       16175  2004-08-20 15:23  h264_JM源码\JM83\data.txt
............此处省略1178个文件信息

评论

共有 条评论

相关资源