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

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

?? mbuffer.c

?? h.264官方測試軟件
?? C
?? 第 1 頁 / 共 5 頁
字號:

/*!
 ***********************************************************************
 *  \file
 *      mbuffer.c
 *
 *  \brief
 *      Frame buffer functions
 *
 *  \author
 *      Main contributors (see contributors.h for copyright, address and affiliation details)
 *      - Karsten S黨ring                 <suehring@hhi.de>
 *      - Alexis Tourapis                 <alexismt@ieee.org>
 *      - Jill Boyce                      <jill.boyce@thomson.net>
 *      - Saurav K Bandyopadhyay          <saurav@ieee.org>
 *      - Zhenyu Wu                       <Zhenyu.Wu@thomson.net
 *      - Purvin Pandit                   <Purvin.Pandit@thomson.net>
 *
 ***********************************************************************
 */

#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <string.h>

#include "global.h"
#include "mbuffer.h"
#include "memalloc.h"
#include "output.h"
#include "image.h"
#include "header.h"

// picture error concealment
#include "erc_api.h"

static void insert_picture_in_dpb(FrameStore* fs, StorablePicture* p);
static void output_one_frame_from_dpb();
static int  is_used_for_reference(FrameStore* fs);
static void get_smallest_poc(int *poc,int * pos);
static int  remove_unused_frame_from_dpb();
static int  is_short_term_reference(FrameStore* fs);
static int  is_long_term_reference(FrameStore* fs);
void gen_field_ref_ids(StorablePicture *p);

DecodedPictureBuffer dpb;

StorablePicture **listX[6];

ColocatedParams *Co_located = NULL;

extern StorablePicture *dec_picture;

int listXsize[6];

#define MAX_LIST_SIZE 33

/*!
 ************************************************************************
 * \brief
 *    Print out list of pictures in DPB. Used for debug purposes.
 ************************************************************************
 */
void dump_dpb()
{
  unsigned i;

  return;
  
  for (i=0; i<dpb.used_size;i++)
  {
    printf("(");
    printf("fn=%d  ", dpb.fs[i]->frame_num);
    if (dpb.fs[i]->is_used & 1)
    {
      if (dpb.fs[i]->top_field)
        printf("T: poc=%d  ", dpb.fs[i]->top_field->poc);
      else
        printf("T: poc=%d  ", dpb.fs[i]->frame->top_poc);
    }
    if (dpb.fs[i]->is_used & 2)
    {
      if (dpb.fs[i]->bottom_field)
        printf("B: poc=%d  ", dpb.fs[i]->bottom_field->poc);
      else
        printf("B: poc=%d  ", dpb.fs[i]->frame->bottom_poc);
    }
    if (dpb.fs[i]->is_used == 3)
      printf("F: poc=%d  ", dpb.fs[i]->frame->poc);
    printf("G: poc=%d)  ", dpb.fs[i]->poc);
    if (dpb.fs[i]->is_reference) printf ("ref (%d) ", dpb.fs[i]->is_reference);
    if (dpb.fs[i]->is_long_term) printf ("lt_ref (%d) ", dpb.fs[i]->is_reference);
    if (dpb.fs[i]->is_output) printf ("out  ");
    if (dpb.fs[i]->is_used == 3)
    {
      if (dpb.fs[i]->frame->non_existing) printf ("ne  ");
    }
    printf ("\n");
  }
}

/*!
 ************************************************************************
 * \brief
 *    Returns the size of the dpb depending on level and picture size
 *
 *
 ************************************************************************
 */
