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

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

?? jdphuff.pas

?? DELPHI版的JPEG文件解碼源程序
?? PAS
?? 第 1 頁 / 共 3 頁
字號:
Unit JdpHuff;

{ This file contains Huffman entropy decoding routines for progressive JPEG.

  Much of the complexity here has to do with supporting input suspension.
  If the data source module demands suspension, we want to be able to back
  up to the start of the current MCU.  To do this, we copy state variables
  into local working storage, and update them back to the permanent
  storage only upon successful completion of an MCU. }

{ Original: jdphuff.c ; Copyright (C) 1995-1997, Thomas G. Lane. }

interface

{$I jconfig.inc}

uses
  jmorecfg,
  jinclude,
  jpeglib,
  jdeferr,
  jerror,
  jutils,
  jdhuff;		{ Declarations shared with jdhuff.c }


{GLOBAL}
procedure jinit_phuff_decoder (cinfo : j_decompress_ptr);

implementation

{ Expanded entropy decoder object for progressive Huffman decoding.

  The savable_state subrecord contains fields that change within an MCU,
  but must not be updated permanently until we complete the MCU. }

type
  savable_state = record
    EOBRUN : uInt;               { remaining EOBs in EOBRUN }
    last_dc_val : array[00..MAX_COMPS_IN_SCAN-1] of int;
                                 { last DC coef for each component }
  end;


type
  phuff_entropy_ptr  = ^phuff_entropy_decoder;
  phuff_entropy_decoder = record
    pub : jpeg_entropy_decoder; { public fields }

    { These fields are loaded into local variables at start of each MCU.
      In case of suspension, we exit WITHOUT updating them. }

    bitstate : bitread_perm_state;	{ Bit buffer at start of MCU }
    saved : savable_state;		{ Other state at start of MCU }

    { These fields are NOT loaded into local working state. }
    restarts_to_go : uInt;              { MCUs left in this restart interval }

    { Pointers to derived tables (these workspaces have image lifespan) }
    derived_tbls : array[0..NUM_HUFF_TBLS-1] of d_derived_tbl_ptr;

    ac_derived_tbl : d_derived_tbl_ptr; { active table during an AC scan }
  end;



{ Forward declarations }
{METHODDEF}
function decode_mcu_DC_first (cinfo : j_decompress_ptr;
                              var MCU_data : array of JBLOCKROW) : boolean;
                              far; forward;
{METHODDEF}
function decode_mcu_AC_first (cinfo : j_decompress_ptr;
                              var MCU_data : array of JBLOCKROW) : boolean;
                              far; forward;
{METHODDEF}
function decode_mcu_DC_refine (cinfo : j_decompress_ptr;
                               var MCU_data : array of JBLOCKROW) : boolean;
                               far; forward;
{METHODDEF}
function decode_mcu_AC_refine (cinfo : j_decompress_ptr;
                               var MCU_data : array of JBLOCKROW) : boolean;
                               far; forward;

{ Initialize for a Huffman-compressed scan. }

{METHODDEF}
procedure start_pass_phuff_decoder (cinfo : j_decompress_ptr); far;
var
  entropy : phuff_entropy_ptr;
  is_DC_band, bad : boolean;
  ci, coefi, tbl : int;
  coef_bit_ptr : coef_bits_ptr;
  compptr : jpeg_component_info_ptr;
var
  cindex : int;
  expected : int;
