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

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

?? output.c

?? 一個簡單的視頻會議VC++MFC工程文件
?? C
字號:

/*!
 ************************************************************************
 * \file output.c
 *
 * \brief
 *    Output an image and Trance support
 *
 * \author
 *    Main contributors (see contributors.h for copyright, address and affiliation details)
 *    - Karsten Suehring               <suehring@hhi.de>
 ************************************************************************
 */

#include "contributors.h"

#include <stdlib.h>
#include <assert.h>
#include <string.h>

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

FrameStore* out_buffer;

StorablePicture *pending_output = NULL;
int              pending_output_state = FRAME;


void write_out_picture(StorablePicture *p, FILE *p_out);

#ifdef PAIR_FIELDS_IN_OUTPUT

void clear_picture(StorablePicture *p);

/*!
 ************************************************************************
 * \brief
 *    output the pending frame buffer
 * \param p_out
 *    Output file
 ************************************************************************
 */
void flush_pending_output(FILE *p_out)
{
  if (pending_output_state!=FRAME)
  {
    write_out_picture(pending_output, p_out);
  }
  
  if (pending_output->imgY)
  {
    free_mem2D (pending_output->imgY);
    pending_output->imgY=NULL;
  }
  if (pending_output->imgUV)
  {
    free_mem3D (pending_output->imgUV, 2);
    pending_output->imgUV=NULL;
  }

  pending_output_state = FRAME;
}


/*!
 ************************************************************************
 * \brief
 *    Writes out a storable picture 
 *    If the picture is a field, the output buffers the picture and tries 
 *    to pair it with the next field.
 * \param p
 *    Picture to be written
 * \param p_out
 *    Output file
 ************************************************************************
 */
void write_picture(StorablePicture *p, FILE *p_out, int real_structure)
{
   int i, add;

  if (real_structure==FRAME)
  {
    flush_pending_output(p_out);
    write_out_picture(p, p_out);
    return;
  }
  if (real_structure==pending_output_state)
  {
    flush_pending_output(p_out);
    write_picture(p, p_out, real_structure);
    return;
  }

  if (pending_output_state == FRAME)
  {
    pending_output->size_x = p->size_x;
    pending_output->size_y = p->size_y;
    pending_output->size_x_cr = p->size_x_cr;
    pending_output->size_y_cr = p->size_y_cr;


    pending_output->frame_mbs_only_flag = p->frame_mbs_only_flag;
    pending_output->frame_cropping_flag = p->frame_cropping_flag;
    if (pending_output->frame_cropping_flag)
    {
      pending_output->frame_cropping_rect_left_offset = p->frame_cropping_rect_left_offset;
      pending_output->frame_cropping_rect_right_offset = p->frame_cropping_rect_right_offset;
      pending_output->frame_cropping_rect_top_offset = p->frame_cropping_rect_top_offset;
      pending_output->frame_cropping_rect_bottom_offset = p->frame_cropping_rect_bottom_offset;
    }

    get_mem2D (&(pending_output->imgY), pending_output->size_y, pending_output->size_x);
    get_mem3D (&(pending_output->imgUV), 2, pending_output->size_y_cr, pending_output->size_x_cr );

    clear_picture(pending_output);

    // copy first field
    if (real_structure == TOP_FIELD)
    {
      add = 0;
    }
    else
    {
      add = 1;
    }

    for (i=0; i<pending_output->size_y; i+=2)
    {
      memcpy(pending_output->imgY[(i+add)], p->imgY[(i+add)], p->size_x);
    }
    for (i=0; i<pending_output->size_y_cr; i+=2)
    {
      memcpy(pending_output->imgUV[0][(i+add)], p->imgUV[0][(i+add)], p->size_x_cr);
      memcpy(pending_output->imgUV[1][(i+add)], p->imgUV[1][(i+add)], p->size_x_cr);
    }
    pending_output_state = real_structure;
  }
  else
  {
    if (  (pending_output->size_x!=p->size_x) || (pending_output->size_y!= p->size_y) 
       || (pending_output->frame_mbs_only_flag != p->frame_mbs_only_flag)
       || (pending_output->frame_cropping_flag != p->frame_cropping_flag)
       || ( pending_output->frame_cropping_flag &&
            (  (pending_output->frame_cropping_rect_left_offset   != p->frame_cropping_rect_left_offset)
             ||(pending_output->frame_cropping_rect_right_offset  != p->frame_cropping_rect_right_offset)
             ||(pending_output->frame_cropping_rect_top_offset    != p->frame_cropping_rect_top_offset)
             ||(pending_output->frame_cropping_rect_bottom_offset != p->frame_cropping_rect_bottom_offset)
            )
          )
       )
    {
      flush_pending_output(p_out);
      write_picture (p, p_out, real_structure);
      return;
    }
    // copy second field
    if (real_structure == TOP_FIELD)
    {
      add = 0;
    }
    else
    {
      add = 1;
    }

    for (i=0; i<pending_output->size_y; i+=2)
    {
      memcpy(pending_output->imgY[(i+add)], p->imgY[(i+add)], p->size_x);
    }
    for (i=0; i<pending_output->size_y_cr; i+=2)
    {
      memcpy(pending_output->imgUV[0][(i+add)], p->imgUV[0][(i+add)], p->size_x_cr);
      memcpy(pending_output->imgUV[1][(i+add)], p->imgUV[1][(i+add)], p->size_x_cr);
    }

    flush_pending_output(p_out);
  }
}