int getDpbSize()
{
  int pic_size = (active_sps->pic_width_in_mbs_minus1 + 1) * (active_sps->pic_height_in_map_units_minus1 + 1) * (active_sps->frame_mbs_only_flag?1:2) * 384;

  int size = 0;

  switch (active_sps->level_idc)
  {
  case 10:
    size = 152064;
    break;
  case 11:
    size = 345600;
    break;
  case 12:
    size = 912384;
    break;
  case 13:
    size = 912384;
    break;
  case 20:
    size = 912384;
    break;
  case 21:
    size = 1824768;
    break;
  case 22:
    size = 3110400;
    break;
  case 30:
    size = 3110400;
    break;
  case 31:
    size = 6912000;
    break;
  case 32:
    size = 7864320;
    break;
  case 40:
    size = 12582912;
    break;
  case 41:
    size = 12582912;
    break;
 case 42:
   if(  (active_sps->profile_idc==FREXT_HP   ) || (active_sps->profile_idc==FREXT_Hi10P)
     || (active_sps->profile_idc==FREXT_Hi422) || (active_sps->profile_idc==FREXT_Hi444))
     size = 13369344;
   else
     size = 12582912;
   break; 
  case 50:
    size = 42393600;
    break;
  case 51:
    size = 70778880;
    break;
  default:
    error ("undefined level", 500);
    break;
  }

  size /= pic_size;
  size = min( size, 16);

  if (active_sps->vui_parameters_present_flag && active_sps->vui_seq_parameters.bitstream_restriction_flag)
  {
    if ((int)active_sps->vui_seq_parameters.max_dec_frame_buffering > size)
    {
      error ("max_dec_frame_buffering larger than MaxDpbSize", 500);
    }
    size = max (1, active_sps->vui_seq_parameters.max_dec_frame_buffering);
  }

  return size;
}

/*!
 ************************************************************************
 * \brief
 *    Check then number of frames marked "used for reference" and break 
 *    if maximum is exceeded
 *
 ************************************************************************
 */
void check_num_ref()
{
  if ((int)(dpb.ltref_frames_in_buffer +  dpb.ref_frames_in_buffer ) > (max(1,dpb.num_ref_frames)))
  {
    error ("Max. number of reference frames exceeded. Invalid stream.", 500);
  }
}


/*!
 ************************************************************************
 * \brief
 *    Allocate memory for decoded picture buffer and initialize with sane values.
 *
 ************************************************************************
 */
void init_dpb()
{
  unsigned i,j;

  if (dpb.init_done)
  {
    free_dpb();
  }

  dpb.size      = getDpbSize();

  dpb.num_ref_frames = active_sps->num_ref_frames;

  if (dpb.size < active_sps->num_ref_frames)
  {
    error ("DPB size at specified level is smaller than the specified number of reference frames. This is not allowed.\n", 1000);
  }

  dpb.used_size = 0;
  dpb.last_picture = NULL;

  dpb.ref_frames_in_buffer = 0;
  dpb.ltref_frames_in_buffer = 0;
  
  dpb.fs = calloc(dpb.size, sizeof (FrameStore*));
  if (NULL==dpb.fs) 
    no_mem_exit("init_dpb: dpb->fs");

  dpb.fs_ref = calloc(dpb.size, sizeof (FrameStore*));
  if (NULL==dpb.fs_ref) 
    no_mem_exit("init_dpb: dpb->fs_ref");

  dpb.fs_ltref = calloc(dpb.size, sizeof (FrameStore*));
  if (NULL==dpb.fs_ltref) 
    no_mem_exit("init_dpb: dpb->fs_ltref");

  for (i=0; i<dpb.size; i++)
  {
    dpb.fs[i]       = alloc_frame_store();
    dpb.fs_ref[i]   = NULL;
    dpb.fs_ltref[i] = NULL;
  }
  
  for (i=0; i<6; i++)
  {
    listX[i] = calloc(MAX_LIST_SIZE, sizeof (StorablePicture*)); // +1 for reordering
    if (NULL==listX[i]) 
      no_mem_exit("init_dpb: listX[i]");
  }

  for (j=0;j<6;j++)
  {
    for (i=0; i<MAX_LIST_SIZE; i++)
    {
      listX[j][i] = NULL;
    }
    listXsize[j]=0;
  }

  dpb.last_output_poc = INT_MIN;

  img->last_has_mmco_5 = 0;

  dpb.init_done = 1;

  // picture error concealment
  if(img->conceal_mode !=0)
      last_out_fs = alloc_frame_store();
}
/*!
 ************************************************************************
 * \brief
 *    Free memory for decoded picture buffer.
 ************************************************************************
 */
