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

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

?? mbuffer.c

?? TML的參考源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
***********************************************************************
* COPYRIGHT AND WARRANTY INFORMATION
*
* Copyright 2001, International Telecommunications Union, Geneva
*
* DISCLAIMER OF WARRANTY
*
* These software programs are available to the user without any
* license fee or royalty on an "as is" basis. The ITU disclaims
* any and all warranties, whether express, implied, or
* statutory, including any implied warranties of merchantability
* or of fitness for a particular purpose.  In no event shall the
* contributor or the ITU be liable for any incidental, punitive, or
* consequential damages of any kind whatsoever arising from the
* use of these programs.
*
* This disclaimer of warranty extends to the user of these programs
* and user's customers, employees, agents, transferees, successors,
* and assigns.
*
* The ITU does not represent or warrant that the programs furnished
* hereunder are free of infringement of any third-party patents.
* Commercial implementations of ITU-T Recommendations, including
* shareware, may be subject to royalty fees to patent holders.
* Information regarding the ITU-T patent policy is available from
* the ITU Web site at http://www.itu.int.
*
* THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE ITU-T PATENT POLICY.
************************************************************************
*/

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

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

#include "global.h"
#include "mbuffer.h"
#include "memalloc.h"

/*!
 ************************************************************************
 * \brief
 *    allocate memory for frame buffer
 *
 * \par Input:
 *    Input Parameters struct inp_par *inp, Image Parameters struct img_par *img
 *
 ************************************************************************
 */
void init_frame_buffers(struct inp_par *inp, ImageParameters *img)
{
  int i;

  img->buf_cycle = inp->buf_cycle+1;

  if ((fb=(FrameBuffer*)calloc(1,sizeof (FrameBuffer)))==NULL) no_mem_exit("init_frame_buffers: fb");

  if ((fb->picbuf_short=(Frame**)calloc(img->buf_cycle,sizeof (Frame*)))==NULL) no_mem_exit("init_frame_buffers: fb->picbuf_short");

  for (i=0;i<img->buf_cycle;i++)
    if ((fb->picbuf_short[i]=(Frame*)calloc(1,sizeof (Frame)))==NULL) no_mem_exit("init_frame_buffers: fb->picbuf_short");

  for (i=0;i<img->buf_cycle;i++)
  {
    get_mem2D(&(fb->picbuf_short[i]->mref), img->height, img->width);
    get_mem3D(&(fb->picbuf_short[i]->mcef), 2, img->height_cr*2, img->width_cr*2);
  }

  fb->short_size=img->buf_cycle;
  fb->short_used=0;
  fb->long_size=0;
  fb->long_used=0;
}

/*!
 ************************************************************************
 * \brief
 *    free frame buffer memory
 *
 * \par Input:
 *    Input Parameters struct inp_par *inp, Image Parameters struct img_par *img
 *
 ************************************************************************
 */
void free_frame_buffers(struct inp_par *inp, ImageParameters *img)
{
  int i;

  for (i=0;i<img->buf_cycle;i++)
  {
    free_mem2D(fb->picbuf_short[i]->mref);
    free_mem3D(fb->picbuf_short[i]->mcef,2);
  }


  for (i=0;i<img->buf_cycle;i++)
    free (fb->picbuf_short[i]);

  free (fb->picbuf_short);
 
  if (fb->picbuf_long)
  {
    for (i=0;i<fb->long_size;i++)
    {
      free_mem2D(fb->picbuf_long[i]->mref);
      free_mem3D(fb->picbuf_long[i]->mcef,2);

      free (fb->picbuf_long[i]);
    } 
    free (fb->picbuf_long);
  }


  free (fb);
}

/*!
 ************************************************************************
 * \brief
 *    allocate or reallocate long term buffer memory
 *
 * \param size
 *    number of frames
 *
 ************************************************************************
 */
