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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? image.c

?? TML的參考源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
***********************************************************************
* 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 image.c
 *
 * \brief
 *    Decode a Slice
 *
 * \author
 *    Main contributors (see contributors.h for copyright, address and affiliation details)
 *    - Inge Lille-Lang鴜               <inge.lille-langoy@telenor.com>
 *    - Rickard Sjoberg                 <rickard.sjoberg@era.ericsson.se>
 *    - Jani Lainema                    <jani.lainema@nokia.com>
 *    - Sebastian Purreiter             <sebastian.purreiter@mch.siemens.de>
 *    - Byeong-Moon Jeon                <jeonbm@lge.com>
 *    - Thomas Wedi                     <wedi@tnt.uni-hannover.de>
 *    - Gabi Blaettermann               <blaetter@hhi.de>
 *    - Ye-Kui Wang                     <wangy@cs.tut.fi>
 *    - Antti Hallapuro                 <antti.hallapuro@nokia.com>
 ***********************************************************************
 */

#include "contributors.h"

#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <sys/timeb.h>
#include <string.h>


#include "global.h"
#include "elements.h"
#include "image.h"
#include "mbuffer.h"

#if _ERROR_CONCEALMENT_
#include "erc_api.h"
extern objectBuffer_t *erc_object_list;
extern ercVariables_t *erc_errorVar;
extern frame erc_recfr;
extern int erc_mvperMB;
extern struct img_par *erc_img;
#endif

extern int getBitsPos();
extern int setBitsPos(int);

#ifdef _ADAPT_LAST_GROUP_
int *last_P_no;
#endif



/*!
 ***********************************************************************
 * \brief
 *    decodes one I- or P-frame
 *
 ***********************************************************************
 */

