亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sei.c

?? 一個簡單的視頻會議VC++MFC工程文件
?? C
?? 第 1 頁 / 共 4 頁
字號:

/*!
 ************************************************************************
 *  \file
 *     sei.c
 *  \brief
 *     implementation of SEI related functions
 *  \author(s)
 *      - Dong Tian                             <tian@cs.tut.fi>
 *
 ************************************************************************
 */

#include <stdlib.h>
#include <assert.h>
#include <memory.h>

#include "global.h"

#include "memalloc.h"
#include "rtp.h"
#include "mbuffer.h"
#include "sei.h"
#include "vlc.h"

Boolean seiHasTemporal_reference=FALSE;
Boolean seiHasClock_timestamp=FALSE;
Boolean seiHasPanscan_rect=FALSE;
Boolean seiHasBuffering_period=FALSE;
Boolean seiHasHrd_picture=FALSE;
Boolean seiHasFiller_payload=FALSE;
Boolean seiHasUser_data_registered_itu_t_t35=FALSE;
Boolean seiHasUser_data_unregistered=FALSE;
Boolean seiHasRandom_access_point=FALSE;
Boolean seiHasRef_pic_buffer_management_repetition=FALSE;
Boolean seiHasSpare_picture=FALSE;

Boolean seiHasSceneInformation=FALSE; // JVT-D099

Boolean seiHasSubseq_information=FALSE;
Boolean seiHasSubseq_layer_characteristics=FALSE;
Boolean seiHasSubseq_characteristics=FALSE;

/*
 ************************************************************************
 *  \basic functions on supplemental enhancement information
 *  \brief
 *     The implementations are based on FCD
 ************************************************************************
 */

//! sei_message[0]: this struct is to store the sei message packetized independently 
//! sei_message[1]: this struct is to store the sei message packetized together with slice data
sei_struct sei_message[2];

void InitSEIMessages()
{
  int i;
  for (i=0; i<2; i++)
  {
    sei_message[i].data = malloc(MAXRTPPAYLOADLEN);
    if( sei_message[i].data == NULL ) no_mem_exit("InitSEIMessages: sei_message[i].data");
    sei_message[i].subPacketType = SEI_PACKET_TYPE;
    clear_sei_message(i);
  }

  // init sei messages
  seiSparePicturePayload.data = NULL;
  InitSparePicture();
  InitSubseqChar();
  if (input->NumFramesInELSubSeq != 0)
    InitSubseqLayerInfo();
  InitSceneInformation(); // JVT-D099
  // init panscanrect sei message
  InitPanScanRectInfo();
  // init user_data_unregistered
  InitUser_data_unregistered();
  // init user_data_unregistered
  InitUser_data_registered_itu_t_t35();
  // init user_RandomAccess
  InitRandomAccess();
}

void CloseSEIMessages()
{
  int i;
  
  if (input->NumFramesInELSubSeq != 0)
    CloseSubseqLayerInfo();

  CloseSubseqChar();
  CloseSparePicture();
  CloseSceneInformation(); // JVT-D099
  //Shankar Regunathan Oct 2002
  ClosePanScanRectInfo();
  CloseUser_data_unregistered();
  CloseUser_data_registered_itu_t_t35();
  CloseRandomAccess();

  for (i=0; i<MAX_LAYER_NUMBER; i++)
  {
    if ( sei_message[i].data ) free( sei_message[i].data );
    sei_message[i].data = NULL;
  }
}

Boolean HaveAggregationSEI()
{
  if (sei_message[AGGREGATION_SEI].available && img->type != B_SLICE) 
    return TRUE;
  if (seiHasSubseqInfo)
    return TRUE;
  if (seiHasSubseqLayerInfo && img->number == 0)
    return TRUE;
  if (seiHasSubseqChar)
    return TRUE;
  if (seiHasSceneInformation) // JVT-D099
    return TRUE;
  if (seiHasPanScanRectInfo) // Shankar Regunathan Oct 2002
    return TRUE;
  if (seiHasUser_data_unregistered_info)
    return TRUE;
  if (seiHasUser_data_registered_itu_t_t35_info)
    return TRUE;
  if (seiHasRandomAccess_info)
    return TRUE;
  return FALSE;
//  return input->SparePictureOption && ( seiHasSpare_picture || seiHasSubseq_information || 
//    seiHasSubseq_layer_characteristics || seiHasSubseq_characteristics );
}

