www.pudn.com > Delphi_VC_JPEG2000.rar > WAVELET.PAS


(* Wavelet Kompressor 2.0 (c) 2002 by Daniel Vollmer (maven@maven.de) 
 
  This program is free software; you can redistribute it and/or modify 
  it under the terms of the GNU General Public License as published by 
  the Free Software Foundation; either version 2 of the License, or 
  (at your option) any later version. 
 
  This program is distributed in the hope that it will be useful, 
  but WITHOUT ANY WARRANTY; without even the implied warranty of 
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
  GNU General Public License for more details. 
 
  You should have received a copy of the GNU General Public License 
  along with this program; if not, write to the Free Software 
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA *) 
unit wavelet; 
 
interface 
uses 
  SysUtils; 
 
const 
  wv_DllName = 'wavelet.dll'; 
  wv_MAX_CHANNELS = 16; 
  wv_MAX_HEADER_SIZE = 1024; 
type 
  tp_bit_file = Pointer; 
  PPByteArray = ^PByteArray; 
  wv_pel = SmallInt; 
  awv_pel = array[0..268435456 - 1] of wv_pel; 
  pawv_pel = ^awv_pel; 
  apawv_pel = array[0..wv_MAX_CHANNELS - 1] of pawv_pel; 
  tp_wv_cchannel = Pointer; 
  tp_wv_csettings = Pointer; 
  tpp_wv_csettings = ^tp_wv_csettings; 
  tp_reorder_table = Pointer; 
  t_wv_dchannels = packed record 
    num_channels: Integer; 
    width, height: Integer; 
    owidth, oheight: Integer; 
    channels: ^apawv_pel; 
  end; 
  tp_wv_dchannels = ^t_wv_dchannels; 
  t_wv_mchannel_params = packed record 
    cc: tp_wv_cchannel; 
    max_mse: Single; 
    // private 
    bits_alloced, bits_unused, old_bits: Integer; 
  end; 
  tp_wv_mchannel_params = ^t_wv_mchannel_params; 
  wv_progress_function = procedure(Current, Maximum: Integer; UserData: Pointer); cdecl; 
 
function bit_open(name: PChar; const mode: PChar; const mem_size: Integer) : tp_bit_file; cdecl; external wv_DllName; 
function bit_close(f: tp_bit_file; mem: PPByteArray) : Integer; cdecl; external wv_DllName; 
function bit_read(const num: Integer; f: tp_bit_file) : Integer; cdecl; external wv_DllName; 
function bit_write(const bits, num: Integer; f: tp_bit_file) : Integer; cdecl; external wv_DllName; 
 
 
function log2i(max_val: Integer) : Integer; cdecl; external wv_DllName; 
function mse_to_psnr(const mse: Single) : Single; cdecl; external wv_DllName; 
function psnr_to_mse(const psnr: Single) : Single; cdecl; external wv_DllName; 
function wv_calc_psnr(const a, b: pawv_pel; const width, height, pitch: Integer; var pmse: Single) : Single; cdecl; external wv_DllName; 
 
function wv_init_channel(const Width, Height: Integer; const Channel: pawv_pel; const MaxBits, Lossless: Integer; 
  var NumBlocks: Integer; var ReorderTable: tp_reorder_table; prog: wv_progress_function; UserData: Pointer) : tp_wv_cchannel; cdecl; external wv_DllName; 
procedure wv_done_channel(CC: tp_wv_cchannel; FreeReorderTable: Integer); cdecl; external wv_DllName; 
 
function wv_init_channel_settings(CC: tp_wv_cchannel; const MaxBits: Integer; const MaxMSE: Single; var Settings: tp_wv_csettings) : Integer; cdecl; external wv_DllName; 
procedure wv_done_channel_settings(Settings: tp_wv_cchannel); cdecl; external wv_DllName; 
 
function wv_encode_channels(const NumChannels: Integer; ChannelSettings: tpp_wv_csettings; BF: tp_bit_file) : Integer; cdecl; external wv_DllName; 
 
function wv_init_decode_channels(BF: tp_bit_file) : tp_wv_dchannels; cdecl; external wv_DllName; 
procedure wv_done_decode_channels(dc: tp_wv_dchannels); cdecl; external wv_DllName; 
 
 
function wv_rgb_to_ycbcr(const Num: Integer; const R, G, B: pawv_pel; Y, Cb, Cr: pawv_pel) : Integer; cdecl; external wv_DllName; 
function wv_ycbcr_to_rgb(const Num: Integer; const Y, Cb, Cr: pawv_pel; R, G, B: pawv_pel) : Integer; cdecl; external wv_DllName; 
 
function wv_init_multi_channels(const MaxBits: Integer; const Threshold: Single; const NumChannels: Integer; 
  Channels: tp_wv_mchannel_params; Sets: tpp_wv_csettings): Integer; cdecl; external wv_DllName; 
 
{procedure wv_debug_init(); cdecl; external wv_DllName; 
procedure wv_debug(); cdecl; external wv_DllName;} 
 
implementation 
 
{initialization 
  wv_debug_init(); 
finalization 
  wv_debug();} 
end.