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

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

?? output.c

?? h.264 jm90 代碼,包括了所有的編解碼程序
?? 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>

#ifdef WIN32
#include <io.h>
#else
#include <unistd.h>
#endif

#include "global.h"
#include "image.h"

void write_out_picture(StorablePicture *p, int p_out);

FrameStore* out_buffer;


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

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

  int crop_left, crop_right, crop_top, crop_bottom;
  int crop_vert_mult;
  int symbol_size_in_bytes = img->pic_unit_size_on_disk/8;
  Boolean rgb_output = (input->rgb_input_flag && input->yuv_format==3);
  char *buf;

  if (p->non_existing)
    return;

  if (active_sps->frame_mbs_only_flag)
  {
    crop_vert_mult = 2;
  }
  else
  {
    if (p->structure != FRAME)
    {
      crop_vert_mult = 2;
    }
    else
    {
      crop_vert_mult = 4;
    }
    }
  
  if (active_sps->frame_cropping_flag)
  {
    crop_left   = 2 * active_sps->frame_cropping_rect_left_offset;
    crop_right  = 2 * active_sps->frame_cropping_rect_right_offset;
    crop_top    = crop_vert_mult * active_sps->frame_cropping_rect_top_offset;
    crop_bottom = crop_vert_mult * active_sps->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 );
  
  // KS: this buffer should actually be allocated only once, but this is still much faster than the previous version
  buf = malloc (p->size_x*p->size_y*symbol_size_in_bytes);
  if (NULL==buf)
  {
    no_mem_exit("write_out_picture: buf");
  }

  if(rgb_output)
  {
    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++)
      {
        memcpy(buf+((j-crop_left+(i-crop_top)*(p->size_x_cr-crop_left-crop_right))*symbol_size_in_bytes),&(p->imgUV[1][i][j]), symbol_size_in_bytes);
      }
    write(p_out, buf, (p->size_y_cr-crop_bottom-crop_top)*(p->size_x_cr-crop_right-crop_left)*symbol_size_in_bytes);

    if (active_sps->frame_cropping_flag)
    {
      crop_left   = 2 * active_sps->frame_cropping_rect_left_offset;
      crop_right  = 2 * active_sps->frame_cropping_rect_right_offset;
      crop_top    = crop_vert_mult * active_sps->frame_cropping_rect_top_offset;
      crop_bottom = crop_vert_mult * active_sps->frame_cropping_rect_bottom_offset;
    }
    else
    {
      crop_left = crop_right = crop_top = crop_bottom = 0;
    }
  }
  
  
  for(i=crop_top;i<p->size_y-crop_bottom;i++)
    for(j=crop_left;j<p->size_x-crop_right;j++)
    {
      memcpy(buf+((j-crop_left+((i-crop_top)*(p->size_x-crop_left-crop_right)))*symbol_size_in_bytes),&(p->imgY[i][j]), symbol_size_in_bytes);
    }

  write(p_out, buf, (p->size_y-crop_bottom-crop_top)*(p->size_x-crop_right-crop_left)*symbol_size_in_bytes);

  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++)
    {
      memcpy(buf+((j-crop_left+(i-crop_top)*(p->size_x_cr-crop_left-crop_right))*symbol_size_in_bytes),&(p->imgUV[0][i][j]), symbol_size_in_bytes);
    }
  write(p_out, buf, (p->size_y_cr-crop_bottom-crop_top)*(p->size_x_cr-crop_right-crop_left)*symbol_size_in_bytes);

  if (!rgb_output)
  {
    for(i=crop_top;i<p->size_y_cr-crop_bottom;i++)
      for(j=crop_left;j<p->size_x_cr-crop_right;j++)
      {
        memcpy(buf+((j-crop_left+(i-crop_top)*(p->size_x_cr-crop_left-crop_right))*symbol_size_in_bytes),&(p->imgUV[1][i][j]), symbol_size_in_bytes);
      }
    write(p_out, buf, (p->size_y_cr-crop_bottom-crop_top)*(p->size_x_cr-crop_right-crop_left)*symbol_size_in_bytes);
    }

  free(buf);
    
