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

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

?? ijg_timing.c

?? 這是在PCA下的基于IPP庫示例代碼例子,在網(wǎng)上下了IPP的庫之后,設(shè)置相關(guān)參數(shù)就可以編譯該代碼.
?? C
?? 第 1 頁 / 共 3 頁
字號:

/*
//
//             INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in accordance with the terms of that agreement.
//    Copyright (c) 2001-2005 Intel Corporation. All Rights Reserved.
//
//
*/

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include "jpeglib.h"
#include "ippdefs.h"
#include "ippcore.h"
#include "ipps.h"
#include "ippi.h"
#include "ippj.h"




#define BITMAPFILEHEADER_SIZE 14
#define BITMAPINFOHEADER_SIZE 40
#define _IPP 1 // set to 0 to disable IPP calls in IJG

typedef enum _JPEG_SAMPLING
{
  SS_OTHER = 0,
  SS_444   = 444,
  SS_422   = 422,
  SS_411   = 411

} JSS;


#if defined ( linux )

#define  BI_BITFIELDS     3
#define  BI_RLE4          2
#define  BI_RLE8          1
#define  BI_RGB           0

#define _MAX_PATH       256
#define _MAX_DRIVE       16
#define _MAX_DIR        256
#define _MAX_FNAME      256
#define _MAX_EXT         16


static void _splitpath(
  char* path,
  char* drive,
  char* dir,
  char* fname,
  char* ext)
{
  char* p;
  char* last_slash  = NULL;
  char* dot         = NULL;
  unsigned int len;

  /* extract drive letter, if any */
  if((strlen(path) >= (_MAX_DRIVE - 2)) && (*(path + _MAX_DRIVE - 2) == ':') )
  {
    if(drive)
    {
      strncpy(drive,path,_MAX_DRIVE - 1);
      *(drive + _MAX_DRIVE - 1) = '\0';
    }
    path += _MAX_DRIVE - 1;
  }
  else if(drive)
  {
    *drive = '\0';
  }

  /* extract path string, if any */
  for(last_slash = NULL, p = path; *p; p++)
  {
    if(*p == '/' || *p == '\\')
      last_slash = p + 1;
    else if(*p == '.')
      dot = p;
  }

  if(last_slash)
  {
    if(dir)
    {
      len = IPP_MIN((unsigned int)(((char*)last_slash - (char*)path) / sizeof(char)),(_MAX_DIR - 1));
      strncpy(dir,path,len);
      *(dir + len) = '\0';
    }
    path = last_slash;
  }
  else if(dir)
  {
    *dir = '\0';
  }

  /* extract file name, if any */
  if(dot && (dot >= path))
  {
    if(fname)
    {
      len = IPP_MIN((unsigned int)(((char*)dot - (char*)path) / sizeof(char)),(_MAX_FNAME - 1));
      strncpy(fname,path,len);
      *(fname + len) = '\0';
    }

    if(ext)
    {
      len = IPP_MIN((unsigned int)(((char*)p - (char*)dot) / sizeof(char)),(_MAX_EXT - 1));
      strncpy(ext,dot,len);
      *(ext + len) = '\0';
    }
  }
  else
  {
    if(fname)
    {
      len = IPP_MIN((unsigned int)(((char*)p - (char*)path) / sizeof(char)),(_MAX_FNAME - 1));
      strncpy(fname,path,len);
      *(fname + len) = '\0';
    }
    if(ext)
    {
      *ext = '\0';
    }
  }

  return;
} /* _splitpath() */


static void _makepath(
  char* path,
  char* drive,
  char* dir,
  char* fname,
  char* ext)
{
  char* p;

  /* make drive */
  if(drive && *drive)
  {
    *path++ = *drive;
    *path++ = ':';
  }

  /* make dir */
  if((p = dir) && *p)
  {
    do
    {
      *path++ = *p++;
    } while(*p);

    if(*(p-1) != '/' && *(p-1) != '\\')
    {
      *path++ = '\\';
    }
  }

  /* make fname */
  if(p = fname)
  {
    while(*p)
      *path++ = *p++;
  }

  /* make ext */
  if(p = ext)
  {
    if(*p && *p != '.')
    {
      *path++ = '.';
    }
    while(*path++ = *p)
      ;
  }
  else
  {
    *path = '\0';
  }

  return;
} /* _makepath() */