void free_dpb()
{
  unsigned i;
  if (dpb.fs)
  {
    for (i=0; i<dpb.size; i++)
    {
      free_frame_store(dpb.fs[i]);
    }
    free (dpb.fs);
    dpb.fs=NULL;
  }
  if (dpb.fs_ref)
  {
    free (dpb.fs_ref);
  }
  if (dpb.fs_ltref)
  {
    free (dpb.fs_ltref);
  }
  dpb.last_output_poc = INT_MIN;

  for (i=0; i<6; i++)
    if (listX[i])
    {
      free (listX[i]);
      listX[i] = NULL;
    }

  dpb.init_done = 0;

  // picture error concealment
  if(img->conceal_mode != 0)
      free_frame_store(last_out_fs);
}


/*!
 ************************************************************************
 * \brief
 *    Allocate memory for decoded picture buffer frame stores an initialize with sane values.
 *
 * \return
 *    the allocated FrameStore structure
 ************************************************************************
 */
FrameStore* alloc_frame_store()
{
  FrameStore *f;

  f = calloc (1, sizeof(FrameStore));
  if (NULL==f) 
    no_mem_exit("alloc_frame_store: f");

  f->is_used      = 0;
  f->is_reference = 0;
  f->is_long_term = 0;
  f->is_orig_reference = 0;

  f->is_output = 0;

  f->frame        = NULL;;
  f->top_field    = NULL;
  f->bottom_field = NULL;

  return f;
}

/*!
 ************************************************************************
 * \brief
 *    Allocate memory for a stored picture. 
 *
 * \param structure
 *    picture structure
 * \param size_x
 *    horizontal luma size
 * \param size_y
 *    vertical luma size
 * \param size_x_cr
 *    horizontal chroma size
 * \param size_y_cr
 *    vertical chroma size
 *
 * \return
 *    the allocated StorablePicture structure
 ************************************************************************
 */
StorablePicture* alloc_storable_picture(PictureStructure structure, int size_x, int size_y, int size_x_cr, int size_y_cr)
{
  StorablePicture *s;

  //printf ("Allocating (%s) picture (x=%d, y=%d, x_cr=%d, y_cr=%d)\n", (type == FRAME)?"FRAME":(type == TOP_FIELD)?"TOP_FIELD":"BOTTOM_FIELD", size_x, size_y, size_x_cr, size_y_cr);

  s = calloc (1, sizeof(StorablePicture));
  if (NULL==s) 
    no_mem_exit("alloc_storable_picture: s");

  if (structure!=FRAME)
  {
    size_y    /= 2;
    size_y_cr /= 2; 
  }

  s->PicSizeInMbs = (size_x*size_y)/256;
  s->imgUV = NULL;

  get_mem2Dpel (&(s->imgY), size_y, size_x);
  if (active_sps->chroma_format_idc != YUV400)
    get_mem3Dpel (&(s->imgUV), 2, size_y_cr, size_x_cr);

  s->mb_field = calloc (s->PicSizeInMbs, sizeof(int));
  if (NULL==s->mb_field) 
    no_mem_exit("alloc_storable_picture: s->mb_field");

  get_mem2Dshort (&(s->slice_id), size_y / MB_BLOCK_SIZE, size_x / MB_BLOCK_SIZE);

  get_mem3D      ((byte****)(&(s->ref_idx))   , 2, size_y / BLOCK_SIZE, size_x / BLOCK_SIZE);
  get_mem3Dint64 (&(s->ref_pic_id), 6, size_y / BLOCK_SIZE, size_x / BLOCK_SIZE);
  get_mem3Dint64 (&(s->ref_id)    , 6, size_y / BLOCK_SIZE, size_x / BLOCK_SIZE);
  get_mem4Dshort (&(s->mv)        , 2, size_y / BLOCK_SIZE, size_x / BLOCK_SIZE, 2);

  get_mem2D      (&(s->moving_block), size_y / BLOCK_SIZE, size_x / BLOCK_SIZE);
  get_mem2D      (&(s->field_frame) , size_y / BLOCK_SIZE, size_x / BLOCK_SIZE);

  s->pic_num=0;
  s->frame_num=0;
  s->long_term_frame_idx=0;
  s->long_term_pic_num=0;
  s->used_for_reference=0;
  s->is_long_term=0;
  s->non_existing=0;
  s->is_output = 0;
  s->max_slice_id = 0;

  s->structure=structure;

  s->size_x = size_x;
  s->size_y = size_y;
  s->size_x_cr = size_x_cr;
  s->size_y_cr = size_y_cr;
  
  s->top_field    = NULL;
  s->bottom_field = NULL;
  s->frame        = NULL;

  s->dec_ref_pic_marking_buffer = NULL;

  s->coded_frame                   = 0;
  s->MbaffFrameFlag                = 0;

  return s;
}