/*!
 ************************************************************************
 *  \brief
 *     write one sei payload to the sei message
 *  \param id
 *    0, if this is the normal packet\n
 *    1, if this is a aggregation packet
 *  \param payload
 *    a pointer that point to the sei payload. Note that the bitstream
 *    should have be byte aligned already. 
 *  \param payload_size
 *    the size of the sei payload
 *  \param payload_type
 *    the type of the sei payload
 *  \par Output
 *    the content of the sei message (sei_message[id]) is updated.
 ************************************************************************
 */
void write_sei_message(int id, byte* payload, int payload_size, int payload_type)
{
  int offset, type, size;
  assert(payload_type > SEI_ZERO && payload_type < SEI_MAX_ELEMENTS);

  type = payload_type;
  size = payload_size;
  offset = sei_message[id].payloadSize;

  while ( type > 255 )
  {
    sei_message[id].data[offset++] = 0xFF;
    type = type - 255;
  }
  sei_message[id].data[offset++] = type;

  while ( size > 255 )
  {
    sei_message[id].data[offset++] = 0xFF;
    size = size - 255;
  }
  sei_message[id].data[offset++] = size;

  memcpy(sei_message[id].data + offset, payload, payload_size);
  offset += payload_size;

  sei_message[id].payloadSize = offset;
}

/*!
 ************************************************************************
 *  \brief
 *     write rbsp_trailing_bits to the sei message
 *  \param id
 *    0, if this is the normal packet \n
 *    1, if this is a aggregation packet
 *  \par Output
 *    the content of the sei message is updated and ready for packetisation
 ************************************************************************
 */
void finalize_sei_message(int id)
{
  int offset = sei_message[id].payloadSize;

  sei_message[id].data[offset] = 0x80;
  sei_message[id].payloadSize++;

  sei_message[id].available = TRUE;
}

/*!
 ************************************************************************
 *  \brief
 *     empty the sei message buffer
 *  \param id
 *    0, if this is the normal packet \n
 *    1, if this is a aggregation packet
 *  \par Output
 *    the content of the sei message is cleared and ready for storing new 
 *      messages
 ************************************************************************
 */
void clear_sei_message(int id)
{
  memset( sei_message[id].data, 0, MAXRTPPAYLOADLEN);
  sei_message[id].payloadSize       = 0;
  sei_message[id].available         = FALSE;
}

/*!
 ************************************************************************
 *  \brief
 *     copy the bits from one bitstream buffer to another one
 *  \param dest
 *    pointer to the dest bitstream buffer
 *  \param source
 *    pointer to the source bitstream buffer
 *  \par Output
 *    the content of the dest bitstream is changed.
 ************************************************************************
 */
void AppendTmpbits2Buf( Bitstream* dest, Bitstream* source )
{
  int i, j;
  unsigned char mask;
  int bits_in_last_byte;

  // copy the first bytes in source buffer
  for (i=0; i<source->byte_pos; i++)
  {
    mask = 0x80;
    for (j=0; j<8; j++)
    {
      dest->byte_buf <<= 1;
      if (source->streamBuffer[i] & mask)
        dest->byte_buf |= 1;
      dest->bits_to_go--;
      mask >>= 1;
      if (dest->bits_to_go==0)
      {
        dest->bits_to_go = 8;
        dest->streamBuffer[dest->byte_pos++]=dest->byte_buf;
        dest->byte_buf = 0;
      }
    }
  }
  // copy the last byte, there are still (8-source->bits_to_go) bits in the source buffer
  bits_in_last_byte = 8-source->bits_to_go;
  if ( bits_in_last_byte > 0 )
  {
    mask = 1 << (bits_in_last_byte-1);
    for (j=0; j<bits_in_last_byte; j++)
    {
      dest->byte_buf <<= 1;
      if (source->byte_buf & mask)
        dest->byte_buf |= 1;
      dest->bits_to_go--;
      mask >>= 1;
      if (dest->bits_to_go==0)
      {
        dest->bits_to_go = 8;
        dest->streamBuffer[dest->byte_pos++]=dest->byte_buf;
        dest->byte_buf = 0;
      }
    }
  }
}

