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

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

?? image.c

?? 可以用H.264編碼解碼器源碼(c語言)
?? C
?? 第 1 頁 / 共 4 頁
字號:

/*!
 ***********************************************************************
 * \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                     <wyk@ieee.org>
 *    - Antti Hallapuro                 <antti.hallapuro@nokia.com>
 *    - Alexis Tourapis                 <alexismt@ieee.org>
 ***********************************************************************
 */

#include "contributors.h"

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


#include "global.h"
#include "errorconcealment.h"
#include "image.h"
#include "mbuffer.h"
#include "fmo.h"
#include "nalu.h"
#include "parsetcommon.h"
#include "parset.h"
#include "header.h"
#include "rtp.h"
#include "sei.h"
#include "output.h"
#include "biaridecod.h"
#include "mb_access.h"

#include "context_ini.h"
#include "cabac.h"

#include "vlc.h"

#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;

//extern FILE *p_out2;

extern StorablePicture **listX[6];

StorablePicture *dec_picture;

void MbAffPostProc()
{
  byte temp[16][32];

  byte ** imgY  = dec_picture->imgY;
  byte ***imgUV = dec_picture->imgUV;

  int i, x, y, x0, y0, uv;
  for (i=0; i<(int)img->PicSizeInMbs; i+=2)
  {
    if (dec_picture->mb_field[i])
    {
      get_mb_pos(i, &x0, &y0);
      for (y=0; y<(2*MB_BLOCK_SIZE);y++)
        for (x=0; x<MB_BLOCK_SIZE; x++)
          temp[x][y] = imgY[y0+y][x0+x];

      for (y=0; y<MB_BLOCK_SIZE;y++)
        for (x=0; x<MB_BLOCK_SIZE; x++)
        {
          imgY[y0+(2*y)][x0+x]   = temp[x][y];
          imgY[y0+(2*y+1)][x0+x] = temp[x][y+MB_BLOCK_SIZE];
        }

      x0 = x0/2;
      y0 = y0/2;

      for (uv=0; uv<2; uv++)
      {
        for (y=0; y<(2*MB_BLOCK_SIZE/2);y++)
          for (x=0; x<MB_BLOCK_SIZE/2; x++)
            temp[x][y] = imgUV[uv][y0+y][x0+x];
          
        for (y=0; y<MB_BLOCK_SIZE/2;y++)
          for (x=0; x<MB_BLOCK_SIZE/2; x++)
          {
            imgUV[uv][y0+(2*y)][x0+x]   = temp[x][y];
            imgUV[uv][y0+(2*y+1)][x0+x] = temp[x][y+MB_BLOCK_SIZE/2];
          }
      }
    }
  }
}

/*!
 ***********************************************************************
 * \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;
  int ercStartMB;
  int ercSegment;
//  frame recfr;

  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

  img->current_slice_nr = 0;
  img->current_mb_nr = -4711;     // initialized to an impossible value for debugging -- correct value is taken from slice header
  currSlice->next_header = -8888; // initialized to an impossible value for debugging -- correct value is taken from slice header
  img->num_dec_mb = 0;

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

    if (current_header == EOS)
      return EOS;

    if (img->structure == FRAME)
      decode_frame_slice(img, inp, current_header);
    else 
      decode_field_slice(img, inp, current_header);

    img->current_slice_nr++;
  }

  if (img->MbaffFrameFlag)
    MbAffPostProc();

  //deblocking for frame or first field
  DeblockFrame( img, dec_picture->imgY, dec_picture->imgUV ) ;
  store_picture_in_dpb(dec_picture);
  dec_picture=NULL;

  if(img->structure != FRAME)       //if the previous pict is top or bottom field, 
  {
    img->current_slice_nr = 0;
    currSlice->next_header = -8889;
    img->num_dec_mb = 0;
    while ((currSlice->next_header != EOS && currSlice->next_header != SOP))
    {   
      current_header = read_new_slice();
      
      if (current_header == EOS)
        return EOS;
      
      decode_field_slice(img, inp, current_header);
      
      img->current_slice_nr++;  
    }

    //deblocking second field
    DeblockFrame( img, dec_picture->imgY, dec_picture->imgUV ) ;
    store_picture_in_dpb(dec_picture);
    dec_picture=NULL;
  }

  g_new_frame=1;

/*  recfr.yptr = &imgY[0][0];
  recfr.uptr = &imgUV[0][0][0];
  recfr.vptr = &imgUV[1][0][0];
*/
  //! this is always true at the beginning of a frame
  ercStartMB = 0;
  ercSegment = 0;