int decode_one_frame(struct img_par *img,struct inp_par *inp, struct snr_par *snr)
{
  int current_header;
  Slice *currSlice = img->currentSlice;

#if _ERROR_CONCEALMENT_
  int received_mb_nr = 0; //to record how many MBs are correctly received in error prone transmission
  frame recfr;
#endif

  time_t ltime1;                  // for time measurement
  time_t ltime2;

#ifdef WIN32
  struct _timeb tstruct1;
  struct _timeb tstruct2;
#else
  struct timeb tstruct1;
  struct timeb tstruct2;
#endif

  int tmp_time;                   // time used by decoding the last frame

#ifdef WIN32
  _ftime (&tstruct1);             // start time ms
#else
  ftime (&tstruct1);              // start time ms
#endif
  time( &ltime1 );                // start time s

  currSlice->next_header = 0;
  while (currSlice->next_header != EOS && currSlice->next_header != SOP)
  {

    // set the  corresponding read functions
    start_slice(img, inp);

    // read new slice
    current_header = read_new_slice(img, inp);

    if (current_header == EOS)
      return EOS;

    if (inp->symbol_mode == CABAC)
    {
      init_contexts_MotionInfo(img, currSlice->mot_ctx, 1);
      init_contexts_TextureInfo(img,currSlice->tex_ctx, 1);
    }

    // init new frame
    if (current_header == SOP)
      init_frame(img, inp);

    // do reference frame buffer reordering
    reorder_mref(img);


#if _ERROR_CONCEALMENT_
    if (current_header == SOP)
    {
      if (img->number == 0) 
        ercInit(img->width, img->height, 1);
      // reset all variables of the error concealmnet instance before decoding of every frame.
      // here the third parameter should, if perfectly, be equal to the number of slices per frame.
      // using little value is ok, the code will alloc more memory if the slice number is larger
      ercReset(erc_errorVar, img->max_mb_nr, MAX_SLICES_PER_FRAME);
      erc_mvperMB = 0;
    }
    // mark the start of a slice 
    ercStartSegment(currSlice->start_mb_nr, ((currSlice->start_mb_nr == 0) ? 0 : -1), 0 , erc_errorVar);
    

    // decode main slice information
    if ((current_header == SOP || current_header == SOS) && currSlice->ei_flag == 0)
      decode_one_slice(img,inp);
#else

    // decode main slice information
    if (current_header == SOP || current_header == SOS)
      decode_one_slice(img,inp);

#endif
    
    
#if _ERROR_CONCEALMENT_
    if(!currSlice->ei_flag)  // slice received
    {
      ercStopSegment(img->current_mb_nr-1, -1, 0, erc_errorVar); // stop the current slice 
      ercMarkCurrSegmentOK(currSlice->start_mb_nr, img->width, erc_errorVar);
      received_mb_nr += img->current_mb_nr - currSlice->start_mb_nr;
    }
    else    // at least one slice lost
    {
      ercStopSegment(currSlice->last_mb_nr, -1, 0, erc_errorVar);
      ercMarkCurrSegmentLost(currSlice->start_mb_nr, img->width, erc_errorVar);
      received_mb_nr += (currSlice->last_mb_nr + 1) - currSlice->start_mb_nr;
      //! Should never happen, but to be sure
      //! Changed TO 12.11.2001
      if(received_mb_nr > img->max_mb_nr)
        received_mb_nr = img->max_mb_nr;
      img->current_mb_nr = currSlice->last_mb_nr + 1;
    }
#endif
    
    if(currSlice->next_eiflag && img->current_mb_nr != img->max_mb_nr)
      currSlice->next_header = SOS;
    
    img->current_slice_nr++;

  }

#if _ERROR_CONCEALMENT_
  
  recfr.yptr = &imgY[0][0];
  recfr.uptr = &imgUV[0][0][0];
  recfr.vptr = &imgUV[1][0][0];

  /* call the right error concealment function depending on the frame type.
      here it is simulated that only the first frame is Intra, the rest is Inter. */
  erc_mvperMB /= received_mb_nr;
  erc_img = img;
  if(img->type == INTRA_IMG) // I-frame
    ercConcealIntraFrame(&recfr, img->width, img->height, erc_errorVar);
  else
    ercConcealInterFrame(&recfr, erc_object_list, img->width, img->height, erc_errorVar);
#endif

  if (p_ref)
    find_snr(snr,img,p_ref,inp->postfilter);      // if ref sequence exist

#ifdef WIN32
  _ftime (&tstruct2);   // end time ms
#else
  ftime (&tstruct2);    // end time ms
#endif
  time( &ltime2 );                                // end time sec
  tmp_time=(ltime2*1000+tstruct2.millitm) - (ltime1*1000+tstruct1.millitm);
  tot_time=tot_time + tmp_time;

  if(img->type == INTRA_IMG) // I picture
    fprintf(stdout,"%3d(I)  %3d %5d %7.4f %7.4f %7.4f %5d\n",
        frame_no, img->tr, img->qp,snr->snr_y,snr->snr_u,snr->snr_v,tmp_time);
  else if(img->type == INTER_IMG_1 || img->type == INTER_IMG_MULT) // P pictures
    fprintf(stdout,"%3d(P)  %3d %5d %7.4f %7.4f %7.4f %5d\n",
    frame_no, img->tr, img->qp,snr->snr_y,snr->snr_u,snr->snr_v,tmp_time);
  else if(img->type == SP_IMG_1 || img->type == SP_IMG_MULT) // SP pictures
    fprintf(stdout,"%3d(SP) %3d %5d %7.4f %7.4f %7.4f %5d\n",
    frame_no, img->tr, img->qp,snr->snr_y,snr->snr_u,snr->snr_v,tmp_time);
  else // B pictures
    fprintf(stdout,"%3d(B)  %3d %5d %7.4f %7.4f %7.4f %5d\n",
        frame_no, img->tr, img->qp,snr->snr_y,snr->snr_u,snr->snr_v,tmp_time);

  fflush(stdout);

  if(img->type == INTRA_IMG || img->type == INTER_IMG_1 || img->type == INTER_IMG_MULT) // I or P pictures
    copy_Pframe(img, inp->postfilter);  // imgY-->imgY_prev, imgUV-->imgUV_prev
  else if(img->type == SP_IMG_1 || img->type == SP_IMG_MULT) // SP pictures
    copy_Pframe(img, inp->postfilter);  // imgY-->imgY_prev, imgUV-->imgUV_prev
  else // B pictures
    write_frame(img,inp->postfilter,p_out);         // write image to output YUV file
  
  //! TO 19.11.2001 Known Problem: for init_frame we have to know the picture type of the actual frame
  //! in case the first slice of the P-Frame following the I-Frame was lost we decode this P-Frame but 
  //! do not write it because it was assumed to be an I-Frame in init_frame. So we force the decoder to
  //! guess the right picture type. This is a hack a should be removed by the time there is a clean
  //! solution where we do not have to know the picture type for the function init_frame.
  if(img->type == INTRA_IMG)
    img->type = INTER_IMG_1;
  //! End TO 19.11.2001

  if(img->type <= INTRA_IMG || img->type >= SP_IMG_1)   // I or P pictures
    img->number++;
  else
    Bframe_ctr++;    // B pictures

  exit_frame(img, inp);

  img->current_mb_nr = 0;
  img->current_slice_nr = 0;
  return (SOP);
}