#endif /* linux */


#define get_pentium_counter ippGetCpuClocks

static void copyright(void)
{
  printf("Test program for IJG library boosted with\n");
  printf("Intel(R) Integrated Performance Primitives\n");
  printf("Copyright(c) 2001-2005 Intel Corporation. All Rights Reserved.\n");
  return;
} /* copyright() */


static void usage(void)
{
  printf("use ./ijg_timing [options]\n");
  printf("where options are:\n");
  printf("  -?|-h show usage information\n");
  printf("  -v show ippJP library version\n");
  printf("  -a auto testing with hardcoded parameters.\n");
  printf("     They are encoding/decoding 640x480 1, 3 and 4 channels images\n");
  printf("     with random pixel values and 444, 422 and 411 sampling and 75%% quality\n");
  printf("  -t<bmp name> encode bmp to jpeg, after that decode jpeg to bmp\n");
  printf("     and compare with original bmp\n");
  printf("  -d<file name> decode JPEG <file name> file\n");
  printf("  -e<file name> encode BMP <file name> file\n");
  printf("  -qQUALITY jpeg quality 1..100\n");
  printf("  -sSAMPLING jpeg sampling 444, 422, 411\n");
  return;
} /* usage() */


static void ipp_version(void)
{
  const IppLibraryVersion* version;

  printf("Intel(R) Integrated Performance Primitives\n");

  /* ippCore version info */
  version = ippGetLibVersion();

  printf("  %s, %s {%d.%d.%d.%d}, build date %s\n",
    version->Name,
    version->Version,
    version->major,version->minor,version->majorBuild,version->build,
    version->BuildDate);

  /* ippSP version info */
  version = ippsGetLibVersion();

  printf("  %s, %s {%d.%d.%d.%d}, build date %s\n",
    version->Name,
    version->Version,
    version->major,version->minor,version->majorBuild,version->build,
    version->BuildDate);

  /* ippIP version info */
  version = ippiGetLibVersion();

  printf("  %s, %s {%d.%d.%d.%d}, build date %s\n",
    version->Name,
    version->Version,
    version->major,version->minor,version->majorBuild,version->build,
    version->BuildDate);

  /* ippJP version info */
  version = ippjGetLibVersion();

  printf("  %s, %s {%d.%d.%d.%d}, build date %s\n",
    version->Name,
    version->Version,
    version->major,version->minor,version->majorBuild,version->build,
    version->BuildDate);

  return;
} /* ipp_version() */


static void set_sampling(
  struct jpeg_compress_struct* cinfo,
  JSS sampling,
  int nchannels)
{
  switch(sampling)
  {
    case SS_444:
      cinfo->comp_info[0].h_samp_factor = 1;
      cinfo->comp_info[0].v_samp_factor = 1;
      if(nchannels == 3)
      {
        cinfo->comp_info[1].h_samp_factor = 1;
        cinfo->comp_info[1].v_samp_factor = 1;
        cinfo->comp_info[2].h_samp_factor = 1;
        cinfo->comp_info[2].v_samp_factor = 1;
      }
      if(nchannels == 4)
      {
        cinfo->comp_info[3].h_samp_factor = 1;
        cinfo->comp_info[3].v_samp_factor = 1;
      }
      break;

    case SS_422:
      cinfo->comp_info[0].h_samp_factor = 2;
      cinfo->comp_info[0].v_samp_factor = 1;
      cinfo->comp_info[1].h_samp_factor = 1;
      cinfo->comp_info[1].v_samp_factor = 1;
      cinfo->comp_info[2].h_samp_factor = 1;
      cinfo->comp_info[2].v_samp_factor = 1;
      if(nchannels == 4)
      {
        cinfo->comp_info[3].h_samp_factor = 2;
        cinfo->comp_info[3].v_samp_factor = 1;
      }
      break;

    case SS_411:
      cinfo->comp_info[0].h_samp_factor = 2;
      cinfo->comp_info[0].v_samp_factor = 2;
      cinfo->comp_info[1].h_samp_factor = 1;
      cinfo->comp_info[1].v_samp_factor = 1;
      cinfo->comp_info[2].h_samp_factor = 1;
      cinfo->comp_info[2].v_samp_factor = 1;
      if(nchannels == 4)
      {
        cinfo->comp_info[3].h_samp_factor = 2;
        cinfo->comp_info[3].v_samp_factor = 2;
      }
      break;

    default:
      printf("unknown sampling - %d\n",sampling);
  }

  return;
} /* set_sampling() */