void init_long_term_buffer(int size, ImageParameters *img)
{
  Frame **pb;
  int i;

  printf ("init long term buffer size = %d\n",size);

  /* nothing to do if size unchanged */
  if (fb->long_size==size) return;

  if (fb->long_size>size)
  {
    /* shrink size */

    pb=fb->picbuf_long;
    if ((fb->picbuf_long=(Frame**)calloc(size,sizeof (Frame*)))==NULL) no_mem_exit("init_frame_buffers: fb->picbuf_long");

    for (i=0;i<size;i++)
      fb->picbuf_long[i]=pb[i];

    for (i=size;i<fb->long_size;i++)
    {
      free_mem2D(pb[i]->mref);
      free_mem3D(pb[i]->mcef, 2);
      free (pb[i]);
    }

    free (pb);

  } else
  {
    /* grow size */

    pb=fb->picbuf_long;

    if ((fb->picbuf_long=(Frame**)calloc(size,sizeof (Frame*)))==NULL) no_mem_exit("init_frame_buffers: fb->picbuf_long");

    for (i=0;i<fb->long_size;i++)
      fb->picbuf_long[i]=pb[i];

    for (i=fb->long_size;i<size;i++)
    {
      if ((fb->picbuf_long[i]=(Frame*)calloc(1,sizeof (Frame)))==NULL) no_mem_exit("init_frame_buffers: fb->picbuf_long");
      get_mem2D(&(fb->picbuf_long[i]->mref), img->height, img->width);
      get_mem3D(&(fb->picbuf_long[i]->mcef), 2, img->height_cr*2, img->width_cr*2);
    }

    free (pb);

  }

  // finally set the size
  fb->long_size=size;

  // and correct the size of mref/mcef
  alloc_mref(img);
}

/*!
 ************************************************************************
 * \brief
 *    assign a long term index to a short term picture
 *
 * \param shortID
 *    short term ID
 *
 * \param longID
 *    long term ID
 *    
 ************************************************************************
 */
void assign_long_term_id(int shortID, int longID, ImageParameters *img)
{
  int i, uv;
  int idx=-1;
  int j,id, idx1;
  Frame *f;

  printf ("assign long term long term id %d to short term id %d \n",longID, shortID);

  // try to find short term picture in buffer
  for (i=0;i<fb->short_used;i++)
  {
    if (fb->picbuf_short[i]->picID==shortID)
      idx=i;
  }

  // short term picture not found: error
  if (idx==-1)
    error ("Trying to assign a long term ID to a not existent short term picture",400);

  // return if reassignment (no error)
  if (fb->picbuf_short[idx]->lt_picID==longID)
    return;

  // copy the frame to the long term buffer
  // this may not be the best solution, but avoids messing up pointers

  /* delete frames with same long term ID */
  remove_long_term(longID);


  /* cycle frame buffer */
  f=fb->picbuf_long[fb->long_size-1];

  for (i=fb->long_size-2;i>=0;i--)
    fb->picbuf_long[i+1]=fb->picbuf_long[i];

  fb->picbuf_long[0]=f;


  fb->picbuf_long[0]->used=1;
  fb->picbuf_long[0]->picID=shortID;
  fb->picbuf_long[0]->lt_picID=longID;

  fb->picbuf_short[idx]->lt_picID=longID;

  (fb->long_used)++;
  if (fb->long_used>fb->long_size)
    fb->long_used=fb->long_size;
  
  memcpy (fb->picbuf_long[0]->mref[0], fb->picbuf_short[idx]->mref[0], img->width*img->height); 
  
  for (uv=0; uv < 2; uv++)
    memcpy (fb->picbuf_long[0]->mcef[uv][0], fb->picbuf_short[idx]->mcef[uv][0],img->width_cr*img->height_cr); 

  // sort the long term buffer by lt_IDs
  // Note: Just a  simple bubble sort implementation. The buffer is not very large
  //       so this should not take too much time. Feel free to implement something better.

  for (i=0,idx1=0;i<fb->long_used-1;i++)
  {
    id=fb->picbuf_long[i]->lt_picID;

    for (j=i+1;j<fb->long_used;j++)
    {
      if (fb->picbuf_long[j]->lt_picID<id) 
      {
        id=fb->picbuf_long[j]->lt_picID;
        idx1=j;
      }
    }
    if (id<fb->picbuf_long[i]->lt_picID)
    {
      f=fb->picbuf_long[i];
      fb->picbuf_long[i]=fb->picbuf_long[idx1];
      fb->picbuf_long[idx1]=f;
    }
  }
  
}