#else

/*!
 ************************************************************************
 * \brief
 *    Writes out a storable picture without doing any output modifications
 * \param p
 *    Picture to be written
 * \param p_out
 *    Output file
 ************************************************************************
 */
void write_picture(StorablePicture *p, FILE *p_out, int real_structure)
{
  write_out_picture(p, p_out);
}


#endif

/*!
 ************************************************************************
 * \brief
 *    Writes out a storable picture
 * \param p
 *    Picture to be written
 * \param p_out
 *    Output file
 ************************************************************************
 */
void write_out_picture(StorablePicture *p, FILE *p_out)
{
  int i,j;

  int crop_left, crop_right, crop_top, crop_bottom;
  int crop_vert_mult;
  
  if (p->non_existing)
    return;

  if (p->frame_mbs_only_flag)
  {
    crop_vert_mult = 2;
  }
  else
  {
    if (p->structure != FRAME)
    {
      crop_vert_mult = 2;
    }
    else
    {
      crop_vert_mult = 4;
    }
  }

  if (p->frame_cropping_flag)
  {
    crop_left   = 2 * p->frame_cropping_rect_left_offset;
    crop_right  = 2 * p->frame_cropping_rect_right_offset;
    crop_top    = crop_vert_mult * p->frame_cropping_rect_top_offset;
    crop_bottom = crop_vert_mult * p->frame_cropping_rect_bottom_offset;
  }
  else
  {
    crop_left = crop_right = crop_top = crop_bottom = 0;
  }

  //printf ("write frame size: %dx%d\n", p->size_x-crop_left-crop_right,p->size_y-crop_top-crop_bottom );
  
  for(i=crop_top;i<p->size_y-crop_bottom;i++)
    for(j=crop_left;j<p->size_x-crop_right;j++)
    {
      fputc(p->imgY[i][j],p_out);
    }

  crop_left   /= 2;
  crop_right  /= 2;
  crop_top    /= 2;
  crop_bottom /= 2;

  for(i=crop_top;i<p->size_y_cr-crop_bottom;i++)
    for(j=crop_left;j<p->size_x_cr-crop_right;j++)
    {
      fputc(p->imgUV[0][i][j],p_out);
    }
  for(i=crop_top;i<p->size_y_cr-crop_bottom;i++)
    for(j=crop_left;j<p->size_x_cr-crop_right;j++)
    {
      fputc(p->imgUV[1][i][j],p_out);
    }
    
  fflush(p_out);
}

/*!
 ************************************************************************
 * \brief
 *    Initialize output buffer for direct output
 ************************************************************************
 */
void init_out_buffer()
{
  out_buffer = alloc_frame_store();
  pending_output = calloc (sizeof(StorablePicture), 1);
  if (NULL==pending_output) no_mem_exit("init_out_buffer");
  pending_output->imgUV = NULL;
  pending_output->imgY  = NULL;
}

