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

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

?? image.c

?? 一個簡單的視頻會議VC++MFC工程文件
?? C
?? 第 1 頁 / 共 5 頁
字號:

/*!
 *************************************************************************************
 * \file image.c
 *
 * \brief
 *    Code one image/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>
 *     - Yoon-Seong Soh                  <yunsung@lge.com>
 *     - Thomas Stockhammer              <stockhammer@ei.tum.de>
 *     - Detlev Marpe                    <marpe@hhi.de>
 *     - Guido Heising                   <heising@hhi.de>
 *     - Thomas Wedi                     <wedi@tnt.uni-hannover.de>
 *     - Ragip Kurceren                  <ragip.kurceren@nokia.com>
 *     - Antti Hallapuro                 <antti.hallapuro@nokia.com>
 *     - Alexandros Tourapis                     <alexismt@ieee.org> 
 *************************************************************************************
 */
#include "contributors.h"

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

#include "global.h"
#include "image.h"
#include "refbuf.h"
#include "mbuffer.h"
#include "header.h"
#include "intrarefresh.h"
#include "fmo.h"
#include "sei.h"
#include "memalloc.h"
#include "nalu.h"
#include "ratectl.h"
#include "mb_access.h"

void code_a_picture(Picture *pic);
void frame_picture (Picture *frame);
void field_picture(Picture *top, Picture *bottom);

static int  writeout_picture(Picture *pic);

static int  picture_structure_decision(Picture *frame, Picture *top, Picture *bot);
static void distortion_fld (float *dis_fld_y, float *dis_fld_u, float *dis_fld_v);
static void find_snr();
static void find_distortion();

static void field_mode_buffer(int bit_field, float snr_field_y, float snr_field_u, float snr_field_v);
static void frame_mode_buffer (int bit_frame, float snr_frame_y, float snr_frame_u, float snr_frame_v);

static void init_frame();
static void init_field();

static void put_buffer_frame();
static void put_buffer_top();
static void put_buffer_bot();

static void copy_motion_vectors_MB();

static void CopyFrameToOldImgOrgVariables (Sourceframe *sf);
static void CopyTopFieldToOldImgOrgVariables (Sourceframe *sf);
static void CopyBottomFieldToOldImgOrgVariables (Sourceframe *sf);
static Sourceframe *AllocSourceframe (int xs, int ys);
static void FreeSourceframe (Sourceframe *sf);
static void ReadOneFrame (int FrameNoInFile, int HeaderSize, int xs, int ys, Sourceframe *sf);
static void writeUnit(Bitstream* currStream ,int partition);

#ifdef _ADAPT_LAST_GROUP_
int *last_P_no;
int *last_P_no_frm;
int *last_P_no_fld;
#endif

static void ReportFirstframe(int tmp_time, int me_time);
static void ReportIntra(int tmp_time, int me_time);
static void ReportSP(int tmp_time, int me_time);
static void ReportBS(int tmp_time, int me_time);
static void ReportP(int tmp_time, int me_time);
static void ReportB(int tmp_time, int me_time);
static void ReportNALNonVLCBits(int tmp_time, int me_time);

/*
static void ReportFirstframe(int tmp_time);
static void ReportIntra(int tmp_time);
static void ReportSP(int tmp_time);
static void ReportBS(int tmp_time);
static void ReportP(int tmp_time);
static void ReportB(int tmp_time);
*/

static int CalculateFrameNumber();  // Calculates the next frame number
static int FrameNumberInFile;       // The current frame number in the input file
static Sourceframe *srcframe;

StorablePicture *enc_picture;
StorablePicture *enc_frame_picture;
StorablePicture *enc_top_picture;
StorablePicture *enc_bottom_picture;
//Rate control
int    QP;