static void get_sampling(
  struct jpeg_decompress_struct* cinfo,
  JSS* sampling)
{
  if(cinfo->num_components == 1)
  {
    *sampling = SS_444;
  }
  else
  if(cinfo->num_components == 3)
  {
    if(cinfo->comp_info[0].h_samp_factor == 1 && cinfo->comp_info[0].v_samp_factor == 1 &&
       cinfo->comp_info[1].h_samp_factor == 1 && cinfo->comp_info[1].v_samp_factor == 1 &&
       cinfo->comp_info[2].h_samp_factor == 1 && cinfo->comp_info[2].v_samp_factor == 1)
    {
      *sampling = SS_444;
    }
    else
    if(cinfo->comp_info[0].h_samp_factor == 2 && cinfo->comp_info[0].v_samp_factor == 1 &&
       cinfo->comp_info[1].h_samp_factor == 1 && cinfo->comp_info[1].v_samp_factor == 1 &&
       cinfo->comp_info[2].h_samp_factor == 1 && cinfo->comp_info[2].v_samp_factor == 1)
    {
      *sampling = SS_422;
    }
    else
    if(cinfo->comp_info[0].h_samp_factor == 2 && cinfo->comp_info[0].v_samp_factor == 2 &&
       cinfo->comp_info[1].h_samp_factor == 1 && cinfo->comp_info[1].v_samp_factor == 1 &&
       cinfo->comp_info[2].h_samp_factor == 1 && cinfo->comp_info[2].v_samp_factor == 1)
    {
      *sampling = SS_411;
    }
    else
    {
      printf("unknown sampling\n");
      *sampling = SS_OTHER;
    }
  }
  else
  if(cinfo->num_components == 4)
  {
    if(cinfo->comp_info[0].h_samp_factor == 1 && cinfo->comp_info[0].v_samp_factor == 1 &&
       cinfo->comp_info[1].h_samp_factor == 1 && cinfo->comp_info[1].v_samp_factor == 1 &&
       cinfo->comp_info[2].h_samp_factor == 1 && cinfo->comp_info[2].v_samp_factor == 1 &&
       cinfo->comp_info[3].h_samp_factor == 1 && cinfo->comp_info[3].v_samp_factor == 1)
    {
      *sampling = SS_444;
    }
    else
    if(cinfo->comp_info[0].h_samp_factor == 2 && cinfo->comp_info[0].v_samp_factor == 1 &&
       cinfo->comp_info[1].h_samp_factor == 1 && cinfo->comp_info[1].v_samp_factor == 1 &&
       cinfo->comp_info[2].h_samp_factor == 1 && cinfo->comp_info[2].v_samp_factor == 1 &&
       cinfo->comp_info[3].h_samp_factor == 2 && cinfo->comp_info[3].v_samp_factor == 1)
    {
      *sampling = SS_422;
    }
    else
    if(cinfo->comp_info[0].h_samp_factor == 2 && cinfo->comp_info[0].v_samp_factor == 2 &&
       cinfo->comp_info[1].h_samp_factor == 1 && cinfo->comp_info[1].v_samp_factor == 1 &&
       cinfo->comp_info[2].h_samp_factor == 1 && cinfo->comp_info[2].v_samp_factor == 1 &&
       cinfo->comp_info[3].h_samp_factor == 2 && cinfo->comp_info[3].v_samp_factor == 2)
    {
      *sampling = SS_411;
    }
    else
    {
      printf("unknown sampling\n");
      *sampling = SS_OTHER;
    }
  }
  else
  {
    printf("bad number of channels - %d\n",cinfo->num_components);
  }

  return;
} /* get_sampling() */