/*!
 ************************************************************************
 * \brief
 *    Uninitialize output buffer for direct output
 ************************************************************************
 */
void uninit_out_buffer()
{
  free_frame_store(out_buffer);
  out_buffer=NULL;
#ifdef PAIR_FIELDS_IN_OUTPUT
  flush_pending_output(p_out);
#endif
  free (pending_output);
}

/*!
 ************************************************************************
 * \brief
 *    Initialize picture memory with (Y:0,U:128,V:128)
 ************************************************************************
 */
void clear_picture(StorablePicture *p)
{
  int i;

  for(i=0;i<p->size_y;i++)
    memset(p->imgY[i], 128 ,p->size_x);
  for(i=0;i<p->size_y_cr;i++)
    memset(p->imgUV[0][i], 128 ,p->size_x_cr);
  for(i=0;i<p->size_y_cr;i++)
    memset(p->imgUV[1][i], 128 ,p->size_x_cr);
  fflush(p_out);
}

/*!
 ************************************************************************
 * \brief
 *    Write out not paired direct output fields. A second empty field is generated
 *    and combined into the frame buffer.
 * \param fs
 *    FrameStore that contains a single field
 * \param p_out
 *    Output file
 ************************************************************************
 */
void write_unpaired_field(FrameStore* fs, FILE *p_out)
{
  StorablePicture *p;
  assert (fs->is_used<3);
  if(fs->is_used &1)
  {
    // we have a top field
    // construct an empty bottom field
    p = fs->top_field;
    fs->bottom_field = alloc_storable_picture(BOTTOM_FIELD, p->size_x, 2*p->size_y, p->size_x_cr, 2*p->size_y_cr);
    clear_picture(fs->bottom_field);
    dpb_combine_field(fs);
    write_picture (fs->frame, p_out, TOP_FIELD);
  }

  if(fs->is_used &2)
  {
    // we have a bottom field
    // construct an empty top field
    p = fs->bottom_field;
    fs->top_field = alloc_storable_picture(TOP_FIELD, p->size_x, 2*p->size_y, p->size_x_cr, 2*p->size_y_cr);
    clear_picture(fs->top_field);
    fs ->top_field->frame_cropping_flag = fs->bottom_field->frame_cropping_flag;
    if(fs ->top_field->frame_cropping_flag) 
    {
      fs ->top_field->frame_cropping_rect_top_offset = fs->bottom_field->frame_cropping_rect_top_offset;
      fs ->top_field->frame_cropping_rect_bottom_offset = fs->bottom_field->frame_cropping_rect_bottom_offset;
      fs ->top_field->frame_cropping_rect_left_offset = fs->bottom_field->frame_cropping_rect_left_offset;
      fs ->top_field->frame_cropping_rect_right_offset = fs->bottom_field->frame_cropping_rect_right_offset;
    }
    dpb_combine_field(fs);
    write_picture (fs->frame, p_out, BOTTOM_FIELD);
  }

  fs->is_used=3;
}

/*!
 ************************************************************************
 * \brief
 *    Write out unpaired fields from output buffer.
 * \param p_out
 *    Output file
 ************************************************************************
 */
void flush_direct_output(FILE *p_out)
{
  write_unpaired_field(out_buffer, p_out);

  free_storable_picture(out_buffer->frame);
  out_buffer->frame = NULL;
  free_storable_picture(out_buffer->top_field);
  out_buffer->top_field = NULL;
  free_storable_picture(out_buffer->bottom_field);
  out_buffer->bottom_field = NULL;
  out_buffer->is_used = 0;
}


/*!
 ************************************************************************
 * \brief
 *    Write a frame (from FrameStore)
 * \param fs
 *    FrameStore containing the frame
 * \param p_out
 *    Output file
 ************************************************************************
 */
void write_stored_frame( FrameStore *fs,FILE *p_out)
{
  // make sure no direct output field is pending
  flush_direct_output(p_out);

  if (fs->is_used<3)
  {
    write_unpaired_field(fs, p_out);
  }
  else
  {
    write_picture(fs->frame, p_out, FRAME);
  }

  fs->is_output = 1;
}

