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

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

?? image.c

?? 一個(gè)簡(jiǎn)單的視頻會(huì)議VC++MFC工程文件
?? C
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):

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

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级国产精品| 亚洲黄网站在线观看| 精品欧美乱码久久久久久1区2区| 欧美成人猛片aaaaaaa| 亚洲女性喷水在线观看一区| 亚洲第一狼人社区| 99久久精品免费精品国产| 在线综合亚洲欧美在线视频| 亚洲日本丝袜连裤袜办公室| 国产在线视频一区二区三区| 欧美色视频在线观看| 国产精品久久网站| 理论片日本一区| 欧美日韩国产片| 亚洲国产精品v| 美女高潮久久久| 欧美性大战久久| 久久久99精品久久| 日韩综合在线视频| 色妹子一区二区| 国产精品麻豆一区二区 | 韩国成人福利片在线播放| 欧美三级日本三级少妇99| 综合色天天鬼久久鬼色| 国产福利一区二区三区在线视频| 日韩天堂在线观看| 亚洲精品免费播放| 91免费版pro下载短视频| 国产丝袜欧美中文另类| 一区二区三区欧美在线观看| 国产精品一区二区在线观看网站| 欧美一级日韩不卡播放免费| 午夜欧美一区二区三区在线播放| 99精品久久免费看蜜臀剧情介绍| 中文字幕精品三区| 成人高清在线视频| 日韩亚洲欧美在线| 久久99精品久久久久| 欧美高清dvd| 狠狠色综合日日| 欧美成人高清电影在线| 免费在线看成人av| 日韩丝袜情趣美女图片| 国内精品不卡在线| 国产三级精品视频| 成人免费高清视频| 国产精品不卡一区| 欧美最新大片在线看| 亚洲成人精品一区| 日韩欧美综合在线| 国产精品456露脸| 国产精品传媒入口麻豆| 91猫先生在线| 午夜精品久久久久久久99水蜜桃| 69久久夜色精品国产69蝌蚪网| 免费人成精品欧美精品| 久久久久久久免费视频了| av一区二区三区在线| 亚洲一区二区三区激情| 欧美一区二区三区免费视频| 国产成人亚洲综合色影视| 亚洲色图在线播放| 日韩午夜在线观看| 国产69精品久久99不卡| 亚洲一区二区不卡免费| 欧美精品一区二区三区久久久| 成人国产精品免费观看| 五月天欧美精品| 国产日韩欧美综合一区| 在线视频一区二区免费| 韩国毛片一区二区三区| 成人免费小视频| 日韩欧美另类在线| 色婷婷精品久久二区二区蜜臂av| 免费黄网站欧美| 亚洲免费观看高清完整版在线观看| 中文一区二区完整视频在线观看 | 日本一区二区三级电影在线观看 | 在线免费观看视频一区| 国内精品视频666| 一卡二卡三卡日韩欧美| 久久亚洲一级片| 在线观看一区二区视频| 激情久久五月天| 亚洲aⅴ怡春院| 中文字幕免费不卡在线| 欧美刺激午夜性久久久久久久| 91在线一区二区| 国产精品一品二品| 日韩二区三区四区| 亚洲天堂福利av| 国产欧美一区二区精品婷婷 | 国产在线精品一区在线观看麻豆| 亚洲图片一区二区| 欧美经典三级视频一区二区三区| 在线免费观看日韩欧美| av一区二区久久| 粉嫩av亚洲一区二区图片| 伦理电影国产精品| 日日嗨av一区二区三区四区| 亚洲国产精品天堂| 亚洲精选一二三| 国产精品灌醉下药二区| 久久精品在线免费观看| 日韩欧美亚洲另类制服综合在线| 欧美色爱综合网| 一本一道综合狠狠老| 99麻豆久久久国产精品免费优播| 国产精品一区在线观看乱码| 九色综合国产一区二区三区| 天堂精品中文字幕在线| 午夜日韩在线观看| 午夜精品久久久久久久| 亚洲图片欧美综合| 亚洲综合精品久久| 亚洲理论在线观看| 亚洲精选一二三| 亚洲黄色片在线观看| 亚洲天堂久久久久久久| 综合欧美亚洲日本| 国产精品狼人久久影院观看方式| 久久美女高清视频| 欧美激情一区二区三区不卡 | 日韩一区二区在线看片| 欧美高清你懂得| 日韩欧美123| 久久亚洲私人国产精品va媚药| 久久久99精品免费观看不卡| 国产精品免费免费| 亚洲欧美精品午睡沙发| 亚洲一区二区三区在线看| 久久国产欧美日韩精品| 精品一区二区免费看| 国产激情精品久久久第一区二区 | 国产精品妹子av| 亚洲美女偷拍久久| 亚洲成精国产精品女| 蜜臀av性久久久久蜜臀aⅴ四虎| 久久国产精品无码网站| 国产白丝精品91爽爽久久| 91丝袜国产在线播放| 欧美日韩在线播放三区四区| 精品久久久久久久久久久院品网 | 国产自产高清不卡| 不卡一区二区在线| 欧美视频中文字幕| 2023国产一二三区日本精品2022| 国产精品女主播av| 视频一区二区三区在线| 国产不卡视频一区二区三区| 91免费看`日韩一区二区| 欧美一区二区二区| 日韩美女视频在线| 国产三级精品三级| 偷拍一区二区三区四区| 国产精品嫩草影院av蜜臀| 午夜国产不卡在线观看视频| 国产麻豆精品久久一二三| 91成人网在线| 久久久久久久久久久久久久久99 | 一区二区三区日韩精品视频| 蜜桃av噜噜一区二区三区小说| 亚洲男人的天堂av| 国产亚洲欧美日韩在线一区| 欧美日韩不卡一区| 精品国产精品网麻豆系列 | 国产成人高清视频| 欧美剧在线免费观看网站 | 欧美日本在线一区| 久久久久综合网| 日韩一区精品视频| 91福利精品视频| 国产欧美日韩亚州综合| 青青草一区二区三区| 色网站国产精品| 中文字幕av资源一区| 久久综合综合久久综合| 欧美视频在线观看一区二区| 欧美激情中文不卡| 国产一本一道久久香蕉| 91精品国产综合久久精品| 亚洲尤物视频在线| 成人av网站大全| 久久一区二区三区四区| 免费成人美女在线观看| 欧美日韩国产大片| 亚洲色欲色欲www在线观看| 国产主播一区二区| 欧美xxxxxxxx| 美女尤物国产一区| 欧美日韩一二三区| 一区二区三区精品| 色婷婷亚洲精品| 亚洲免费在线看| 91视频免费播放| 亚洲日穴在线视频| 91在线精品一区二区| 亚洲天堂网中文字| 色综合视频在线观看| 亚洲免费av网站|