/* !KS: This needs to be fixed for multiple slices
  
  //! mark the start of the first segment
  ercStartSegment(0, ercSegment, 0 , erc_errorVar);
  //! generate the segments according to the macroblock map
  for(i = 1; i<img->PicSizeInMbs; i++)
  {
    if(img->mb_data[i].ei_flag != img->mb_data[i-1].ei_flag)
    {
      ercStopSegment(i-1, ercSegment, 0, erc_errorVar); //! stop current segment
      
      //! mark current segment as lost or OK
      if(img->mb_data[i-1].ei_flag)
        ercMarkCurrSegmentLost(img->width, erc_errorVar);
      else
        ercMarkCurrSegmentOK(img->width, erc_errorVar);
      
      ercSegment++;  //! next segment
      ercStartSegment(i, ercSegment, 0 , erc_errorVar); //! start new segment
      ercStartMB = i;//! save start MB for this segment 
    }
  }
  //! mark end of the last segent
  ercStopSegment(img->PicSizeInMbs-1, ercSegment, 0, erc_errorVar);
  if(img->mb_data[i-1].ei_flag)
    ercMarkCurrSegmentLost(img->width, erc_errorVar);
  else
    ercMarkCurrSegmentOK(img->width, erc_errorVar);

  //! call the right error concealment function depending on the frame type.
  erc_mvperMB /= img->PicSizeInMbs;

  erc_img = img;
  if(img->type == I_SLICE || img->type == SI_SLICE) // I-frame
    ercConcealIntraFrame(&recfr, img->width, img->height, erc_errorVar);
  else
    ercConcealInterFrame(&recfr, erc_object_list, img->width, img->height, erc_errorVar);
*/
  

  if (img->structure == FRAME)         // buffer mgt. for frame mode
    frame_postprocessing(img, inp);
  else
    field_postprocessing(img, inp);   // reset all interlaced variables

  post_poc( img );                    // POC200301


