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

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

?? mbuffer.c

?? H.264 codec source code
?? 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];

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

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

  /* 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()
{
  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()
{
  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->top_field    = no_reference_picture;
  s->bottom_field = no_reference_picture;
  s->frame        = no_reference_picture;

  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
 *
 ************************************************************************

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美国十次综合导航| 伊人婷婷欧美激情| 91精品国产综合久久久久久漫画| 91在线porny国产在线看| 国产伦精品一区二区三区免费迷 | 日日夜夜免费精品| 国产精品久久久爽爽爽麻豆色哟哟| 精品第一国产综合精品aⅴ| 欧美一级片免费看| 精品久久人人做人人爱| 精品处破学生在线二十三| 日韩精品一区二区三区老鸭窝| 欧美情侣在线播放| 日韩欧美不卡在线观看视频| 91精品国产福利| 精品国产乱码久久久久久老虎| 欧美大白屁股肥臀xxxxxx| 精品国产露脸精彩对白 | 国内成+人亚洲+欧美+综合在线| 麻豆精品一区二区av白丝在线 | 精品国产一二三| 精品久久国产字幕高潮| 国产情人综合久久777777| 国产精品毛片大码女人 | 在线成人av影院| 欧美丰满少妇xxxxx高潮对白| 91麻豆精品国产91久久久久久久久 | 欧美日韩激情在线| 69p69国产精品| 26uuu国产在线精品一区二区| 国产午夜精品一区二区三区视频 | 人人狠狠综合久久亚洲| 极品少妇xxxx精品少妇| 99在线精品视频| 欧美日韩一区久久| 欧美sm美女调教| 亚洲同性gay激情无套| 午夜精品福利一区二区蜜股av| 蜜桃视频一区二区三区在线观看| 国产福利91精品一区| 色综合天天综合狠狠| 日韩欧美在线综合网| 国产精品福利av| 亚洲va韩国va欧美va精品| 青青草精品视频| 成人av影院在线| 日韩一级二级三级精品视频| 日本一区二区成人| 免费人成黄页网站在线一区二区| 欧美综合久久久| 精品国产电影一区二区| 亚洲精品大片www| 国产成人av一区二区三区在线观看| 欧美日韩国产精选| 亚洲免费观看视频| 国产一级精品在线| 日韩欧美在线1卡| 一区二区三区国产精品| 成人av手机在线观看| 日韩精品中文字幕在线不卡尤物 | 欧美色涩在线第一页| www国产成人免费观看视频 深夜成人网 | 欧美精三区欧美精三区| 亚洲人吸女人奶水| 成人午夜视频网站| 久久久99精品免费观看不卡| 免费在线观看视频一区| 欧美二区三区的天堂| 一级特黄大欧美久久久| 男人的天堂久久精品| 7777精品伊人久久久大香线蕉完整版 | 精品嫩草影院久久| 日本成人超碰在线观看| 欧美少妇bbb| 亚洲第一搞黄网站| 欧美日韩1区2区| 亚洲国产精品久久人人爱| 97久久超碰精品国产| 国产精品拍天天在线| www.av精品| 亚洲欧洲另类国产综合| 国产成人av一区二区| 中文一区二区在线观看| 国产·精品毛片| **欧美大码日韩| 色丁香久综合在线久综合在线观看| 国产精品国产三级国产aⅴ中文| 国产成人免费网站| 国产精品国产自产拍在线| 91丨porny丨首页| 一区二区三区日韩在线观看| 欧美性xxxxxx少妇| 亚瑟在线精品视频| 精品久久久久99| 丁香婷婷深情五月亚洲| 中文字幕亚洲区| 在线精品视频免费播放| 日本色综合中文字幕| 国产亚洲欧美一区在线观看| 成人激情小说网站| 亚洲一区二区三区影院| 91精品午夜视频| 国产激情一区二区三区| 亚洲精品国产一区二区精华液| 欧美日韩视频在线观看一区二区三区| 日韩成人精品在线观看| xnxx国产精品| 欧美亚洲综合网| 久久99精品国产91久久来源| 国产精品午夜在线观看| 欧美伊人精品成人久久综合97| 麻豆精品久久精品色综合| 亚洲欧洲三级电影| 555夜色666亚洲国产免| 粉嫩aⅴ一区二区三区四区五区| 亚洲综合男人的天堂| 日韩欧美电影一二三| 色综合一个色综合亚洲| 日韩1区2区日韩1区2区| 国产精品第五页| 日韩精品中文字幕在线不卡尤物| 成人av电影在线观看| 日本成人在线电影网| 亚洲男人天堂一区| 精品福利视频一区二区三区| 一本高清dvd不卡在线观看| 毛片av一区二区三区| 亚洲另类在线制服丝袜| 久久亚洲综合av| 欧美日本乱大交xxxxx| 成人精品免费看| 久久精品免费观看| 亚洲mv在线观看| 国产精品久久久久久久久晋中 | www.综合网.com| 激情深爱一区二区| 亚洲超碰精品一区二区| 亚洲三级电影全部在线观看高清| 久久综合色之久久综合| 91麻豆精品国产91久久久更新时间| 99re8在线精品视频免费播放| 国模一区二区三区白浆| 日韩精品1区2区3区| 亚洲午夜在线观看视频在线| 中文字幕在线一区二区三区| 久久九九全国免费| 久久蜜臀中文字幕| 久久一日本道色综合| 日韩女优av电影在线观看| 欧美日韩二区三区| 欧美性猛交xxxx乱大交退制版| youjizz久久| 99精品视频一区| www.欧美日韩国产在线| 成人动漫一区二区在线| 丰满岳乱妇一区二区三区| 国产成人在线视频网址| 成人午夜免费视频| 盗摄精品av一区二区三区| 成人一级片网址| 91网站最新网址| 在线看一区二区| 欧美色视频在线| 日韩欧美成人午夜| 精品成人a区在线观看| 久久综合久色欧美综合狠狠| 337p粉嫩大胆噜噜噜噜噜91av| 2023国产精品自拍| 国产调教视频一区| 成人欧美一区二区三区视频网页| 亚洲乱码国产乱码精品精小说| 亚洲永久精品国产| 亚洲成av人片在线观看| 日本不卡一区二区三区| 韩国av一区二区三区在线观看| 国产在线乱码一区二区三区| 国产福利一区在线| 91在线无精精品入口| 欧洲精品视频在线观看| 欧美一级淫片007| 国产日产欧美一区二区视频| 亚洲欧美日韩国产另类专区| 偷窥少妇高潮呻吟av久久免费| 蜜桃一区二区三区在线观看| 国产成人亚洲精品青草天美| av不卡一区二区三区| 欧美日韩一区二区在线观看| 欧美成人福利视频| 亚洲欧美国产毛片在线| 亚洲动漫第一页| 狠狠色丁香久久婷婷综合丁香| 99久久精品久久久久久清纯| 欧美三级蜜桃2在线观看| 久久久影视传媒| 亚洲午夜一区二区三区| 韩国在线一区二区| 欧美色偷偷大香| 国产精品久久久久久久久久久免费看| 午夜视频一区二区| 成人黄色网址在线观看|