static int ijg_encode(
  Ipp8u*        inbuf,
  int           width,
  int           height,
  int           nchannels,
  JSS           sampling,
  int           quality,
  char*         outname,
  unsigned int* cpu_clocks)
{
  int    i;
  int    res;
  int    col;
  int    in_line_step;
  int    cur_input_row;
  Ipp64u clk0;
  Ipp64u clk1;
  Ipp8u* inptr;
  Ipp8u* outptr;
  Ipp8u* temp_buf = NULL;
  FILE*  fo = NULL;

  struct jpeg_error_mgr jerr;
  struct jpeg_compress_struct cinfo;

  fo = fopen(outname,"wb+");
  if(NULL == fo)
  {
    printf("can't create file %s\n",outname);
    res = -1;
    goto Exit;
  }

  cinfo.err = jpeg_std_error(&jerr);

  jpeg_create_compress(&cinfo);

  cinfo.UseIPP           = _IPP;
  cinfo.data_precision   = 8;
  cinfo.image_width      = width;
  cinfo.image_height     = height;
  cinfo.input_components = nchannels;
  cinfo.in_color_space   = ( (nchannels == 1) ? JCS_GRAYSCALE : ( (nchannels == 3) ? JCS_RGB : JCS_CMYK ) );

  jpeg_set_defaults(&cinfo);

  cinfo.jpeg_color_space = ( (nchannels == 1) ? JCS_GRAYSCALE : ( (nchannels == 3) ? JCS_YCbCr : JCS_YCCK) );

  jpeg_stdio_dest(&cinfo,fo);

  jpeg_set_quality(&cinfo,quality,TRUE);

  set_sampling(&cinfo,sampling,nchannels);

  in_line_step = cinfo.input_components * cinfo.image_width;

  while(in_line_step & 3)
  {
    in_line_step++;
  }

  temp_buf = malloc(in_line_step);
  if(NULL == temp_buf)
  {
    printf("can't allocate %d bytes\n",in_line_step);
    res = -1;
    goto Exit;
  }
#ifdef _WIN32
  SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_TIME_CRITICAL);
  Sleep(0);
#endif
  clk0 = get_pentium_counter();

  jpeg_start_compress(&cinfo,TRUE);

  cur_input_row = 0;

  while(cinfo.next_scanline < cinfo.image_height)
  {
    cur_input_row++;
    inptr  = inbuf + in_line_step * (cinfo.image_height - cur_input_row);
    outptr = temp_buf;

    for(col = cinfo.image_width; col--;)
    {
      switch(cinfo.input_components)
      {
      case 1:
        *outptr++ = *inptr++;
        break;

      case 3:
        for(i = cinfo.input_components; i--;)
        {
          outptr[0] = inptr[2];
          outptr[1] = inptr[1];
          outptr[2] = inptr[0];
        }
        inptr  += 3;
        outptr += 3;
        break;

      case 4:
        for(i = cinfo.input_components; i--;)
        {
          outptr[0] = inptr[3];
          outptr[1] = inptr[2];
          outptr[2] = inptr[1];
          outptr[3] = inptr[0];
        }
        inptr  += 4;
        outptr += 4;
        break;
      }
    }

    while((int)outptr & 3)
    {
      *outptr++ = 0;
    }

    jpeg_write_scanlines(&cinfo,&temp_buf,1);
  }

  jpeg_finish_compress(&cinfo);

  clk1 = get_pentium_counter();
#ifdef _WIN32
  SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_NORMAL);
#endif
  *cpu_clocks = (unsigned int)(clk1 - clk0);

  res = 0;