const int ONE_FOURTH_TAP[3][2] =
{
  {20,20},
  {-5,-4},
  { 1, 0},
};


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

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

  int i, x, y, x0, y0, uv;
  for (i=0; i<(int)img->PicSizeInMbs; i+=2)
  {
    if (enc_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
 *    Encodes a picture
 *
 *    This is the main picture coding loop.. It is called by all this
 *    frame and field coding stuff after the img-> elements have been
 *    set up.  Not sure whether it is useful for MB-adaptive frame/field
 *    coding
 ************************************************************************
 */
void code_a_picture(Picture *pic)
{
  int NumberOfCodedMBs = 0;
  int SliceGroup = 0;
  int j;

  img->currentPicture = pic;

  img->currentPicture->idr_flag = ((!IMG_NUMBER) && (!(img->structure==BOTTOM_FIELD))) || (input->idr_enable && (img->type == I_SLICE || img->type==SP_SLICE || img->type==SI_SLICE)&& (!(img->structure==BOTTOM_FIELD)));

  pic->no_slices = 0;
  pic->distortion_u = pic->distortion_v = pic->distortion_y = 0.0;

  // restrict list 1 size
  img->num_ref_idx_l0_active = max(1, (img->type==B_SLICE ? active_pps->num_ref_idx_l0_active_minus1 + 1: active_pps->num_ref_idx_l0_active_minus1 +1 )); 
  img->num_ref_idx_l1_active = (img->type==B_SLICE ? active_pps->num_ref_idx_l1_active_minus1 + 1 : 0);


  // generate reference picture lists
  init_lists(img->type, img->structure);

  // assign list 0 size from list size
  img->num_ref_idx_l0_active = listXsize[0];
  img->num_ref_idx_l1_active = listXsize[1];

  //if (!img->MbaffFrameFlag)
  {
    if ((img->type == P_SLICE || img->type == SP_SLICE) && input->P_List0_refs)
    {
      img->num_ref_idx_l0_active = min(img->num_ref_idx_l0_active, input->P_List0_refs);
      listXsize[0] = min(listXsize[0], input->P_List0_refs);  
    }
    if (img->type == B_SLICE )
    {
      
      if (input->B_List0_refs)
      {
        img->num_ref_idx_l0_active = min(img->num_ref_idx_l0_active, input->B_List0_refs);
        listXsize[0] = min(listXsize[0], input->B_List0_refs);  
      }
      if (input->B_List1_refs)
      {
        
        img->num_ref_idx_l1_active = min(img->num_ref_idx_l1_active, input->B_List1_refs);
        listXsize[1] = min(listXsize[1], input->B_List1_refs);  
      }
    }
  } 


  //if (img->MbaffFrameFlag)
  if (img->structure==FRAME)
    init_mbaff_lists();

  if (img->type != I_SLICE && (input->WeightedPrediction == 1 || (input->WeightedBiprediction > 0 && (img->type == B_SLICE))))
  {
  	if (img->type==P_SLICE || img->type==SP_SLICE)
       estimate_weighting_factor_P_slice ();
    else
       estimate_weighting_factor_B_slice ();
  }

  
  RandomIntraNewPicture ();     //! Allocates forced INTRA MBs (even for fields!)

  // The slice_group_change_cycle can be changed here.
  // FmoInit() is called before coding each picture, frame or field
  img->slice_group_change_cycle=1;
  FmoInit(img, active_pps, active_sps);
	
  FmoStartPicture ();           //! picture level initialization of FMO

  while (NumberOfCodedMBs < img->total_number_mb)       // loop over slices
  {
    // Encode one SLice Group
    while (!FmoSliceGroupCompletelyCoded (SliceGroup))
    {
      // Encode the current slice
      NumberOfCodedMBs += encode_one_slice (SliceGroup, pic);
      FmoSetLastMacroblockInSlice (img->current_mb_nr);
      // Proceed to next slice
      img->current_slice_nr++;
      stat->bit_slice = 0;
    }
    // Proceed to next SliceGroup
    SliceGroup++;
  }
  FmoEndPicture ();

  if (input->rdopt == 2 && (img->type != B_SLICE))
    for (j = 0; j < input->NoOfDecoders; j++)
      DeblockFrame (img, decs->decY_best[j], NULL);

  DeblockFrame (img, enc_picture->imgY, enc_picture->imgUV);

  if (img->MbaffFrameFlag)
    MbAffPostProc();

}



/*!
 ************************************************************************
 * \brief
 *    Encodes one frame
 ************************************************************************
 */
int encode_one_frame ()
{
  static int prev_frame_no = 0; // POC200301
  static int consecutive_non_reference_pictures = 0; // POC200301

#ifdef _LEAKYBUCKET_
  extern long Bit_Buffer[10000];
  extern unsigned long total_frame_buffer;
#endif

  time_t ltime1;
  time_t ltime2;

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

  int tmp_time;
  int bits_frm = 0, bits_fld = 0;
  float dis_frm = 0, dis_frm_y = 0, dis_frm_u = 0, dis_frm_v = 0;
  float dis_fld = 0, dis_fld_y = 0, dis_fld_u = 0, dis_fld_v = 0;

  //Rate control
  int pic_type, bits = 0; 

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

  //Rate control 
  img->write_macroblock = 0;
/*
  //Shankar Regunathan (Oct 2002)
  //Prepare Panscanrect SEI payload
  UpdatePanScanRectInfo ();
  //Prepare Arbitrarydata SEI Payload
  UpdateUser_data_unregistered ();
  //Prepare Registered data SEI Payload
  UpdateUser_data_registered_itu_t_t35 ();
  //Prepare RandomAccess SEI Payload
  UpdateRandomAccess ();
*/

  put_buffer_frame ();      // sets the pointers to the frame structures 
                            // (and not to one of the field structures)
  init_frame ();
  FrameNumberInFile = CalculateFrameNumber();

  srcframe = AllocSourceframe (img->width, img->height);
  ReadOneFrame (FrameNumberInFile, input->infile_header, img->width, img->height, srcframe);
  CopyFrameToOldImgOrgVariables (srcframe);

  // Set parameters for directmode and Deblocking filter
  img->direct_type     = input->direct_type;
  img->LFDisableIdc    = input->LFDisableIdc;
  img->LFAlphaC0Offset = input->LFAlphaC0Offset;
  img->LFBetaOffset    = input->LFBetaOffset;

  if (img->type == B_SLICE)
    Bframe_ctr++;         // Bframe_ctr only used for statistics, should go to stat->

  if (input->PicInterlace == FIELD_CODING)
  {
    //Rate control
    img->FieldControl=1;

    img->field_picture = 1;  // we encode fields
    field_picture (top_pic, bottom_pic);
    img->fld_flag = 1;
  }
  else
  {
    //Rate control
    img->FieldControl=0;

    // For frame coding, turn MB level field/frame coding flag on
    if (input->MbInterlace)
      mb_adaptive = 1;

    img->field_picture = 0; // we encode a frame

    //Rate control
    if(input->RCEnable)
    { 
    /*update the number of MBs in the basic unit for MB adaptive 
      f/f coding*/
      if((input->MbInterlace)&&(input->basicunit<img->Frame_Total_Number_MB)\
        &&(img->type==P_SLICE)&&(img->IFLAG==0))
        img->BasicUnit=input->basicunit*2;
      else
        img->BasicUnit=input->basicunit;
      
      rc_init_pict(1,0,1); 
      img->qp  = updateQuantizationParameter(0); 
      
      
      pic_type = img->type;
      QP =0;
    }

    if( active_sps->frame_mbs_only_flag)
      img->TopFieldFlag=0;

    frame_picture (frame_pic);
   
    // For field coding, turn MB level field/frame coding flag off
    if (input->MbInterlace)
      mb_adaptive = 0;
    
    if (input->PicInterlace == ADAPTIVE_CODING)
    {
      //Rate control
      img->FieldControl=1;
      img->write_macroblock = 0;
      img->bot_MB = 0;

      img->field_picture = 1;  // we encode fields
      field_picture (top_pic, bottom_pic);
      
      //! Note: the distortion for a field coded picture is stored in the top field
      //! the distortion values in the bottom field are dummies
      dis_fld = top_pic->distortion_y + top_pic->distortion_u + top_pic->distortion_v;
      dis_frm = frame_pic->distortion_y + frame_pic->distortion_u + frame_pic->distortion_v;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
制服丝袜亚洲播放| 亚洲宅男天堂在线观看无病毒| 中文字幕在线观看不卡| 性感美女久久精品| 成人久久久精品乱码一区二区三区| 色综合欧美在线| 精品播放一区二区| 日韩中文字幕1| 色综合夜色一区| 国产精品色哟哟| 国产美女精品一区二区三区| 91精品国产综合久久精品性色| 成人欧美一区二区三区在线播放| 国产露脸91国语对白| 日韩欧美不卡在线观看视频| 亚洲图片欧美色图| 91国偷自产一区二区三区成为亚洲经典 | 国产精品18久久久久久久网站| 欧美伊人久久久久久久久影院| 国产精品久久久久久久久久久免费看 | 69成人精品免费视频| 亚洲六月丁香色婷婷综合久久| 成人一区在线观看| 国产亚洲婷婷免费| 国产乱人伦精品一区二区在线观看| 欧美一区二区三区色| 亚洲大片一区二区三区| 欧美亚男人的天堂| 亚洲mv在线观看| 欧美日韩中文字幕一区| 亚洲国产精品欧美一二99| 在线看一区二区| 一区二区三区在线免费视频| 91黄色激情网站| 亚洲最新视频在线观看| 欧洲生活片亚洲生活在线观看| 亚洲激情在线激情| 欧美日韩免费不卡视频一区二区三区| 一区二区三区精品在线| 波多野结衣精品在线| 自拍偷拍亚洲综合| 色天天综合色天天久久| 一区二区三区91| 欧美日本在线观看| 久久精品国产一区二区| 精品1区2区在线观看| 精品一区二区三区欧美| 欧美国产一区视频在线观看| 99精品视频免费在线观看| 一区二区三区四区精品在线视频| 欧美日韩激情一区| 国内精品视频一区二区三区八戒| 国产区在线观看成人精品 | 7777精品伊人久久久大香线蕉超级流畅 | 亚洲一区二区在线播放相泽| 欧美精品一卡二卡| 精品一区二区三区不卡| 国产精品丝袜久久久久久app| a美女胸又www黄视频久久| 亚洲精品一二三区| 日韩欧美视频在线 | 久久国产麻豆精品| 国产精品久久毛片| 欧美日韩成人在线| 成人三级在线视频| 亚洲国产精品麻豆| 国产亚洲欧美一级| 欧美日韩五月天| 成人免费视频app| 天堂久久一区二区三区| 中文字幕精品综合| 6080日韩午夜伦伦午夜伦| 成人午夜av在线| 美女www一区二区| 亚洲精品综合在线| 国产午夜精品久久久久久免费视 | 不卡av免费在线观看| 午夜视频在线观看一区| 中文字幕的久久| 91精品国产91综合久久蜜臀| av综合在线播放| 国产一区二区在线免费观看| 午夜成人免费视频| 亚洲欧美另类小说| 久久久久久亚洲综合影院红桃| 欧美日韩精品一区二区| 色偷偷成人一区二区三区91| 免费在线观看日韩欧美| 一区二区三区四区国产精品| 亚洲国产电影在线观看| 日韩视频一区二区三区在线播放 | 亚洲乱码国产乱码精品精的特点| 久久综合丝袜日本网| 91精品国产综合久久久久久久 | 亚洲综合在线第一页| 中文字幕 久热精品 视频在线 | 黑人精品欧美一区二区蜜桃| 天天综合天天综合色| 一区二区久久久久久| 中文字幕中文字幕一区| 中文字幕国产精品一区二区| 久久免费国产精品| 久久久美女毛片| 久久一日本道色综合| 精品国产乱码久久久久久1区2区| 欧美美女黄视频| 欧美日韩激情一区二区| 欧美日韩一区二区三区四区| 精品视频1区2区| 欧美日韩精品欧美日韩精品一综合| 色婷婷久久久亚洲一区二区三区 | 亚洲男人都懂的| 亚洲欧美日韩中文字幕一区二区三区 | 日韩av电影天堂| 日本网站在线观看一区二区三区| 天天免费综合色| 久久不见久久见中文字幕免费| 免费看欧美美女黄的网站| 麻豆精品一区二区av白丝在线| 蜜臀av亚洲一区中文字幕| 蜜桃视频免费观看一区| 精品一区二区国语对白| 国内久久精品视频| 成人免费毛片aaaaa**| 91小视频在线| 91精品在线一区二区| 欧美精品三级在线观看| 精品欧美乱码久久久久久| 2020国产精品自拍| 中文字幕一区二区三| 亚洲一区二区影院| 日韩av中文字幕一区二区| 极品少妇xxxx偷拍精品少妇| 成人污污视频在线观看| 欧美亚洲国产一区二区三区| 91麻豆精品国产91久久久久久| 精品欧美乱码久久久久久1区2区| 国产农村妇女精品| 亚洲综合久久久久| 久久99精品久久久久久| av成人动漫在线观看| 欧美日韩卡一卡二| 国产欧美精品日韩区二区麻豆天美| 亚洲美女免费视频| 免费在线看一区| 99久久久免费精品国产一区二区| 欧美日韩黄视频| 国产欧美精品国产国产专区 | 国产乱子轮精品视频| 波波电影院一区二区三区| 欧美日韩一级片网站| 国产午夜精品理论片a级大结局| 亚洲精品ww久久久久久p站 | 偷拍亚洲欧洲综合| 丰满岳乱妇一区二区三区| 欧美日韩大陆在线| 中文字幕精品三区| 麻豆一区二区三| 91一区二区在线观看| 欧美本精品男人aⅴ天堂| 亚洲精品免费在线| 国产99精品在线观看| 91精选在线观看| 亚洲夂夂婷婷色拍ww47| 成人精品一区二区三区四区| 日韩精品一区二区三区三区免费| 亚洲欧洲日韩av| 国产传媒日韩欧美成人| 91精品婷婷国产综合久久| 亚洲日本va午夜在线影院| 国产成人在线看| 精品久久久久久久一区二区蜜臀| 一区二区三区在线观看视频| 成人黄色大片在线观看| 亚洲精品在线免费观看视频| 午夜激情综合网| 在线视频一区二区三| 综合激情网...| 成人av免费在线观看| 国产人久久人人人人爽| 另类人妖一区二区av| 欧美日韩你懂的| 亚洲电影中文字幕在线观看| 色先锋aa成人| 亚洲黄色尤物视频| 欧洲一区在线电影| 一区二区三区中文字幕精品精品 | 激情深爱一区二区| 日韩一级片在线观看| 亚洲h在线观看| 欧美日韩成人综合| 天天操天天干天天综合网| 欧美色图在线观看| 一区二区三区加勒比av| 色婷婷综合久久久中文字幕| 亚洲免费电影在线| 欧美中文字幕一区二区三区| 亚洲最大的成人av| 欧美日韩三级一区| 免费观看一级特黄欧美大片|