/*!
 ************************************************************************
 * \brief
 *    Find PSNR for all three components.Compare decoded frame with
 *    the original sequence. Read inp->jumpd frames to reflect frame skipping.
 ************************************************************************
 */
void find_snr(
  struct snr_par *snr,   //!< pointer to snr parameters
  struct img_par *img,   //!< pointer to image parameters
  FILE *p_ref,           //!< filestream to reference YUV file
  int postfilter)        //!< postfilterin on (=1) or off (=1)
{
  int i,j;
  int diff_y,diff_u,diff_v;
  int uv;
  int  status;
  static int modulo_ctr = 0;
  static int modulo_ctr_b = 0;
  static int modolo_flag = 0;
  static int pic_id_old = 0, pic_id_old_b = 0;
  Slice *currSlice = img->currentSlice;

#ifndef _ADAPT_LAST_GROUP_
  byte       diff;
#endif

#ifndef _ADAPT_LAST_GROUP_
  if(img->type<=INTRA_IMG || img->type >= SP_IMG_1) // I, P pictures
    frame_no=img->number*P_interval;
  else // B pictures
  {
    diff=nextP_tr-img->tr;
    frame_no=(img->number-1)*P_interval-diff;
  }
#else
  // TO 5.11.2001 We do have some problems finding the correct frame in the original sequence
  // if errors appear. In this case the method of using this p_frame_no, nextP_tr, prevP_tr
  // variables does not work. So I use the picture_id instead.
  if (img->type <= INTRA_IMG || img->type >= SP_IMG_1) // I, P
  {
    if (img->number > 0)
    {
      if ((currSlice->picture_id < pic_id_old) && !modolo_flag)
      {
        modulo_ctr++;
        modolo_flag = 1;
      }
      else
        modolo_flag = 0;

      frame_no = currSlice->picture_id + (256*modulo_ctr);
      pic_id_old = currSlice->picture_id;
    }
    else
      frame_no = 0;
  }
  else // B
  {
    if ((currSlice->picture_id < pic_id_old_b) && !modolo_flag)
    {
      modulo_ctr_b++;
      modolo_flag = 1;
    }
    else
      modolo_flag = 0;

    frame_no = currSlice->picture_id + (256*modulo_ctr_b);
    pic_id_old_b = currSlice->picture_id;
  }
#endif

  rewind(p_ref);
  status = fseek (p_ref, frame_no*img->height*img->width*3/2, 0);
  if (status != 0)
  {
    snprintf(errortext, ET_SIZE, "Error in seeking img->tr: %d", img->tr);
    error(errortext, 500);
  }
  for (j=0; j < img->height; j++)
    for (i=0; i < img->width; i++)
      imgY_ref[j][i]=fgetc(p_ref);
  for (uv=0; uv < 2; uv++)
    for (j=0; j < img->height_cr ; j++)
      for (i=0; i < img->width_cr; i++)
        imgUV_ref[uv][j][i]=fgetc(p_ref);

  img->quad[0]=0;
  diff_y=0;
  for (i=0; i < img->width; ++i)
  {
    for (j=0; j < img->height; ++j)
    {
      diff_y += img->quad[abs(imgY[j][i]-imgY_ref[j][i])];
    }
  }

  // Chroma
  diff_u=0;
  diff_v=0;

  for (i=0; i < img->width_cr; ++i)
  {
    for (j=0; j < img->height_cr; ++j)
    {
      diff_u += img->quad[abs(imgUV_ref[0][j][i]-imgUV[0][j][i])];
      diff_v += img->quad[abs(imgUV_ref[1][j][i]-imgUV[1][j][i])];
    }
  }

  // Collecting SNR statistics
  if (diff_y != 0)
  {
    snr->snr_y=(float)(10*log10(65025*(float)(img->width)*(img->height)/(float)diff_y));        // luma snr for current frame
  }

  if (diff_u != 0)
  {
    snr->snr_u=(float)(10*log10(65025*(float)(img->width)*(img->height)/(float)(4*diff_u)));    //  chroma snr for current frame
    snr->snr_v=(float)(10*log10(65025*(float)(img->width)*(img->height)/(float)(4*diff_v)));    //  chroma snr for current frame
  }

  if (img->number == 0) // first
  {
    snr->snr_y1=(float)(10*log10(65025*(float)(img->width)*(img->height)/(float)diff_y));       // keep luma snr for first frame

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产污网站| 久久午夜电影网| 国产河南妇女毛片精品久久久| 亚洲黄色小视频| 久久精品一区二区三区不卡牛牛 | 色狠狠桃花综合| 国产一区二区精品久久99| 亚洲综合区在线| 一区二区中文视频| 久久综合久久鬼色| 7777精品伊人久久久大香线蕉的| 丁香婷婷深情五月亚洲| 麻豆精品视频在线观看免费| 亚洲综合色噜噜狠狠| 中文字幕一区二区日韩精品绯色| 精品国产自在久精品国产| 欧美日韩一区二区不卡| 一本色道a无线码一区v| 成人国产精品免费观看动漫| 国内一区二区在线| 美女在线视频一区| 秋霞午夜av一区二区三区| 亚洲在线观看免费| 国产精品麻豆欧美日韩ww| 国产三级欧美三级日产三级99 | 91国模大尺度私拍在线视频| 福利一区二区在线| 国产精品资源在线| 国产一区在线视频| 国产麻豆精品一区二区| 日韩不卡一区二区三区| 日韩精品久久理论片| 亚洲va中文字幕| 亚洲成人av福利| 亚洲与欧洲av电影| 亚洲一区国产视频| 亚洲大片在线观看| 亚洲一区在线观看网站| 一区二区免费看| 亚洲一区二区三区小说| 一区二区三区色| 亚洲妇熟xx妇色黄| 亚洲丰满少妇videoshd| 天堂成人国产精品一区| 日韩av电影免费观看高清完整版在线观看| 亚洲国产一二三| 日韩精品91亚洲二区在线观看| 日本欧美在线观看| 麻豆精品久久久| 国产ts人妖一区二区| 成人激情免费视频| 日本电影欧美片| 5858s免费视频成人| 日韩午夜在线影院| 久久精品欧美日韩精品| 中文字幕亚洲一区二区av在线 | 日本午夜一区二区| 狠狠网亚洲精品| av在线不卡网| 欧美狂野另类xxxxoooo| 欧美精品一区在线观看| 国产精品私人影院| 亚洲最新视频在线观看| 日韩av电影免费观看高清完整版 | 狠狠色丁香婷综合久久| 国产激情一区二区三区四区 | 精品国精品自拍自在线| 国产欧美一区二区三区网站| 亚洲视频免费在线观看| 香蕉久久一区二区不卡无毒影院 | 亚洲视频免费在线| 五月婷婷久久综合| 经典三级视频一区| 91老师片黄在线观看| 91麻豆精品国产| 国产视频一区二区三区在线观看| 亚洲欧美日韩一区| 麻豆91精品91久久久的内涵| 成人精品在线视频观看| 在线不卡中文字幕播放| 国产日本一区二区| 天堂一区二区在线| av日韩在线网站| 制服丝袜亚洲精品中文字幕| 中文在线资源观看网站视频免费不卡| 一区二区三区四区不卡在线 | 色综合视频在线观看| 欧美一区二区网站| 国产精品护士白丝一区av| 亚洲成年人网站在线观看| 国产成人aaa| 69堂精品视频| 亚洲视频在线一区| 国产一区视频导航| 欧美日韩成人一区二区| 国产精品理伦片| 老司机精品视频线观看86| 91久久国产最好的精华液| 久久久久久99精品| 午夜电影网一区| 91丝袜国产在线播放| 精品国产91洋老外米糕| 亚洲国产精品天堂| av电影在线不卡| 26uuu久久天堂性欧美| 日韩激情中文字幕| 色哟哟精品一区| 日本一区二区三区在线不卡| 丝袜亚洲另类欧美| 日本电影欧美片| 亚洲视频免费观看| 成人在线综合网| 2020国产成人综合网| 日韩精品一卡二卡三卡四卡无卡| 一本色道a无线码一区v| 国产精品久久网站| 国产ts人妖一区二区| 久久精品视频免费观看| 九九九久久久精品| 欧美v亚洲v综合ⅴ国产v| 日本vs亚洲vs韩国一区三区二区 | 亚洲桃色在线一区| 国产精品香蕉一区二区三区| 日韩欧美在线影院| 亚洲乱码国产乱码精品精98午夜 | 亚洲欧美中日韩| 国产麻豆一精品一av一免费| 欧美日韩精品三区| 有码一区二区三区| 在线观看av一区二区| 国产精品久久久久9999吃药| 久久99精品视频| 日韩欧美中文字幕公布| 午夜a成v人精品| 91精品国产丝袜白色高跟鞋| 亚洲午夜免费福利视频| 色香蕉成人二区免费| 国产精品欧美一区二区三区| 国产高清在线精品| 日本一区二区三级电影在线观看 | 国产成人自拍网| 日韩女优毛片在线| 麻豆精品一区二区三区| 日韩欧美成人激情| 亚洲美女在线一区| 欧美午夜精品久久久久久超碰| 中文字幕一区在线观看| 99国产精品一区| 一区二区三区四区不卡视频| 91老师片黄在线观看| 一区二区三区.www| 在线观看一区二区视频| 一区二区久久久久久| 日本成人中文字幕在线视频| 欧美电影免费观看高清完整版| 美女一区二区三区| 337p日本欧洲亚洲大胆精品| 国产永久精品大片wwwapp| 欧美日韩成人综合在线一区二区| 久久精品久久久精品美女| 精品少妇一区二区三区在线播放| 精品在线视频一区| 26uuu久久天堂性欧美| 国产精品亚洲一区二区三区妖精 | 久久亚洲精品小早川怜子| 欧美三级日韩三级| 亚洲一区国产视频| 欧美福利视频一区| 蜜桃免费网站一区二区三区| 久久综合九色综合久久久精品综合| 成人在线视频一区二区| 亚洲欧洲国产专区| 欧美吞精做爰啪啪高潮| 美女视频一区在线观看| 欧美一区二区三区在线看| 国产成a人亚洲精品| 亚洲精品视频在线观看网站| 精品视频在线看| 久久不见久久见中文字幕免费| 久久午夜电影网| 色综合天天做天天爱| 日韩精品视频网| 国产欧美精品区一区二区三区| 波多野结衣亚洲一区| 麻豆一区二区99久久久久| 国产亚洲视频系列| 欧美三区在线观看| 国内欧美视频一区二区 | 一个色妞综合视频在线观看| 91久久线看在观草草青青| 久久黄色级2电影| 国产精品第一页第二页第三页| 欧美午夜免费电影| 国产福利一区在线| 伊人色综合久久天天人手人婷| 久久综合九色综合97婷婷女人| 99久久婷婷国产精品综合| 欧美96一区二区免费视频| 中文字幕一区二区日韩精品绯色 | 久久影音资源网|