#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 == I_SLICE) // I picture
    fprintf(stdout,"%3d(I)  %3d %5d %7.4f %7.4f %7.4f %5d\n",
        frame_no, img->ThisPOC, img->qp,snr->snr_y,snr->snr_u,snr->snr_v,tmp_time);
  else if(img->type == P_SLICE) // P pictures
    fprintf(stdout,"%3d(P)  %3d %5d %7.4f %7.4f %7.4f %5d\n",
    frame_no, img->ThisPOC, img->qp,snr->snr_y,snr->snr_u,snr->snr_v,tmp_time);
  else if(img->type == SP_SLICE) // SP pictures
    fprintf(stdout,"%3d(SP) %3d %5d %7.4f %7.4f %7.4f %5d\n",
    frame_no, img->ThisPOC, img->qp,snr->snr_y,snr->snr_u,snr->snr_v,tmp_time);
  else if (img->type == SI_SLICE)
    fprintf(stdout,"%3d(SI) %3d %5d %7.4f %7.4f %7.4f %5d\n",
    frame_no, img->ThisPOC, img->qp,snr->snr_y,snr->snr_u,snr->snr_v,tmp_time);
  else if(!img->disposable_flag) // stored B pictures
    fprintf(stdout,"%3d(BS) %3d %5d %7.4f %7.4f %7.4f %5d\n",
        frame_no, img->ThisPOC, 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->ThisPOC, img->qp,snr->snr_y,snr->snr_u,snr->snr_v,tmp_time);

  fflush(stdout);

  //! 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 == I_SLICE)
    img->type = P_SLICE;
  //! End TO 19.11.2001

  if(img->type == I_SLICE || img->type == SI_SLICE || img->type == P_SLICE || !img->disposable_flag)   // I or P pictures
    img->number++;
  else
    Bframe_ctr++;    // B pictures

  exit_frame(img, inp);

  if (img->structure != FRAME)
  {
    img->height /= 2;
    img->height_cr /= 2;
  }

  img->current_mb_nr = -4712;   // impossible value for debugging, StW
  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
  StorablePicture *p,     //!< picture to be compared
  FILE *p_ref)            //!< filestream to reference YUV file
{
  int i,j;
  int diff_y,diff_u,diff_v;
  int uv;
  int  status;

  // calculate frame number
  // KS: This works for the way, the HHI encoder sets POC
    frame_no = img->ThisPOC/2;

  rewind(p_ref);

  for (i=0; i<frame_no; i++)
  {
    status = fseek (p_ref, (long) p->size_y* (long) (p->size_x*3/2), SEEK_CUR);
    if (status != 0)
    {
      snprintf(errortext, ET_SIZE, "Error in seeking frame number: %d", frame_no);
      error(errortext, 500);
    }
  }

  for (j=0; j < p->size_y; j++)
    for (i=0; i < p->size_x; i++)
      imgY_ref[j][i]=fgetc(p_ref);

  for (uv=0; uv < 2; uv++)
    for (j=0; j < p->size_y_cr ; j++)
      for (i=0; i < p->size_x_cr; i++)
        imgUV_ref[uv][j][i]=fgetc(p_ref);

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

  // Chroma
  diff_u=0;
  diff_v=0;

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

/*  if (diff_y == 0)
      diff_y = 1;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区理论电影在线观看| 久久国产视频网| 亚洲午夜一二三区视频| 激情久久五月天| 欧美视频你懂的| 久久精品无码一区二区三区| 亚洲综合另类小说| 成人午夜精品一区二区三区| 7777女厕盗摄久久久| 亚洲九九爱视频| 成人一区在线观看| 久久综合色之久久综合| 日日夜夜精品视频免费| 91精彩视频在线观看| 国产精品理论片| 国产激情一区二区三区桃花岛亚洲| 欧美人动与zoxxxx乱| 亚洲欧美一区二区三区极速播放| 国产福利不卡视频| 精品久久久网站| 久久精品国产亚洲一区二区三区 | 亚洲靠逼com| 成人毛片老司机大片| 久久久精品影视| 美国一区二区三区在线播放| 在线综合亚洲欧美在线视频| 亚洲国产精品自拍| 欧美三区在线视频| 亚洲成精国产精品女| 日本乱码高清不卡字幕| 综合久久久久久| 99久久国产综合精品色伊| 国产精品美女久久久久久久久久久 | 自拍偷拍国产精品| jlzzjlzz欧美大全| 成人欧美一区二区三区小说| 成人av影院在线| 自拍偷拍亚洲欧美日韩| 91激情五月电影| 日韩中文字幕麻豆| 日韩女优视频免费观看| 国产精品一区2区| 日本一二三不卡| 色婷婷精品大视频在线蜜桃视频| 一区二区在线观看免费视频播放| 91福利国产成人精品照片| 亚洲成人你懂的| 日韩欧美综合一区| 国产一区二区三区av电影| 欧美国产乱子伦| 色94色欧美sute亚洲线路二 | 日韩一区有码在线| 色老汉一区二区三区| 日韩成人一级片| 久久综合色婷婷| 色偷偷久久人人79超碰人人澡 | 日韩美女视频19| 欧美吻胸吃奶大尺度电影| 久久精品久久精品| 一区二区中文字幕在线| 欧美精品一二三区| 国产成人午夜电影网| 亚洲精品少妇30p| 日韩免费观看高清完整版| 成人ar影院免费观看视频| 日韩影视精彩在线| 亚洲国产成人一区二区三区| 欧美性受极品xxxx喷水| 国产一区二区三区免费观看| 亚洲一卡二卡三卡四卡无卡久久 | 亚洲精品日韩综合观看成人91| 6080yy午夜一二三区久久| 成人av动漫在线| 蜜芽一区二区三区| 亚洲日本在线a| 久久久久久久久久美女| 欧美精品日韩综合在线| 成人的网站免费观看| 精品在线视频一区| 洋洋av久久久久久久一区| 欧美国产一区视频在线观看| 欧美一区二区成人6969| 色吊一区二区三区| 国产成人亚洲精品狼色在线| 蜜桃视频一区二区三区在线观看| 亚洲精品一二三区| 国产精品美女一区二区在线观看| 日韩欧美一区二区久久婷婷| 欧美性三三影院| a级精品国产片在线观看| 国内精品视频666| 美女免费视频一区| 日韩中文字幕91| 亚洲国产婷婷综合在线精品| 国产精品美女视频| 欧美激情一区在线观看| 精品久久久久99| 日韩欧美一二区| 日韩一区二区在线观看视频| 精品视频在线视频| 色婷婷av一区二区三区软件| 99视频国产精品| 不卡视频在线观看| 国产精品1区2区3区在线观看| 琪琪久久久久日韩精品| 婷婷丁香激情综合| 午夜精品福利一区二区三区蜜桃| 亚洲精品成人少妇| 亚洲欧美一区二区三区国产精品| 亚洲欧美怡红院| 亚洲欧美一区二区视频| 亚洲色图视频免费播放| 自拍偷拍亚洲欧美日韩| 亚洲欧美精品午睡沙发| 亚洲欧美另类图片小说| 一区二区三区资源| 亚洲高清免费一级二级三级| 天堂av在线一区| 日本不卡一区二区| 国产在线视频一区二区三区| 国产一区二区三区美女| 国产福利不卡视频| 91色.com| 欧美日韩国产电影| 欧美一区二区三区小说| 26uuu国产日韩综合| 中文在线资源观看网站视频免费不卡| 国产精品女人毛片| 亚洲另类在线视频| 日韩成人一区二区| 国产精选一区二区三区| 不卡的av在线| 欧美久久一二三四区| 精品国产免费久久 | 日日夜夜精品免费视频| 国产在线精品一区二区不卡了| 国产精品自拍av| 91麻豆123| 91精品国产一区二区三区蜜臀| 精品久久人人做人人爰| 亚洲欧洲精品一区二区三区不卡| 亚洲福中文字幕伊人影院| 另类小说视频一区二区| 成人丝袜18视频在线观看| 色婷婷精品久久二区二区蜜臂av| 91麻豆精品国产91久久久久久久久 | 国产一区欧美日韩| av激情亚洲男人天堂| 欧美人体做爰大胆视频| 久久久精品黄色| 亚洲va天堂va国产va久| 国产精品一区二区久久精品爱涩| 99精品欧美一区| 日韩免费电影网站| 亚洲欧美视频在线观看视频| 久久99国产精品免费| 色哟哟一区二区| 久久只精品国产| 亚洲成人午夜影院| a级精品国产片在线观看| 日韩免费一区二区| 亚洲制服丝袜一区| 国产成人综合亚洲91猫咪| 欧美久久久久久蜜桃| 亚洲欧洲三级电影| 国产一区二区h| 欧美精品色综合| 亚洲人成精品久久久久久| 国产精品香蕉一区二区三区| 666欧美在线视频| 亚洲综合一区二区精品导航| 成人免费观看av| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 欧美一级二级在线观看| 亚洲欧美一区二区久久| 成人天堂资源www在线| 久久久亚洲精品一区二区三区| 日产欧产美韩系列久久99| 色视频成人在线观看免| 中文字幕中文字幕一区| 国产高清久久久久| 26uuu亚洲婷婷狠狠天堂| 日韩精品三区四区| 欧美体内she精高潮| 亚洲欧美日韩久久精品| 99久久综合狠狠综合久久| 国产午夜精品久久久久久免费视| 麻豆精品一区二区综合av| 欧美一区二区三区喷汁尤物| 视频一区二区三区在线| 欧美日韩成人综合| 亚洲成人av免费| 欧美三级三级三级爽爽爽| 亚洲精选免费视频| 欧美在线观看视频在线| 亚洲香肠在线观看| 精品视频色一区| 日韩av中文在线观看| 精品剧情v国产在线观看在线| 美女视频一区二区|