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

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

?? mbuffer.c

?? the newest JM software by h.264 JVT official reference model.
?? 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 <limits.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(void);
static int  is_used_for_reference(FrameStore* fs);
static void get_smallest_poc(int *poc,int * pos);
static int  remove_unused_frame_from_dpb(void);
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];

StorablePicture *no_reference_picture; //!< dummy storable picture for recovery point

ColocatedParams *Co_located = NULL;
ColocatedParams *Co_located_JV[MAX_PLANE] = { NULL, NULL, NULL };  //!< Co_located to be used during 4:4:4 independent mode decoding

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(void)
{
#if DUMP_DPB
  unsigned i;

  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");
  }
#endif
}

/*!
 ************************************************************************
 * \brief
 *    Returns the size of the dpb depending on level and picture size
 *
 *
 ************************************************************************
 */
int getDpbSize(void)
{
  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 9:
    size = 152064;
    break;
  case 10:
    size = 152064;
    break;
  case 11:
    if (!IS_FREXT_PROFILE(active_sps->profile_idc) && (active_sps->constrained_set3_flag == 1))
      size = 152064;
    else
      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:
    size = 13369344;
    break;
  case 50:
    size = 42393600;
    break;
  case 51:
    size = 70778880;
    break;
  default:
    error ("undefined level", 500);
    break;
  }

  size /= pic_size;
  size = imin( 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 = imax (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(void)
{
  if ((int)(dpb.ltref_frames_in_buffer +  dpb.ref_frames_in_buffer ) > (imax(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(void)
{
  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]");
  }

  /* allocate a dummy storable picture */
  no_reference_picture = alloc_storable_picture (FRAME, img->width, img->height, img->width_cr, img->height_cr);
  no_reference_picture->top_field    = no_reference_picture;
  no_reference_picture->bottom_field = no_reference_picture;
  no_reference_picture->frame        = no_reference_picture;


  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(void)
{
  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);

  free_storable_picture(no_reference_picture);
}


/*!
 ************************************************************************
 * \brief
 *    Allocate memory for decoded picture buffer frame stores an initialize with sane values.
 *
 * \return
 *    the allocated FrameStore structure
 ************************************************************************
 */
FrameStore* alloc_frame_store(void)
{
  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;
}

void alloc_pic_motion(PicMotionParams *motion, int size_y, int size_x)
{
  if (active_sps->frame_mbs_only_flag)
  {
    get_mem3Dint64 (&(motion->ref_pic_id), 2, size_y, size_x);
    get_mem3Dint64 (&(motion->ref_id),     2, size_y, size_x);
  }
  else
  {
    get_mem3Dint64 (&(motion->ref_pic_id), 6, size_y, size_x);
    get_mem3Dint64 (&(motion->ref_id),     6, size_y, size_x);
  }

  get_mem4Dshort (&(motion->mv),         2, size_y, size_x, 2);
  get_mem3D      ((byte****)(&(motion->ref_idx)),    2, size_y , size_x);

  motion->mb_field = calloc (size_y * size_x, sizeof(byte));
  if (motion->mb_field == NULL)
    no_mem_exit("alloc_storable_picture: motion->mb_field");

  get_mem2D (&(motion->field_frame), size_y, size_x);
}

/*!
 ************************************************************************
 * \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;
  int   nplane;

  //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);
  
  get_mem2Dshort (&(s->slice_id), size_y / MB_BLOCK_SIZE, size_x / MB_BLOCK_SIZE);

  alloc_pic_motion(&s->motion, size_y / BLOCK_SIZE, size_x / BLOCK_SIZE);

  if( IS_INDEPENDENT(img) )
  {
    for( nplane=0; nplane<MAX_PLANE; nplane++ )
    {
      alloc_pic_motion(&s->JVmotion[nplane], 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->size_x_m1 = size_x - 1;
  s->size_y_m1 = size_y - 1;
  s->size_x_cr_m1 = size_x_cr - 1;
  s->size_y_cr_m1 = size_y_cr - 1;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久―日本道色综合久久 | 中文字幕成人在线观看| 婷婷开心激情综合| 欧美顶级少妇做爰| 热久久久久久久| 精品国产乱码久久久久久夜甘婷婷 | 麻豆精品在线看| 欧美zozozo| 丰满少妇在线播放bd日韩电影| 久久久久国产精品人| hitomi一区二区三区精品| 亚洲人成网站精品片在线观看| 欧洲av一区二区嗯嗯嗯啊| 天堂一区二区在线免费观看| 日韩女优制服丝袜电影| 成人网男人的天堂| 亚洲一区二区四区蜜桃| 精品日韩在线一区| jlzzjlzz国产精品久久| 亚洲小少妇裸体bbw| 26uuu亚洲婷婷狠狠天堂| k8久久久一区二区三区| 日韩**一区毛片| 久久久99免费| 欧美日韩国产另类不卡| 国产精品白丝av| 亚洲欧美一区二区在线观看| 在线不卡免费av| 丁香六月久久综合狠狠色| 一区二区三区.www| 精品国产乱码久久久久久老虎 | 日韩成人午夜精品| 国产精品视频在线看| 欧美日本在线播放| 国产不卡视频在线观看| 图片区小说区区亚洲影院| 国产欧美一区二区在线观看| 欧美日韩一区成人| 成人精品国产福利| 毛片一区二区三区| 亚洲色图另类专区| 亚洲精品一线二线三线无人区| 色婷婷久久一区二区三区麻豆| 久久国产三级精品| 亚洲一区二区三区自拍| 中文字幕欧美日本乱码一线二线| 欧美男男青年gay1069videost | 成人精品国产福利| 国内久久婷婷综合| 亚洲国产精品人人做人人爽| 中文字幕精品一区二区精品绿巨人| 欧美精品三级日韩久久| 99久久er热在这里只有精品66| 国产在线乱码一区二区三区| 五月婷婷另类国产| 一区二区视频在线| 国产精品视频第一区| 久久久99精品久久| 日韩精品一区二区在线| 91精品国产手机| 欧美日韩精品一区二区天天拍小说 | 亚洲一区二区在线免费看| 国产精品久久久久久户外露出| 精品精品欲导航| 制服丝袜一区二区三区| 在线观看一区二区视频| 日本丶国产丶欧美色综合| 成人黄色小视频| 国产电影精品久久禁18| 黄页网站大全一区二区| 国产一区二区三区高清播放| 美女视频第一区二区三区免费观看网站 | 精品成人一区二区三区| 日韩一级在线观看| 欧美大片一区二区三区| 日韩欧美中文字幕公布| 日韩午夜三级在线| 日韩欧美不卡在线观看视频| 精品国产精品网麻豆系列| 日韩女优电影在线观看| 久久综合久久综合久久综合| 久久久久久久久久久黄色| 久久色在线视频| 国产目拍亚洲精品99久久精品| 中文字幕不卡在线观看| 国产精品免费视频一区| 日韩毛片精品高清免费| 亚洲欧美激情视频在线观看一区二区三区| 国产精品久久久久久久久图文区 | 91精品国产欧美一区二区成人| 欧美久久久一区| 日韩午夜精品视频| 久久精品一区四区| 中文字幕一区在线观看| 一区二区三区在线观看动漫| 亚洲成人av一区二区| 蜜芽一区二区三区| 国产一区二区三区四区在线观看| 国产成a人亚洲精品| 成人av网址在线观看| 色婷婷精品久久二区二区蜜臀av | 99国产精品国产精品久久| 91免费看`日韩一区二区| 91福利在线导航| 欧美精品久久天天躁| 久久影音资源网| 亚洲色图一区二区| 男男gaygay亚洲| 成人在线视频一区| 欧美日韩一区视频| 精品福利一二区| 日韩美女精品在线| 久久精品国产精品青草| 成人av资源在线| 欧美日韩成人综合| 国产欧美视频一区二区| 亚洲成人免费在线观看| 国产一区二区美女诱惑| 在线看日本不卡| 久久精品亚洲国产奇米99| 亚洲一区二区三区在线看| 国产一区二区三区四区五区美女 | 天天影视色香欲综合网老头| 国产精品一区不卡| 欧美日韩mp4| 中文av一区二区| 蜜臀99久久精品久久久久久软件| 成人精品在线视频观看| 91精品国产综合久久福利软件| 一色桃子久久精品亚洲| 久久精品国产一区二区三| 一本色道综合亚洲| 久久久久久久久伊人| 三级成人在线视频| 一本久久a久久免费精品不卡| 精品免费日韩av| 无码av中文一区二区三区桃花岛| 99re在线视频这里只有精品| 精品国产区一区| 青青草97国产精品免费观看无弹窗版| 成人国产精品免费观看| 精品福利在线导航| 丝瓜av网站精品一区二区| 色婷婷久久久久swag精品| 国产精品久久久久一区| 国产福利一区二区三区视频 | 91在线观看免费视频| 国产欧美视频一区二区| 国产中文字幕精品| 欧美一区欧美二区| 日韩综合一区二区| 欧美色图在线观看| 亚洲黄色av一区| 91丨porny丨首页| 国产精品白丝在线| 丁香婷婷综合激情五月色| 久久久综合精品| 国产综合久久久久影院| 精品毛片乱码1区2区3区| 日本aⅴ免费视频一区二区三区| 欧美久久久久久久久中文字幕| 亚洲一区影音先锋| 91久久国产综合久久| 1024成人网| 91丝袜国产在线播放| 中文字幕亚洲区| 99国产精品国产精品毛片| 亚洲人成精品久久久久| 欧洲在线/亚洲| 亚洲国产毛片aaaaa无费看| 欧美手机在线视频| 日韩精品午夜视频| 日韩一级精品视频在线观看| 日本欧美一区二区在线观看| 欧美一区二区三区系列电影| 麻豆精品一二三| 精品国产1区2区3区| 高清国产一区二区| 国产精品久久久久久久第一福利 | 一本色道久久综合精品竹菊| 亚洲色图19p| 欧美高清一级片在线| 免费成人在线网站| 国产亚洲综合性久久久影院| 成人理论电影网| 一区二区三区四区国产精品| 欧美日韩国产一级二级| 麻豆免费精品视频| 国产婷婷色一区二区三区四区| 高清视频一区二区| 亚洲午夜精品17c| 精品剧情在线观看| 成人丝袜高跟foot| 亚洲成人激情社区| 精品久久人人做人人爰| www.亚洲国产| 日本伊人色综合网| 国产精品无圣光一区二区| 91色乱码一区二区三区| 亚洲成人手机在线|