/*!
 ************************************************************************
 * \brief
 *    Directly output a picture without storing it in the DPB. Fields 
 *    are buffered before they are written to the file.
 * \param p
 *    Picture for output
 * \param p_out
 *    Output file
 ************************************************************************
 */
void direct_output(StorablePicture *p, FILE *p_out)
{
  if (p->structure==FRAME)
  {
    // we have a frame (or complementary field pair)
    // so output it directly
    flush_direct_output(p_out);
    write_picture (p, p_out, FRAME);
    if (p_ref)
      find_snr(snr, p, p_ref);
    free_storable_picture(p);
    return;
  }

  if (p->structure == TOP_FIELD)
  {
    if (out_buffer->is_used &1)
      flush_direct_output(p_out);
    out_buffer->top_field = p;
    out_buffer->is_used |= 1;
  }

  if (p->structure == BOTTOM_FIELD)
  {
    if (out_buffer->is_used &2)
      flush_direct_output(p_out);
    out_buffer->bottom_field = p;
    out_buffer->is_used |= 2;
  }

  if (out_buffer->is_used == 3)
  {
    // we have both fields, so output them
    dpb_combine_field(out_buffer);
    write_picture (out_buffer->frame, p_out, FRAME);
    if (p_ref)
      find_snr(snr, out_buffer->frame, p_ref);
    free_storable_picture(out_buffer->frame);
    out_buffer->frame = NULL;
    free_storable_picture(out_buffer->top_field);
    out_buffer->top_field = NULL;
    free_storable_picture(out_buffer->bottom_field);
    out_buffer->bottom_field = NULL;
    out_buffer->is_used = 0;
  }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品日产第一区二区三区高清版 | 国产丝袜美腿一区二区三区| 中文字幕第一区第二区| 午夜电影久久久| 成人爱爱电影网址| 日韩欧美国产一区在线观看| 亚洲视频在线一区| 风间由美性色一区二区三区| 欧美一区二区三区系列电影| 亚洲色图都市小说| 国产高清亚洲一区| 精品久久久久一区二区国产| 亚洲成人你懂的| www.亚洲免费av| 久久久一区二区| 久久99精品国产91久久来源| 在线免费观看成人短视频| 久久精品亚洲精品国产欧美kt∨| 视频一区在线播放| 欧美视频自拍偷拍| 一区二区三区在线视频免费| www.激情成人| 中文字幕巨乱亚洲| 国内一区二区视频| 欧美大尺度电影在线| 亚洲电影在线免费观看| 欧美伊人久久大香线蕉综合69| 亚洲欧洲日韩av| 成人免费黄色在线| 国产片一区二区| 国产a久久麻豆| 亚洲国产精品av| 国产高清精品久久久久| 久久久久国产精品麻豆| 国模套图日韩精品一区二区| 欧美va亚洲va国产综合| 日韩黄色小视频| 91精品黄色片免费大全| 日韩精品1区2区3区| 日韩色在线观看| 蜜臀精品一区二区三区在线观看| 制服丝袜中文字幕亚洲| 蜜桃av一区二区| 久久嫩草精品久久久久| 国产精品一区二区三区四区| 国产亚洲一区二区三区在线观看| 国产精品99久久久| 中文字幕一区不卡| 欧美亚洲综合另类| 日韩电影在线一区| 欧美电影免费提供在线观看| 狠狠色丁香久久婷婷综合_中| 久久五月婷婷丁香社区| 国产成人精品在线看| 国产精品久久久久久久久动漫| 99久久精品免费| 一区二区在线看| 777亚洲妇女| 国产裸体歌舞团一区二区| 国产欧美精品一区二区三区四区| 国产激情一区二区三区| 亚洲欧美国产77777| 欧美美女网站色| 国产毛片精品视频| 亚洲综合成人在线| 久久人人超碰精品| 色呦呦国产精品| 久久精品99久久久| 国产精品全国免费观看高清| 91极品美女在线| 日本成人在线一区| 中文字幕一区免费在线观看| 欧美色综合影院| 国产.精品.日韩.另类.中文.在线.播放| 国产精品国产a| 91麻豆精品国产| 99久久精品一区| 麻豆91小视频| 亚洲黄色av一区| www日韩大片| 欧美蜜桃一区二区三区| 国产成人午夜精品影院观看视频 | 成人毛片在线观看| 午夜久久久影院| 国产精品入口麻豆九色| 日韩午夜在线观看视频| 91麻豆免费看片| 韩国欧美一区二区| 日日夜夜精品视频免费| 亚洲色图19p| 国产精品日产欧美久久久久| 日韩欧美你懂的| 欧美午夜精品一区二区三区| 夫妻av一区二区| 国产精品456| 久久99精品网久久| 男人操女人的视频在线观看欧美| 亚洲三级在线免费观看| 久久久电影一区二区三区| 91精品国产91久久久久久一区二区| jlzzjlzz亚洲女人18| 国内国产精品久久| 蜜臀av亚洲一区中文字幕| 亚洲成人免费在线观看| 一区二区三区中文免费| 亚洲国产高清在线观看视频| 精品久久久久一区| 日韩精品一区二区三区在线 | 国产九色sp调教91| 六月婷婷色综合| 蜜臀av性久久久久蜜臀aⅴ四虎 | 国产一区二区三区久久久| 欧美aⅴ一区二区三区视频| 天天操天天色综合| 亚洲国产成人tv| 亚洲成年人网站在线观看| 一区二区三区欧美在线观看| 亚洲欧洲国产专区| 中文字幕一区三区| 一区二区三区在线视频观看58| 最新欧美精品一区二区三区| 中文字幕中文在线不卡住| 国产精品高清亚洲| 亚洲美女偷拍久久| 亚洲777理论| 蜜臀av一区二区在线免费观看| 免费av成人在线| 国产成人综合网站| 99精品国产一区二区三区不卡| 色综合天天综合色综合av | 欧美大度的电影原声| 3d动漫精品啪啪1区2区免费| 欧美电影在哪看比较好| 欧美一区二区三区白人| 亚洲精品在线免费观看视频| 中文字幕欧美三区| 一区二区三区成人| 麻豆精品视频在线观看视频| 国产成人精品一区二区三区四区 | 欧美性猛交xxxx乱大交退制版| 欧美色欧美亚洲另类二区| 欧美精品久久一区二区三区| 日韩丝袜情趣美女图片| 国产清纯在线一区二区www| 1区2区3区国产精品| 日韩电影在线免费看| 国产在线一区二区| 成a人片国产精品| 欧美日本一区二区三区四区| 精品国产乱码久久久久久久久 | 亚洲免费资源在线播放| 日韩激情av在线| 成人丝袜高跟foot| 欧美日韩精品一区二区三区蜜桃| 日韩精品一区二区三区老鸭窝| 国产精品国产自产拍高清av王其 | 欧美日本一区二区三区四区| 久久久国产精品不卡| 亚洲一级电影视频| 国产麻豆视频一区二区| 精品视频1区2区3区| 久久久精品黄色| 亚洲国产精品一区二区久久| 国产精品12区| 欧美美女黄视频| 中文字幕一区二区三区乱码在线| 日韩电影在线看| 色拍拍在线精品视频8848| 精品福利一区二区三区免费视频| 亚洲欧美日韩成人高清在线一区| 麻豆视频观看网址久久| 91福利区一区二区三区| 国产日韩精品一区二区三区在线| 亚洲丰满少妇videoshd| www.亚洲精品| 精品国产第一区二区三区观看体验 | 亚洲一二三级电影| 大白屁股一区二区视频| 日韩欧美国产一区二区在线播放| 亚洲欧美日韩中文播放| 成人丝袜视频网| 久久久99精品久久| 日本三级韩国三级欧美三级| 91网站在线播放| 国产精品大尺度| 国产一区二区三区观看| 欧美大胆人体bbbb| 秋霞电影网一区二区| 制服丝袜亚洲精品中文字幕| 一区二区三区免费看视频| www.一区二区| 国产精品成人免费| 国产**成人网毛片九色| 久久蜜臀精品av| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 亚洲综合成人在线视频| 色欧美乱欧美15图片| 亚洲青青青在线视频| 色综合久久88色综合天天6 | 精品动漫一区二区三区在线观看|