Exit:

  if(NULL != temp_buf)
  {
    free(temp_buf);
  }

  jpeg_destroy_compress(&cinfo);

  /* free memory and close files */
  if(NULL != fo)
  {
    fclose(fo);
  }

  return res;
} /* ijg_encode() */


static int ijg_decode(
  char*         name,
  Ipp8u**       buffer,
  int*          width,
  int*          height,
  int*          nchannels,
  JSS*          sampling,
  unsigned int* cpu_clocks)
{
  int    res;
  int    col;
  int    bmp_width;
  int    cur_output_row;
  int    img_size;
  JSS    ss;
  Ipp64u clk0;
  Ipp64u clk1;
  Ipp8u* inptr = NULL;
  Ipp8u* outptr = NULL;
  Ipp8u* tmp_buff = NULL;
  Ipp8u* img_buff = NULL;
  FILE*  fi = NULL;

  struct jpeg_error_mgr jerr;
  struct jpeg_decompress_struct cinfo;

  cinfo.err = jpeg_std_error(&jerr);

  jpeg_create_decompress(&cinfo);

  cinfo.UseIPP = _IPP;

  fi = fopen(name,"rb");
  if(NULL == fi)
  {
    printf("can't open file - %s\n",name);
    res = -1;
    goto Exit;
  }

  jpeg_stdio_src(&cinfo,fi);

  jpeg_read_header(&cinfo,TRUE);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日一区二区三区| 六月丁香综合在线视频| 亚洲影视在线观看| 免费观看30秒视频久久| 另类小说图片综合网| 国产成人av电影| 91老师片黄在线观看| 欧美美女黄视频| 中文字幕精品三区| 亚洲成a人片综合在线| 激情国产一区二区| 欧美性色黄大片| 男男gaygay亚洲| 国产成都精品91一区二区三| 94-欧美-setu| 久久久久久黄色| 日本欧美韩国一区三区| av一本久道久久综合久久鬼色| 欧美日本一区二区| 亚洲欧美日韩在线| 国产成都精品91一区二区三| 91精品国产综合久久精品性色 | 欧美群妇大交群的观看方式| 久久影音资源网| 午夜精品福利一区二区三区av| 成人妖精视频yjsp地址| 精品国产污污免费网站入口 | 久久99精品国产91久久来源| 色综合久久天天综合网| 国产情人综合久久777777| 奇米精品一区二区三区在线观看一 | 制服丝袜激情欧洲亚洲| 亚洲你懂的在线视频| jizz一区二区| 亚洲欧美日韩国产综合在线| 99久久精品免费看国产| 国产精品久久久久久久久果冻传媒| 精品制服美女久久| 精品久久久久久久久久久久久久久| 午夜成人免费电影| 欧美日韩国产精选| 免费久久99精品国产| 91麻豆精品91久久久久同性| 婷婷丁香久久五月婷婷| 欧美高清视频在线高清观看mv色露露十八 | 午夜av一区二区三区| 欧美日韩在线综合| 青青草国产精品97视觉盛宴| 日韩精品一区二区三区视频在线观看| 青青草原综合久久大伊人精品优势| 91精品在线免费| 国产精品乡下勾搭老头1| 亚洲婷婷国产精品电影人久久| 色哟哟精品一区| 日本视频一区二区三区| 精品免费日韩av| 色综合视频一区二区三区高清| 一区二区三区国产| 精品免费日韩av| 欧美性受xxxx黑人xyx| 狠狠色综合色综合网络| 中文字幕中文在线不卡住| 欧美一区二区视频在线观看2020| 国产高清一区日本| 天堂精品中文字幕在线| 欧美国产精品一区二区| 欧美天堂亚洲电影院在线播放| 国模大尺度一区二区三区| 亚洲精品欧美激情| 久久影院午夜论| 欧美成人在线直播| 色猫猫国产区一区二在线视频| 免费观看成人av| 午夜精品福利一区二区蜜股av | www.亚洲在线| 国产一区二区女| 奇米色一区二区| 亚洲国产一区视频| 亚洲精品日产精品乱码不卡| 久久青草国产手机看片福利盒子| 欧美区在线观看| 欧美色精品在线视频| 日韩视频一区在线观看| 在线观看www91| 99精品一区二区三区| 狠狠色丁香婷婷综合| 免费成人av在线| 午夜伦理一区二区| 成人性生交大片免费看视频在线 | 99精品欧美一区二区蜜桃免费| 久久99国产精品久久99| 日韩成人一区二区| 日韩高清国产一区在线| 麻豆精品视频在线| 国产精品自拍av| 福利91精品一区二区三区| 国产成人免费视频网站| zzijzzij亚洲日本少妇熟睡| 99re66热这里只有精品3直播 | 岛国精品在线播放| 成人蜜臀av电影| 色噜噜久久综合| 欧美伦理电影网| 欧美xxxxx牲另类人与| 精品少妇一区二区三区视频免付费 | 中文字幕亚洲区| 综合欧美亚洲日本| 亚洲午夜久久久久久久久电影网 | 日韩精品一区二区三区四区| 久久久久国产精品麻豆| 亚洲精品高清在线观看| 美日韩一区二区| 色综合久久中文字幕综合网| 欧美日韩高清在线播放| 国产午夜一区二区三区| 一级中文字幕一区二区| 精品一区二区三区免费观看| 91婷婷韩国欧美一区二区| 欧美一区国产二区| 亚洲人成7777| 免费在线一区观看| 色呦呦日韩精品| 久久久久99精品一区| 午夜国产精品影院在线观看| av电影在线观看不卡| 欧美成人女星排行榜| 亚洲精品成人在线| 国产成人精品免费| 欧美成人精品福利| 亚洲电影在线播放| 99v久久综合狠狠综合久久| 欧美成人a视频| 日本大胆欧美人术艺术动态| 91理论电影在线观看| 欧美激情在线一区二区| 狠狠色综合播放一区二区| 欧美一区中文字幕| 亚洲第一激情av| 色婷婷综合激情| 中文字幕av免费专区久久| 久久精品国产99国产| 欧美一区二区三区性视频| 午夜精品在线视频一区| 欧美伊人精品成人久久综合97| 国产精品家庭影院| 国产成人福利片| 国产亚洲欧洲997久久综合| 国产一区二区0| 欧美国产精品专区| 国产伦精品一区二区三区视频青涩| 日韩精品一区二区三区中文不卡 | 日韩精品一级中文字幕精品视频免费观看 | 日韩精品乱码免费| 91精品国产综合久久香蕉的特点| 一级特黄大欧美久久久| 欧美三级午夜理伦三级中视频| 亚洲大片精品永久免费| 51午夜精品国产| 久久99精品久久久久| 亚洲国产成人在线| 一本色道久久综合亚洲aⅴ蜜桃| 一区二区三区欧美| 欧美日韩免费不卡视频一区二区三区| 亚洲成人av一区| 国产精品午夜在线| 国产成人免费高清| 日韩理论电影院| av中文字幕在线不卡| 亚洲情趣在线观看| 欧美精品亚洲一区二区在线播放| 午夜久久久久久久久久一区二区| 91精品蜜臀在线一区尤物| 福利一区二区在线观看| 亚洲成人免费在线| 久久久精品日韩欧美| 欧美三级一区二区| 国产成人亚洲综合a∨婷婷| 亚洲成人av福利| 中文字幕国产一区二区| 在线观看91精品国产麻豆| 成人app软件下载大全免费| 亚洲国产精品久久不卡毛片 | 亚洲三级在线观看| 欧美变态tickling挠脚心| 日本高清不卡一区| 成人午夜电影久久影院| 亚洲电影一区二区三区| 国产日本欧美一区二区| 日韩午夜av电影| 欧美色综合久久| 91蝌蚪porny九色| 成人国产精品免费观看动漫| 蜜桃视频一区二区三区在线观看| 悠悠色在线精品| ...中文天堂在线一区| 欧美激情综合五月色丁香小说| 日韩欧美的一区| 日韩免费高清视频| 日韩欧美在线网站| 日韩网站在线看片你懂的|