/*
 **++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 *  \functions on spare pictures
 *  \brief
 *     implementation of Spare Pictures related functions based on 
 *      JVT-D100
 *  \author
 *      Dong Tian                 <tian@cs.tut.fi>
 **++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 */

// global variables for spare pictures

// Tian Dong (Sept 2002)
// In current implementation, Sept 2002, the spare picture info is 
// paketized together with the immediately following frame. Thus we 
// define one set of global variables to save the info.
Boolean seiHasSparePicture = FALSE;
spare_picture_struct seiSparePicturePayload;

/*!
 ************************************************************************
 *  \brief
 *      Init the global variables for spare picture information
 ************************************************************************
 */
void InitSparePicture()
{
  if ( seiSparePicturePayload.data != NULL ) CloseSparePicture();

  seiSparePicturePayload.data = malloc( sizeof(Bitstream) );
  if ( seiSparePicturePayload.data == NULL ) no_mem_exit("InitSparePicture: seiSparePicturePayload.data"); 
  seiSparePicturePayload.data->streamBuffer = malloc(MAXRTPPAYLOADLEN);
  if ( seiSparePicturePayload.data->streamBuffer == NULL ) no_mem_exit("InitSparePicture: seiSparePicturePayload.data->streamBuffer"); 
  memset( seiSparePicturePayload.data->streamBuffer, 0, MAXRTPPAYLOADLEN);
  seiSparePicturePayload.num_spare_pics = 0;
  seiSparePicturePayload.target_frame_num = 0;

  seiSparePicturePayload.data->bits_to_go  = 8;
  seiSparePicturePayload.data->byte_pos    = 0;
  seiSparePicturePayload.data->byte_buf    = 0;
}

/*!
 ************************************************************************
 *  \brief
 *      Close the global variables for spare picture information
 ************************************************************************
 */
void CloseSparePicture()
{
  if (seiSparePicturePayload.data->streamBuffer) 
    free(seiSparePicturePayload.data->streamBuffer);
  seiSparePicturePayload.data->streamBuffer = NULL;
  if (seiSparePicturePayload.data) 
    free(seiSparePicturePayload.data);
  seiSparePicturePayload.data = NULL;
  seiSparePicturePayload.num_spare_pics = 0;
  seiSparePicturePayload.target_frame_num = 0;
}

/*!
 ************************************************************************
 *  \brief
 *     Calculate the spare picture info, save the result in map_sp
 *      then compose the spare picture information.
 *  \par Output
 *      the spare picture payload is available in *seiSparePicturePayload*
 *      the syntax elements in the loop (see FCD), excluding the two elements
 *      at the beginning.
 ************************************************************************
 */