/*!
 ************************************************************************
 * \brief
 *    Free frame store memory.
 *
 * \param f
 *    FrameStore to be freed
 *
 ************************************************************************
 */
void free_frame_store(FrameStore* f)
{
  if (f)
  {
    if (f->frame)
    {
      free_storable_picture(f->frame);
      f->frame=NULL;
    }
    if (f->top_field)
    {
      free_storable_picture(f->top_field);
      f->top_field=NULL;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕不卡的av| www国产亚洲精品久久麻豆| 国产激情偷乱视频一区二区三区| 三级久久三级久久久| 亚洲成人自拍网| 亚洲国产毛片aaaaa无费看| 亚洲一区二区三区在线| 亚洲第一福利一区| 午夜精品123| 狠狠色丁香久久婷婷综合_中| 麻豆视频观看网址久久| 精品无人码麻豆乱码1区2区| 久久99精品一区二区三区三区| 韩国欧美一区二区| 波多野结衣中文字幕一区| 91在线无精精品入口| 91久久精品一区二区三| 欧美色图片你懂的| 日韩午夜av一区| 国产农村妇女毛片精品久久麻豆 | 91视频在线观看| 成人精品高清在线| 色婷婷国产精品久久包臀| 欧美日韩一二三区| 欧美xxxx在线观看| 日韩美女视频一区二区| 五月天中文字幕一区二区| 免费成人av在线播放| 国产一区二区精品久久91| 色综合天天综合网天天狠天天 | 91麻豆精品国产91久久久久| 日韩午夜精品视频| 亚洲人成精品久久久久| 日韩电影免费在线看| 成人免费看视频| 欧美日韩国产区一| 亚洲国产高清不卡| 婷婷开心激情综合| av一区二区三区在线| 在线成人免费观看| 国产精品国产三级国产普通话蜜臀 | 91在线精品一区二区三区| 欧美私模裸体表演在线观看| 久久天堂av综合合色蜜桃网| 一区二区三区精品视频| 国产精一区二区三区| 色久综合一二码| 久久久久综合网| 日本大胆欧美人术艺术动态| 成人教育av在线| 精品日韩欧美在线| 婷婷综合久久一区二区三区| 成人网在线播放| 日韩三级免费观看| 香蕉久久一区二区不卡无毒影院| 懂色av一区二区三区免费观看| 欧美日韩一级片网站| 综合精品久久久| 国产一区二区91| 日韩免费性生活视频播放| 亚洲综合免费观看高清完整版| 粉嫩嫩av羞羞动漫久久久| 日韩精品一区二区三区蜜臀| 天天色综合成人网| 欧美日韩欧美一区二区| 中文字幕一区二区视频| 国产高清成人在线| 精品美女在线播放| 秋霞电影网一区二区| 欧美精品xxxxbbbb| 亚洲高清久久久| 欧美日韩亚洲综合| 亚洲国产成人va在线观看天堂| 91色|porny| 一区二区三区欧美| 欧美亚洲一区二区三区四区| 成人欧美一区二区三区黑人麻豆| 不卡av电影在线播放| 亚洲少妇最新在线视频| 色综合中文字幕国产 | 日韩毛片精品高清免费| 成人精品视频一区| 亚洲日本电影在线| 91免费版在线| 亚洲一区二区av电影| 欧美色中文字幕| 日韩高清在线不卡| 欧美va在线播放| 粉嫩绯色av一区二区在线观看| 国产精品青草综合久久久久99| 国产成a人无v码亚洲福利| 日本一区二区动态图| 99久久国产综合精品麻豆| 一区二区三区成人| 欧美一区二区在线免费播放| 开心九九激情九九欧美日韩精美视频电影| 欧美精品乱码久久久久久| 蜜桃av噜噜一区| 国产女人aaa级久久久级| 色一情一伦一子一伦一区| 肉肉av福利一精品导航| 欧美精品一卡二卡| 国产在线播放一区三区四| 国产精品乱子久久久久| 91精品国产欧美一区二区成人| 精品一二线国产| 亚洲欧洲制服丝袜| 日韩免费观看高清完整版在线观看| 精品在线免费观看| 一区二区三区在线影院| 欧美成人精品福利| 91在线观看成人| 日本欧美在线观看| 亚洲免费观看高清在线观看| 日韩一区二区影院| 色综合天天综合网天天看片| 日韩激情视频在线观看| 国产精品网站在线播放| 欧美精品三级在线观看| 成人在线一区二区三区| 日韩高清在线不卡| 亚洲美女偷拍久久| 国产日韩欧美高清在线| 欧美日韩国产大片| 91原创在线视频| 国产成人精品影院| 日韩福利视频导航| 一区二区三区av电影| 国产亚洲人成网站| 日韩欧美亚洲国产精品字幕久久久| jiyouzz国产精品久久| 国产尤物一区二区| 免费观看日韩av| 亚洲福利视频导航| 亚洲欧美色图小说| 国产精品天美传媒沈樵| 国产午夜精品一区二区| 精品欧美黑人一区二区三区| 欧洲精品在线观看| 色狠狠av一区二区三区| 成人午夜免费视频| 国产高清亚洲一区| 国产iv一区二区三区| 精品亚洲成a人在线观看| 日本不卡一区二区三区高清视频| 亚洲欧美日韩综合aⅴ视频| 亚洲欧洲99久久| 亚洲欧洲成人精品av97| 国产精品第13页| 综合欧美一区二区三区| 国产精品电影院| 亚洲人成精品久久久久| 亚洲综合在线免费观看| 亚洲丝袜另类动漫二区| 亚洲色图欧美在线| 中文字幕亚洲视频| 专区另类欧美日韩| 一区二区三区免费| 午夜精品久久久久| 另类调教123区 | 97se亚洲国产综合在线| jlzzjlzz亚洲日本少妇| 高清成人在线观看| 精品一区二区在线看| 国产伦理精品不卡| www.一区二区| 欧美性极品少妇| 欧美精品日韩综合在线| 精品欧美一区二区三区精品久久| 久久蜜桃香蕉精品一区二区三区| 国产清纯白嫩初高生在线观看91 | 在线看日本不卡| 欧美色欧美亚洲另类二区| 欧美一级理论性理论a| 精品国产网站在线观看| 中文字幕av资源一区| 一区二区三区不卡视频| 日本强好片久久久久久aaa| 国产成人午夜精品影院观看视频 | 成人av电影观看| 日本久久电影网| 日韩精品在线看片z| 国产精品久久久久久久蜜臀| 亚洲成人你懂的| 久久超级碰视频| 97久久超碰国产精品电影| 欧美美女直播网站| 国产精品久久影院| 日本不卡123| 99精品桃花视频在线观看| 欧美一二三区在线| 国产精品久久久久久久久搜平片| 亚洲自拍都市欧美小说| 国产一区美女在线| 欧美三电影在线| 中文字幕高清一区| 日韩成人精品在线| 一本色道**综合亚洲精品蜜桃冫| 欧美一区二区美女| 樱桃视频在线观看一区|