/*!
 ************************************************************************
 * \brief
 *    remove long term frame from buffer
 *
 * \param longID
 *    long term ID
 *    
 ************************************************************************
 */
void remove_long_term(int longID)
{
  int i,j;
  Frame *f;


  for (i=0;i<fb->long_used;i++)
  {
    if ((fb->picbuf_long[i]->lt_picID)==longID)
    {
      printf("removing long term ID %d\n",longID);

      fb->picbuf_long[i]->used=0;
      fb->picbuf_long[i]->lt_picID=-1;
      fb->picbuf_long[i]->picID=-1;
      
      fb->long_used--;

      if (i<fb->long_used) 
      {
        f=fb->picbuf_long[i];
        for (j=i;j<fb->long_used-1;j++);
          fb->picbuf_long[j]=fb->picbuf_long[j+1];
        fb->picbuf_long[fb->long_used-1]=f;
      } 
    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区999| 亚洲裸体在线观看| 国产精品欧美一级免费| 亚洲永久免费视频| 国产一区二区在线免费观看| 91免费版在线| 久久久久久久久久久电影| 亚洲v精品v日韩v欧美v专区 | 91啪亚洲精品| 久久久久久日产精品| 午夜精品免费在线| 在线亚洲+欧美+日本专区| 久久精品免费在线观看| 美国三级日本三级久久99| 欧美三级乱人伦电影| 成人在线视频首页| 一级做a爱片久久| 国产精品毛片久久久久久久| 国产99久久久国产精品免费看| 欧美日精品一区视频| 亚洲免费色视频| 国产91清纯白嫩初高中在线观看| 欧美精品三级在线观看| 日韩精品一区二区三区在线观看| 午夜私人影院久久久久| 日本福利一区二区| 亚洲国产精品激情在线观看| 蜜乳av一区二区| 精品欧美一区二区三区精品久久 | 亚洲一区二区在线视频| www.久久精品| 国产亚洲一二三区| 国产成人精品亚洲日本在线桃色 | 北条麻妃国产九九精品视频| 久久久久久久电影| 午夜精彩视频在线观看不卡| 色呦呦国产精品| 中文字幕不卡一区| 不卡的电影网站| 中文一区二区在线观看| 处破女av一区二区| 国产精品免费视频网站| 国产精品白丝jk黑袜喷水| 欧美成人一区二区三区| 亚洲一区二区四区蜜桃| 色偷偷久久人人79超碰人人澡| 中文字幕在线视频一区| 成人禁用看黄a在线| 国产欧美日韩精品一区| 成人精品一区二区三区中文字幕| 国产午夜精品久久| 成人黄色777网| 亚洲欧美综合网| 91视频免费观看| 久久成人麻豆午夜电影| 国产成人综合网| 中文字幕一区二区三区在线播放| a级高清视频欧美日韩| 亚洲色图视频免费播放| 欧美性一二三区| 日韩高清国产一区在线| 欧美一区二区大片| 国产精品一区二区三区乱码| 国产精品无码永久免费888| 99精品偷自拍| 亚洲成人免费视频| 欧美videos中文字幕| 国产99久久久国产精品潘金网站| 亚洲高清久久久| 2欧美一区二区三区在线观看视频| 成人综合婷婷国产精品久久| 免费观看日韩电影| 91精品国产综合久久久久久久| 国产呦萝稀缺另类资源| 国产精品国产三级国产aⅴ中文 | 亚洲一区在线电影| 日韩亚洲欧美综合| 欧美一区二区视频在线观看 | 久久影音资源网| 欧美精品一区视频| 亚洲国产欧美在线人成| 日本在线观看不卡视频| 91精品国产一区二区| 天堂一区二区在线| 国产精品88888| 亚洲乱码中文字幕综合| 欧美一区二区三区免费在线看| 国产成人综合在线| 图片区日韩欧美亚洲| 久久久久久久久久久久久夜| 91蜜桃在线免费视频| 亚洲精品日韩一| 国产成人免费网站| 99re8在线精品视频免费播放| 亚洲五码中文字幕| 日本一区二区久久| 91精品免费在线观看| 99久久精品国产毛片| 久久精品久久综合| 亚洲一区在线观看网站| 国产精品私房写真福利视频| 欧美一区二区三区婷婷月色| av电影在线观看一区| 久久精品99国产精品| 亚洲伊人伊色伊影伊综合网| 亚洲欧洲精品天堂一级 | 亚洲精品国产品国语在线app| 国产成人免费在线观看不卡| 手机精品视频在线观看| 亚洲品质自拍视频网站| 精品精品欲导航| 国产精品一品二品| 欧美草草影院在线视频| 日本美女一区二区三区视频| 中文字幕不卡在线观看| 在线观看国产一区二区| 日韩成人精品视频| 日韩国产欧美视频| 精品国精品国产尤物美女| 欧美亚洲一区三区| 欧美性大战久久久久久久蜜臀| 成人av高清在线| 精品在线免费观看| 欧美aaaaaa午夜精品| 蜜臀av一级做a爰片久久| 午夜精品一区二区三区三上悠亚| 亚洲午夜国产一区99re久久| 亚洲成av人片一区二区三区| 亚洲一区二区三区四区在线观看| 亚洲国产成人tv| 亚洲成人午夜电影| 国产一区视频导航| 国产精品三级av| 亚洲成人自拍偷拍| 日韩欧美中文字幕制服| 国产乱人伦偷精品视频不卡 | 精品日韩在线一区| 欧美日韩精品免费| 5566中文字幕一区二区电影| 欧美日韩极品在线观看一区| 欧美日韩中文精品| 欧美精品久久一区| 日韩欧美一区中文| 欧美精品一区二区三区高清aⅴ| 日韩欧美中文一区二区| 精品国产三级电影在线观看| www国产亚洲精品久久麻豆| 狠狠色丁香九九婷婷综合五月| 成人h动漫精品一区二| 亚洲大尺度视频在线观看| 午夜精品123| 日韩精品一级中文字幕精品视频免费观看 | 欧美久久免费观看| 在线一区二区三区四区五区 | 91在线国内视频| 久久97超碰国产精品超碰| 国内精品伊人久久久久av一坑 | 欧美成人a∨高清免费观看| 久久久亚洲精品石原莉奈 | 色呦呦日韩精品| 欧美日韩美女一区二区| 久久久久久麻豆| 亚洲私人黄色宅男| 寂寞少妇一区二区三区| 99re这里都是精品| 日韩精品中文字幕一区二区三区| 欧美激情一区二区三区全黄| 国产精品国产三级国产有无不卡 | 亚洲图片一区二区| 国内外成人在线视频| 99久久婷婷国产综合精品| 日韩欧美中文一区二区| 亚洲免费观看在线视频| 天天色 色综合| 99精品久久只有精品| 日韩一级欧美一级| 中文字幕欧美日韩一区| 久久99国产精品麻豆| 在线观看日韩精品| 国产精品无码永久免费888| 亚洲国产日韩a在线播放| 丁香六月久久综合狠狠色| 欧美日韩一区二区三区免费看| 久久精品免视看| 日本不卡视频一二三区| 色婷婷精品大视频在线蜜桃视频| 日韩一区二区在线看片| 亚洲欧美精品午睡沙发| 国产综合色视频| 日韩午夜av电影| 亚洲一区二区欧美激情| 日日摸夜夜添夜夜添国产精品| 欧美xxxxxxxx| 亚洲曰韩产成在线| 日韩一级高清毛片| 26uuu精品一区二区| 一二三区精品福利视频| fc2成人免费人成在线观看播放| 欧美精品一区二区高清在线观看 | 日韩你懂的在线播放|