//  fsync(p_out);
}

/*!
 ************************************************************************
 * \brief
 *    Initialize output buffer for direct output
 ************************************************************************
 */
void init_out_buffer()
{
  out_buffer = alloc_frame_store();
}

/*!
 ************************************************************************
 * \brief
 *    Uninitialize output buffer for direct output
 ************************************************************************
 */
void uninit_out_buffer()
{
  free_frame_store(out_buffer);
  out_buffer=NULL;
}

/*!
 ************************************************************************
 * \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], img->dc_pred_value, p->size_x*sizeof(imgpel));
  for(i=0;i<p->size_y_cr;i++)
    memset(p->imgUV[0][i], img->dc_pred_value ,p->size_x_cr*sizeof(imgpel));
  for(i=0;i<p->size_y_cr;i++)
    memset(p->imgUV[1][i], img->dc_pred_value ,p->size_x_cr*sizeof(imgpel));
}

/*!
 ************************************************************************
 * \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, int 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, p->size_y, p->size_x_cr, 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, p->size_y, p->size_x_cr, p->size_y_cr);
    clear_picture(fs->top_field);
    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(int 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,int 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, int 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);
    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);
    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一区二区三区免费野_久草精品视频
久久蜜桃av一区二区天堂| 色综合久久天天| 久久久久久久性| 欧美剧情电影在线观看完整版免费励志电影| 成人黄色在线网站| 欧美一区二区福利在线| 亚洲激情五月婷婷| 国产精品亚洲专一区二区三区| 欧美在线影院一区二区| 中文字幕视频一区| 国产精品系列在线播放| 在线播放中文一区| 亚洲欧美韩国综合色| 国产精品一级片在线观看| 欧美一二三区在线观看| 亚洲一区二区视频在线观看| 成人精品高清在线| 国产欧美日韩精品一区| 蜜桃精品视频在线| 日韩一级成人av| 蜜臀av性久久久久av蜜臀妖精| 欧美撒尿777hd撒尿| 一区二区三区四区不卡视频| 风间由美性色一区二区三区| 久久综合资源网| 久久不见久久见免费视频7 | 麻豆精品新av中文字幕| 欧美在线观看视频一区二区| 亚洲免费av高清| 欧美性xxxxx极品少妇| 一区二区三区在线高清| 精品视频999| 日韩电影免费在线| 精品久久一区二区| 国产老女人精品毛片久久| 国产清纯在线一区二区www| 国产精品18久久久久| 精品99999| 丁香六月综合激情| 国产精品女主播av| 欧美性色综合网| 欧美a一区二区| 久久久www成人免费毛片麻豆| 国产一区不卡精品| 国产精品美女久久福利网站| av在线不卡网| 亚洲中国最大av网站| 制服丝袜中文字幕亚洲| 国产福利不卡视频| 国产精品资源网站| 久久综合av免费| 国产精品久久久爽爽爽麻豆色哟哟 | 欧美日韩一级黄| 91网上在线视频| 91久久人澡人人添人人爽欧美| 欧美性一二三区| 欧美大片在线观看一区二区| 7777精品久久久大香线蕉 | 婷婷综合五月天| 日韩一级完整毛片| 不卡视频一二三| 亚洲成av人片一区二区梦乃| 日韩精品在线一区二区| 成人aa视频在线观看| 天堂蜜桃91精品| 国产精品久久久久影院老司 | 久久夜色精品国产欧美乱极品| 99精品国产热久久91蜜凸| 五月天一区二区三区| 久久女同精品一区二区| 色综合久久久久网| 国产美女精品人人做人人爽| 亚洲夂夂婷婷色拍ww47| 久久综合色之久久综合| 欧美日韩卡一卡二| 成人综合日日夜夜| 日韩高清欧美激情| 极品美女销魂一区二区三区| 色欲综合视频天天天| 奇米精品一区二区三区在线观看| 久久色.com| 这里只有精品99re| 91蜜桃网址入口| 国产精品99久久久久久久女警 | 天堂va蜜桃一区二区三区漫画版| 久久综合国产精品| 在线电影欧美成精品| 99久久精品免费看国产免费软件| 男女性色大片免费观看一区二区| 亚洲品质自拍视频网站| 国产日本一区二区| 欧美成va人片在线观看| 欧美日韩国产高清一区二区三区| 成人一区二区三区视频在线观看| 另类小说一区二区三区| 亚洲线精品一区二区三区| 99热在这里有精品免费| 久久久电影一区二区三区| 日韩欧美区一区二| 久久精品国产99| 国产精品久久精品日日| 成人免费福利片| 亚洲成人tv网| 欧美成人性福生活免费看| 成人午夜视频免费看| 一区二区欧美国产| 亚洲国产岛国毛片在线| 久久久久久久久99精品| 国产传媒一区在线| 久久97超碰国产精品超碰| 蜜臀99久久精品久久久久久软件| 亚洲欧美成人一区二区三区| 亚洲欧美日韩电影| 一区二区欧美精品| 亚洲成av人片一区二区梦乃| 亚洲成人综合在线| 婷婷综合另类小说色区| 免费成人小视频| 精品午夜久久福利影院| 精品一区二区在线免费观看| 久久99精品久久久久婷婷| 精品一区二区国语对白| 国产老女人精品毛片久久| 高清不卡一二三区| 99久久精品免费精品国产| 日本韩国一区二区三区视频| 色狠狠色狠狠综合| 91精品国产免费| 久久亚洲精华国产精华液 | 欧美精品一区二区蜜臀亚洲| 精品国产网站在线观看| 欧美激情一区二区| 一区二区三区 在线观看视频| 午夜久久久久久久久| 九一久久久久久| av动漫一区二区| 欧美性受xxxx黑人xyx性爽| 欧美一级一区二区| 国产拍揄自揄精品视频麻豆| 亚洲少妇屁股交4| 婷婷激情综合网| 国产一区二区美女| 97精品国产露脸对白| 欧美欧美欧美欧美首页| 2023国产精品自拍| 一区二区高清在线| 久久99精品久久久久久动态图| 成人午夜电影小说| 欧美福利视频导航| 国产欧美精品在线观看| 亚洲成人免费视频| 处破女av一区二区| 5858s免费视频成人| 国产目拍亚洲精品99久久精品| 亚洲一区二三区| 国产不卡视频一区| 在线综合亚洲欧美在线视频| 国产精品全国免费观看高清| 色婷婷亚洲一区二区三区| 在线看一区二区| 亚洲国产成人porn| 久久综合九色综合欧美就去吻| 国产欧美一区视频| 五月婷婷久久丁香| 99久久精品免费观看| 亚洲女同ⅹxx女同tv| 亚洲国产一区视频| 99re这里只有精品首页| 日韩欧美色电影| 日本aⅴ精品一区二区三区| 99久久久久久| 一区二区三区成人| 精品国产乱码久久久久久图片| 亚洲人吸女人奶水| 国产成人精品午夜视频免费 | 亚洲高清免费观看| www.欧美精品一二区| 欧美精品一区二区高清在线观看| 亚洲午夜激情网站| 欧美综合在线视频| 亚洲日本欧美天堂| 成人精品免费网站| 国产网站一区二区| 激情欧美日韩一区二区| 91精品福利在线一区二区三区| 亚洲精品成人悠悠色影视| 成人福利视频在线看| 久久久精品黄色| 国内精品嫩模私拍在线| 日韩免费成人网| 欧美96一区二区免费视频| 在线观看91av| 免费精品99久久国产综合精品| 欧美日韩国产综合草草| 亚洲激情六月丁香| 在线免费精品视频| 亚洲综合久久av| 欧美日韩午夜精品| 青青草97国产精品免费观看| 91精品国产综合久久香蕉的特点 |