void CalculateSparePicture()
{
  /*
  int i, j, tmp, i0, j0, m;
  byte **map_sp;
  int delta_spare_frame_num;
  Bitstream *tmpBitstream;

  int num_of_mb=(img->height/16) * (img->width/16);
  int threshold1 = 16*16*input->SPDetectionThreshold;
  int threshold2 = num_of_mb * input->SPPercentageThreshold / 100;
  int ref_area_indicator;
  int CandidateSpareFrameNum, SpareFrameNum;
  int possible_spare_pic_num;

  // define it for debug purpose
  #define WRITE_MAP_IMAGE

#ifdef WRITE_MAP_IMAGE
  byte **y;
  int k;
  FILE* fp;
  static int first = 1;
  char map_file_name[255]="map.yuv";
#endif

  // basic check
  if (fb->picbuf_short[0]->used==0 || fb->picbuf_short[1]->used==0)
  { 
#ifdef WRITE_MAP_IMAGE
    fp = fopen( map_file_name, "wb" );
    assert( fp != NULL );
    // write the map image
    for (i=0; i < img->height; i++)
      for (j=0; j < img->width; j++)
        fputc(0, fp);

    for (k=0; k < 2; k++)
      for (i=0; i < img->height/2; i++)
        for (j=0; j < img->width/2; j++)
          fputc(128, fp);
    fclose( fp );
#endif
    seiHasSparePicture = FALSE;
    return;
  }
  seiHasSparePicture = TRUE;

  // set the global bitstream memory. 
  InitSparePicture();
  seiSparePicturePayload.target_frame_num = img->number % MAX_FN;
  // init the local bitstream memory.
  tmpBitstream = malloc(sizeof(Bitstream));
  if ( tmpBitstream == NULL ) no_mem_exit("CalculateSparePicture: tmpBitstream");
  tmpBitstream->streamBuffer = malloc(MAXRTPPAYLOADLEN);
  if ( tmpBitstream->streamBuffer == NULL ) no_mem_exit("CalculateSparePicture: tmpBitstream->streamBuffer");
  memset( tmpBitstream->streamBuffer, 0, MAXRTPPAYLOADLEN);

#ifdef WRITE_MAP_IMAGE
  if ( first )
  {
    fp = fopen( map_file_name, "wb" );
    first = 0;
  }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
夜夜嗨av一区二区三区网页| 韩国欧美国产1区| 麻豆91精品91久久久的内涵| 色欧美88888久久久久久影院| 国产日韩欧美不卡| 色综合天天视频在线观看| 一区二区三区日韩精品| 91精品国产综合久久久久久久久久| 亚洲mv在线观看| 国产精品丝袜黑色高跟| 欧美日产在线观看| 99这里只有久久精品视频| 亚洲人成在线播放网站岛国| 欧美丰满一区二区免费视频| 久久国产生活片100| 亚洲视频一区在线| 欧美乱妇一区二区三区不卡视频| 日韩精品电影在线观看| 欧美mv日韩mv国产网站| 99国内精品久久| 日韩av一区二区三区四区| 中文字幕国产精品一区二区| 欧美sm美女调教| 欧美三级欧美一级| 91网站最新网址| 国产999精品久久久久久绿帽| 日本中文字幕不卡| 五月天亚洲精品| 亚洲成人先锋电影| 亚洲国产视频网站| 亚洲免费观看高清完整版在线 | 美女视频黄 久久| 亚洲一区二区在线播放相泽 | 91视频免费看| 91免费国产视频网站| caoporn国产一区二区| 国产精品99久久久久久似苏梦涵| 蜜桃视频一区二区| 国内精品伊人久久久久av一坑 | 国产在线精品一区二区夜色| 奇米综合一区二区三区精品视频| 亚洲视频电影在线| 欧美午夜精品久久久久久超碰 | 久久99精品视频| 免费一区二区视频| 国产精品第一页第二页第三页| 久久精品一二三| 国产亚洲美州欧州综合国| 久久久国际精品| 一区二区三区小说| 亚洲国产精品麻豆| 精品一区二区三区免费视频| 成人免费黄色在线| 欧美性感一类影片在线播放| 成人激情视频网站| 1000精品久久久久久久久| 亚洲精品你懂的| 成人激情动漫在线观看| 国产亚洲va综合人人澡精品 | 国产精品亚洲一区二区三区妖精| 日韩精品在线一区二区| 九九国产精品视频| 国产日韩一级二级三级| 国产一区二区中文字幕| 最近中文字幕一区二区三区| 在线视频综合导航| 日本va欧美va欧美va精品| 精品对白一区国产伦| 波多野结衣中文字幕一区| 亚洲一二三四久久| 欧美大度的电影原声| jizz一区二区| 免费在线欧美视频| 国产精品高潮呻吟久久| 欧美日韩一区精品| 国产电影一区在线| 亚洲国产精品久久久久秋霞影院 | 欧美激情综合五月色丁香小说| 色噜噜狠狠成人网p站| 奇米色一区二区三区四区| 国产欧美日韩亚州综合| 欧美在线综合视频| 国产91露脸合集magnet| 香蕉加勒比综合久久| 欧美国产欧美综合| 制服.丝袜.亚洲.中文.综合| 不卡的av中国片| 久久国产精品一区二区| 一区二区三区中文在线观看| 久久久亚洲综合| 欧美日韩久久久| 99re亚洲国产精品| 国产乱子伦一区二区三区国色天香| 亚洲精品自拍动漫在线| 久久色在线观看| 91精品国产色综合久久不卡蜜臀| 成人手机电影网| 激情成人午夜视频| 亚洲国产精品久久人人爱| 国产精品美女久久久久aⅴ国产馆| 日韩欧美一区在线观看| 91成人免费电影| 99国产精品久久久久久久久久久 | 首页亚洲欧美制服丝腿| 亚洲精品免费一二三区| 欧美激情自拍偷拍| 久久九九久精品国产免费直播| 91精品国产色综合久久ai换脸| 一本色道久久综合精品竹菊| 东方欧美亚洲色图在线| 国产一区二区三区在线观看免费 | 91女神在线视频| 懂色av一区二区三区免费看| 国产一区二区h| 国产永久精品大片wwwapp| 精品一区免费av| 久久99久久精品欧美| 日本不卡视频在线| 日韩二区三区四区| 五月天激情综合| 午夜精品久久久久久久| 婷婷久久综合九色综合伊人色| 樱花草国产18久久久久| 依依成人精品视频| 亚洲香肠在线观看| 日韩vs国产vs欧美| 精品一区在线看| 成人网在线免费视频| 99热99精品| 色中色一区二区| 欧美日韩极品在线观看一区| 日韩一区二区三区电影| 欧美成人综合网站| 久久精品一区二区三区不卡牛牛| 欧美经典三级视频一区二区三区| 成人免费在线视频| 亚洲va中文字幕| 蜜桃视频在线一区| 国产aⅴ精品一区二区三区色成熟| 懂色av一区二区三区免费观看| 91亚洲精品久久久蜜桃网站| 在线亚洲高清视频| 精品久久久久久久久久久院品网| 久久色中文字幕| 一区二区三区成人在线视频| 欧美aa在线视频| 高清成人免费视频| 色8久久人人97超碰香蕉987| 9191久久久久久久久久久| 亚洲精品一区二区三区影院| 国产精品不卡一区二区三区| 性做久久久久久| 国产不卡视频一区| 欧美三级韩国三级日本一级| 久久色在线视频| 亚洲成年人影院| 国产精品456露脸| 欧美熟乱第一页| 久久一区二区视频| 依依成人综合视频| 国产成人免费视频网站| 欧美日韩精品综合在线| 欧美国产综合一区二区| 日韩国产一二三区| 波多野结衣中文字幕一区二区三区 | 久久久综合激的五月天| 一区二区在线观看免费视频播放 | 久久久久国产一区二区三区四区| 亚洲免费在线观看视频| 国产美女精品人人做人人爽| 欧美天天综合网| 中国色在线观看另类| 麻豆国产欧美日韩综合精品二区 | av在线不卡网| 精品国产乱码久久久久久免费| 一区二区在线观看视频在线观看| 九一九一国产精品| 欧美日韩在线直播| 久久免费视频色| 久久超碰97中文字幕| 91成人网在线| 欧美日韩成人综合| 中文在线一区二区| 日本欧美肥老太交大片| 精品一区二区三区在线观看 | 国产精品久久国产精麻豆99网站| 午夜精品123| www.日韩精品| 欧美精品久久99久久在免费线 | 日韩午夜在线观看视频| 1区2区3区精品视频| 日本不卡视频在线| 欧美亚洲一区二区在线观看| 国产亚洲一区二区三区在线观看| 午夜精品免费在线| 91福利在线免费观看| 中文字幕精品一区二区三区精品 | 亚洲人精品一区| 成人精品鲁一区一区二区| 久久伊人蜜桃av一区二区|