begin
  entropy := phuff_entropy_ptr (cinfo^.entropy);

  is_DC_band := (cinfo^.Ss = 0);

  { Validate scan parameters }
  bad := FALSE;
  if (is_DC_band) then
  begin
    if (cinfo^.Se <> 0) then
      bad := TRUE;
  end
  else
  begin
    { need not check Ss/Se < 0 since they came from unsigned bytes }
    if (cinfo^.Ss > cinfo^.Se) or (cinfo^.Se >= DCTSIZE2) then
      bad := TRUE;
    { AC scans may have only one component }
    if (cinfo^.comps_in_scan <> 1) then
      bad := TRUE;
  end;
  if (cinfo^.Ah <> 0) then
  begin
    { Successive approximation refinement scan: must have Al = Ah-1. }
    if (cinfo^.Al <> cinfo^.Ah-1) then
      bad := TRUE;
  end;
  if (cinfo^.Al > 13) then      { need not check for < 0 }
    bad := TRUE;
  { Arguably the maximum Al value should be less than 13 for 8-bit precision,
    but the spec doesn't say so, and we try to be liberal about what we
    accept.  Note: large Al values could result in out-of-range DC
    coefficients during early scans, leading to bizarre displays due to
    overflows in the IDCT math.  But we won't crash. }

  if (bad) then
    ERREXIT4(j_common_ptr(cinfo), JERR_BAD_PROGRESSION,
	     cinfo^.Ss, cinfo^.Se, cinfo^.Ah, cinfo^.Al);
  { Update progression status, and verify that scan order is legal.
    Note that inter-scan inconsistencies are treated as warnings
    not fatal errors ... not clear if this is right way to behave. }

  for ci := 0 to pred(cinfo^.comps_in_scan) do
  begin
    cindex := cinfo^.cur_comp_info[ci]^.component_index;
    coef_bit_ptr := coef_bits_ptr(@(cinfo^.coef_bits^[cindex])); {^[0] ???
                                                                   Nomssi    }
    if (not is_DC_band) and (coef_bit_ptr^[0] < 0) then
      { AC without prior DC scan }
      WARNMS2(j_common_ptr(cinfo), JWRN_BOGUS_PROGRESSION, cindex, 0);
    for coefi := cinfo^.Ss to cinfo^.Se do
    begin
      if (coef_bit_ptr^[coefi] < 0) then
        expected :=  0
      else
        expected := coef_bit_ptr^[coefi];
      if (cinfo^.Ah <> expected) then
	WARNMS2(j_common_ptr(cinfo), JWRN_BOGUS_PROGRESSION, cindex, coefi);
      coef_bit_ptr^[coefi] := cinfo^.Al;
    end;
  end;

  { Select MCU decoding routine }
  if (cinfo^.Ah = 0) then
  begin
    if (is_DC_band) then
      entropy^.pub.decode_mcu := decode_mcu_DC_first
    else
      entropy^.pub.decode_mcu := decode_mcu_AC_first;
  end
  else
  begin
    if (is_DC_band) then
      entropy^.pub.decode_mcu := decode_mcu_DC_refine
    else
      entropy^.pub.decode_mcu := decode_mcu_AC_refine;
  end;

  for ci := 0 to pred(cinfo^.comps_in_scan) do
  begin
    compptr := cinfo^.cur_comp_info[ci];
    { Make sure requested tables are present, and compute derived tables.
      We may build same derived table more than once, but it's not expensive. }

    if (is_DC_band) then
    begin
      if (cinfo^.Ah = 0) then
      begin	{ DC refinement needs no table }
	tbl := compptr^.dc_tbl_no;
	jpeg_make_d_derived_tbl(cinfo, TRUE, tbl,
				 entropy^.derived_tbls[tbl]);
      end;
    end
    else
    begin
      tbl := compptr^.ac_tbl_no;
      jpeg_make_d_derived_tbl(cinfo, FALSE, tbl,
			       entropy^.derived_tbls[tbl]);
      { remember the single active table }
      entropy^.ac_derived_tbl := entropy^.derived_tbls[tbl];
    end;
    { Initialize DC predictions to 0 }
    entropy^.saved.last_dc_val[ci] := 0;
  end;

  { Initialize bitread state variables }
  entropy^.bitstate.bits_left := 0;
  entropy^.bitstate.get_buffer := 0; { unnecessary, but keeps Purify quiet }
  entropy^.pub.insufficient_data := FALSE;

  { Initialize private state variables }
  entropy^.saved.EOBRUN := 0;

  { Initialize restart counter }
  entropy^.restarts_to_go := cinfo^.restart_interval;
end;


{ Figure F.12: extend sign bit.
  On some machines, a shift and add will be faster than a table lookup. }

{$ifdef AVOID_TABLES}

#define HUFF_EXTEND(x,s)
  ((x) < (1shl((s)-1)) ? (x) + (((-1)shl(s)) + 1) : (x))

{$else}

{ #define HUFF_EXTEND(x,s)
  if (x) < extend_test[s] then
    (x) + extend_offset[s]
  else
    (x)}

const
 extend_test : Array[0..16-1] of int =   { entry n is 2**(n-1) }
   ($0000, $0001, $0002, $0004, $0008, $0010, $0020, $0040,
    $0080, $0100, $0200, $0400, $0800, $1000, $2000, $4000);

const
  extend_offset : array[0..16-1] of int = { entry n is (-1 shl n) + 1 }
  ( 0, ((-1) shl 1) + 1, ((-1) shl 2) + 1, ((-1) shl 3) + 1, ((-1) shl 4) + 1,
    ((-1) shl 5) + 1, ((-1) shl 6) + 1, ((-1) shl 7) + 1, ((-1) shl 8) + 1,
    ((-1) shl 9) + 1, ((-1) shl 10) + 1, ((-1) shl 11) + 1, ((-1) shl 12) + 1,
    ((-1) shl 13) + 1, ((-1) shl 14) + 1, ((-1) shl 15) + 1 );

{$endif} { AVOID_TABLES }


{ Check for a restart marker & resynchronize decoder.
  return:=s FALSE if must suspend. }

{LOCAL}
function process_restart (cinfo : j_decompress_ptr) : boolean;
var
  entropy : phuff_entropy_ptr; 
  ci : int;
begin
  entropy := phuff_entropy_ptr (cinfo^.entropy);

  { Throw away any unused bits remaining in bit buffer; }
  { include any full bytes in next_marker's count of discarded bytes }
  Inc(cinfo^.marker^.discarded_bytes, entropy^.bitstate.bits_left div 8);
  entropy^.bitstate.bits_left := 0;

  { Advance past the RSTn marker }
  if (not cinfo^.marker^.read_restart_marker (cinfo)) then
  begin
    process_restart := FALSE;
    exit;
  end;

  { Re-initialize DC predictions to 0 }
  for ci := 0 to pred(cinfo^.comps_in_scan) do
    entropy^.saved.last_dc_val[ci] := 0;
  { Re-init EOB run count, too }
  entropy^.saved.EOBRUN := 0;

  { Reset restart counter }
  entropy^.restarts_to_go := cinfo^.restart_interval;

  { Reset out-of-data flag, unless read_restart_marker left us smack up
    against a marker.  In that case we will end up treating the next data
    segment as empty, and we can avoid producing bogus output pixels by
    leaving the flag set. }
  if (cinfo^.unread_marker = 0) then
    entropy^.pub.insufficient_data := FALSE;

  process_restart := TRUE;
end;


{ Huffman MCU decoding.
  Each of these routines decodes and returns one MCU's worth of
  Huffman-compressed coefficients.
  The coefficients are reordered from zigzag order into natural array order,
  but are not dequantized.

  The i'th block of the MCU is stored into the block pointed to by
  MCU_data[i].  WE ASSUME THIS AREA IS INITIALLY ZEROED BY THE CALLER.

  We return FALSE if data source requested suspension.  In that case no
  changes have been made to permanent state.  (Exception: some output
  coefficients may already have been assigned.  This is harmless for
  spectral selection, since we'll just re-assign them on the next call.
  Successive approximation AC refinement has to be more careful, however.) }


{ MCU decoding for DC initial scan (either spectral selection,
  or first pass of successive approximation). }

{METHODDEF}
function decode_mcu_DC_first (cinfo : j_decompress_ptr;
                              var MCU_data : array of JBLOCKROW) : boolean;
label
  label1;
var
  entropy : phuff_entropy_ptr;
  Al : int;
  {register} s, r : int;
  blkn, ci : int;
  block : JBLOCK_PTR;
  {BITREAD_STATE_VARS;}
  get_buffer : bit_buf_type ; {register}
  bits_left : int; {register}
  br_state : bitread_working_state;

  state : savable_state;
  tbl : d_derived_tbl_ptr;
  compptr : jpeg_component_info_ptr;
var
  nb, look : int; {register}
begin
  entropy := phuff_entropy_ptr (cinfo^.entropy);
  Al := cinfo^.Al;

  { Process restart marker if needed; may have to suspend }
  if (cinfo^.restart_interval <> 0) then
  begin
    if (entropy^.restarts_to_go = 0) then
      if (not process_restart(cinfo)) then
      begin
	decode_mcu_DC_first := FALSE;
        exit;
      end;
  end;

  { If we've run out of data, just leave the MCU set to zeroes.
    This way, we return uniform gray for the remainder of the segment. }

  if not entropy^.pub.insufficient_data then
  begin

    { Load up working state }
    {BITREAD_LOAD_STATE(cinfo,entropy^.bitstate);}
    br_state.cinfo := cinfo;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久国产综合精品女国产盗摄| 亚洲高清三级视频| 亚洲黄色在线视频| 国产麻豆午夜三级精品| 久久久久国产精品麻豆ai换脸| 亚洲精品免费看| 国产精品亚洲视频| 91麻豆精品国产自产在线观看一区 | 亚洲婷婷综合色高清在线| 免费成人美女在线观看.| 欧美综合一区二区| 国产精品人妖ts系列视频| 精品一区二区三区香蕉蜜桃| 8x福利精品第一导航| 日韩伦理av电影| youjizz久久| 国产亚洲午夜高清国产拍精品| 蜜臀av一区二区| 欧美精品高清视频| 亚洲国产日韩综合久久精品| 色美美综合视频| 亚洲精品一卡二卡| 91黄色小视频| 亚洲男人电影天堂| 91蜜桃在线观看| 国产精品久久精品日日| 97国产一区二区| 亚洲天堂成人在线观看| 91亚洲资源网| 一区二区三区欧美在线观看| 一本久道中文字幕精品亚洲嫩| 国产精品二三区| 色综合色综合色综合| 亚洲欧美二区三区| 一本一本大道香蕉久在线精品| 中文字幕视频一区二区三区久| av网站免费线看精品| 一区二区三区在线看| 欧美在线不卡一区| 亚洲国产日日夜夜| 日韩一区二区精品在线观看| 精品一区二区三区免费观看| 久久综合色播五月| 成人激情综合网站| 一区二区三区日韩精品| 91精品中文字幕一区二区三区| 日本午夜精品一区二区三区电影| 欧美一区日本一区韩国一区| 久久av资源网| 中文字幕av一区二区三区免费看 | 奇米影视7777精品一区二区| 欧美猛男男办公室激情| 日日夜夜精品视频天天综合网| 91精品国模一区二区三区| 国产一区二区三区在线观看精品| 亚洲国产精品t66y| 91成人免费在线视频| 蜜臀久久99精品久久久画质超高清 | 福利一区福利二区| 一区二区欧美在线观看| 欧美一区二区三区不卡| 国产一区二区导航在线播放| 亚洲精品菠萝久久久久久久| 欧美一级专区免费大片| 成人自拍视频在线| 亚洲国产你懂的| 久久青草国产手机看片福利盒子| 99精品欧美一区| 久久精品国产秦先生| 亚洲欧美日韩小说| 久久综合一区二区| 欧美三级乱人伦电影| 国产一区亚洲一区| 亚洲一区二区高清| 久久精品亚洲一区二区三区浴池| 欧美三级日韩在线| www.久久久久久久久| 精品无人码麻豆乱码1区2区| 亚洲欧美日韩电影| 久久久影视传媒| 日韩视频一区二区三区在线播放| av成人免费在线观看| 国产综合色产在线精品| 亚洲国产综合色| 国产精品久久三| 欧美mv日韩mv国产| 欧美日韩视频第一区| av福利精品导航| 91精品国产综合久久国产大片 | 国产精品一区专区| 日本三级亚洲精品| 亚洲午夜精品17c| 亚洲美女少妇撒尿| 中文字幕一区二区三| 国产亚洲精品中文字幕| 亚洲精品一区二区三区99| 欧美高清dvd| 欧美日韩一区二区不卡| 色94色欧美sute亚洲13| 99在线精品视频| 国产成人啪午夜精品网站男同| 久久成人精品无人区| 三级不卡在线观看| 视频一区中文字幕国产| 亚洲成人免费看| 无码av免费一区二区三区试看| 亚洲一区二区精品久久av| 亚洲精品高清在线| 一区二区三区.www| 亚洲电影视频在线| 亚洲成av人影院| 天堂蜜桃91精品| 日本中文在线一区| 美国三级日本三级久久99| 日韩vs国产vs欧美| 日本麻豆一区二区三区视频| 日本欧美韩国一区三区| 久久机这里只有精品| 国产一区二区三区蝌蚪| 成人激情小说网站| 色综合激情久久| 欧美性感一类影片在线播放| 欧美精品高清视频| 日韩精品一区二区三区老鸭窝| 欧美大片一区二区| 国产日产欧美一区二区三区| 国产精品久久久久影视| 亚洲午夜免费视频| 裸体一区二区三区| 国产精品原创巨作av| 成人av电影观看| 在线观看免费成人| 欧美大片在线观看一区| 中文字幕av一区二区三区| 亚洲视频在线观看一区| 亚洲成人免费在线观看| 狠狠色综合色综合网络| 99久久亚洲一区二区三区青草| 欧美日韩免费在线视频| 日韩精品一区二区三区老鸭窝| 国产免费久久精品| 亚洲自拍欧美精品| 韩国精品久久久| 色网综合在线观看| 一区二区三区中文在线观看| 奇米一区二区三区| 高清不卡在线观看| 欧美日韩国产三级| 久久久久久久久久美女| 亚洲福利视频一区| 国产91在线看| 777久久久精品| 国产精品理论在线观看| 欧美bbbbb| 91免费视频网| 久久精品在这里| 亚洲国产视频网站| 成人精品免费看| 日韩三级视频中文字幕| 最新久久zyz资源站| 捆绑调教美女网站视频一区| 色综合视频一区二区三区高清| 久久综合久色欧美综合狠狠| 夜夜爽夜夜爽精品视频| 成年人国产精品| 精品国产免费一区二区三区香蕉| 一区二区三区在线看| 国产成人午夜电影网| 欧美成人三级在线| 亚洲高清免费观看| 91麻豆成人久久精品二区三区| 26uuu色噜噜精品一区二区| 香蕉加勒比综合久久| 91在线精品秘密一区二区| 国产午夜三级一区二区三| 青娱乐精品视频在线| 欧洲精品中文字幕| 国产精品免费观看视频| 国产精华液一区二区三区| 精品日韩成人av| 日本亚洲一区二区| 欧美日韩国产综合一区二区三区 | 久久色中文字幕| 日本欧美在线看| 欧美猛男超大videosgay| 椎名由奈av一区二区三区| 粉嫩欧美一区二区三区高清影视 | 国产在线观看一区二区| 日韩一区二区三免费高清| 天天操天天干天天综合网| 欧美在线影院一区二区| 一区二区三区免费在线观看| 91免费版在线| 亚洲黄色av一区| 欧美亚日韩国产aⅴ精品中极品| 一区二区三区精品久久久| 欧洲一区二区三区在线| 一区二区在线观看不卡| 在线免费av一区| 亚洲高清不卡在线观看|